Quantcast
Channel: Grasshopper Developer - McNeel Forum
Viewing all 3642 articles
Browse latest View live

ErrorMessage: Rhino.Geometry.Brep.CreatePlanarBreps(Rhino.Geometry.Curve) is outdated

$
0
0

@oliver_1992 wrote:

Hello.
I’m a beginner in developing grasshopper components in Visual Studio and I have quite a hard time getting the syntax of the RhinoCommon library right.

I’m trying to use:

////https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreatePlanarBreps_1.htm
public static Brep CreatePlanarBreps(Curve inputLoop)

Using the method, I’ getting the error message:

  1. Warning (CS0618): ‘Rhino.Geometry.Brep.CreatePlanarBreps(Rhino.Geometry.Curve)’ ist veraltet: ‘Use version that takes tolerance as input’ (line 57)

(veraltet means outdated)

191228_00_c#-code-samples_create-planar-breps.gh (6.0 KB)

Sometimes the method works, but I get this error message anyway.
It seems the method I´m using is outdated, but I took the method out of the RhinoCommon library.
I have attached the gh file, including my code definition in C#.
Does anybody know, what I´m doing wrong?
Best wishes,
Oliver

Posts: 3

Participants: 2

Read full topic


DA.SetDataList: How to replace list?

$
0
0

@feklee wrote:

Every time, the following command gets called, it appends to the list:

DA.SetDataList(8, new[] { 0 });

Result:

How do I make DA.SetDataList(8, new[] { 0 }) replace the list so that the result is a list with a single 0 in it?

Posts: 5

Participants: 2

Read full topic

ViewCapture to File using Python Grasshopper

Associate list item with tree branch? (1:1)

$
0
0

@feklee wrote:

I created a component that takes as inputs:

  • a point, and

  • a list of four colors.

In code:

pManager.AddPointParameter("Point", "P", "Center point", GH_ParamAccess.item);
pManager[0].Optional = true;
pManager.AddColourParameter("Colors", "C", "Colors of vertices", GH_ParamAccess.list);
pManager[1].Optional = true;

Now, if I pass a list of points and a list of lists of colors (tree), then all possible combinations are created:

This is not what I want. I want each point associated with the corresponding color list. I can do so by grafting the list of points. Then each input is a tree:

This is what I want!

Is it possible to make this grafting step part of my component, so that the user of it doesn’t have to do it?

Posts: 2

Participants: 2

Read full topic

How to get size and location of ETO cells from gridview

$
0
0

@flokart wrote:

Hi all,
ist there a way to get size and location for each cell from dynamiclayout.
Forms seems to have no option to get size , only drawing.

Any tip is welcome.

Posts: 2

Participants: 2

Read full topic

How to create dropdown component in GH C#?

$
0
0

@michaldengusiak wrote:

How to create a dropdown in C#?
I have a list on enums:

public enum PanelType
{
    Undefined,
    Wall,
    WallExternal,
    WallInternal,
}

and trying to make a component that will allow user to select via the drop down… here is my GH script for the component below. Any help will be really appreciated :slight_smile: :stuck_out_tongue:

    namespace SAM.Analytical.Grasshopper
    {
        public class AnalyticalPanelType : GH_Component
        {
            /// <summary>
            /// Panel Type
            /// </summary>
            public AnalyticalPanelType()
              : base("AnalyticalPanelType", "AnalyticalPanelType",
                  "Snap Panels",
                  "SAM", "Analytical")
            {

            }

            public override bool AppendMenuItems(ToolStripDropDown menu)
            {
                base.AppendMenuItems(menu);

                ToolStripDropDown toolStripDropDown = new ToolStripDropDown();

                foreach (PanelType panelType in Enum.GetValues(typeof(PanelType)))
                    toolStripDropDown.Items.Add(panelType.ToString());

                Control control = new Control();
                global::Grasshopper.Kernel.GH_DocumentObject.Menu_AppendCustomItem(toolStripDropDown, control);

                return true;
            }

            /// <summary>
            /// Registers all the input parameters for this component.
            /// </summary>
            protected override void RegisterInputParams(GH_InputParamManager inputParamManager)
            {

            }

            /// <summary>
            /// Registers all the output parameters for this component.
            /// </summary>
            protected override void RegisterOutputParams(GH_OutputParamManager outputParamManager)
            {
                outputParamManager.AddGenericParameter("PanelType", "PanelType", "Analytical PanelType", GH_ParamAccess.item);
            }

            /// <summary>
            /// This is the method that actually does the work.
            /// </summary>
            /// <param name="dataAccess">The DA object is used to retrieve from inputs and store in outputs.</param>
            protected override void SolveInstance(IGH_DataAccess dataAccess)
            {

            }

            /// <summary>
            /// Provides an Icon for the component.
            /// </summary>
            protected override System.Drawing.Bitmap Icon
            {
                get
                {
                    //You can add image files to your project resources and access them like this:
                    // return Resources.IconForThisComponent;
                    return Resources.HL_Logo24;
                }
            }

            /// <summary>
            /// Gets the unique ID for this component. Do not change this ID after release.
            /// </summary>
            public override Guid ComponentGuid
            {
                get { return new Guid("25a6b405-19ab-4ff1-9666-7760997ccfdd"); }
            }
        }
    }

Posts: 5

Participants: 2

Read full topic

System.InvalidOperationException: Cross-thread operation not valid

$
0
0

@feklee wrote:

I created a counter component. It asynchronously expires itself every half a second:

private void expireSolutionAfterDelay(IGH_DataAccess DA)
{
    Task.Delay(500).ContinueWith((task) => {
        ExpireSolution(true);
    });
}

protected override void SolveInstance(IGH_DataAccess DA)
{
    DA.SetData(0, counter);
    expireSolutionAfterDelay(DA);
    counter++;
}

Project.zip (879.4 KB)

When I insert this component I get:

What am I doing wrong?

I hope this example is not over simplified and helps me solve the actual more complex problem: Data is received asynchronously from a server. The component should expire itself every time a new data package is received.

Posts: 5

Participants: 2

Read full topic

How to make Optional inputParamManager using C#?

$
0
0

@michaldengusiak wrote:

Hi, I tried this approach with Optional paramters but it does not work for me,

Here is my RegisterInputParams code with implemented optional parameters approach for _spaces . Any help will be appreciated :slight_smile:

        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_InputParamManager inputParamManager)
        {
            inputParamManager.AddGenericParameter("_panels", "_panels", "SAM Analytical Panels", GH_ParamAccess.list);

            int index = inputParamManager.AddGenericParameter("_spaces", "_spaces", "SAM Analytical Spaces", GH_ParamAccess.list);
            inputParamManager[index].Optional = true;

            inputParamManager.AddNumberParameter("_tolerance_", "_tolerance_", string.Format("Topologic CellComplex default {0}", Geometry.Tolerance.MacroDistance), GH_ParamAccess.item, Geometry.Tolerance.MacroDistance);
            inputParamManager.AddBooleanParameter("_run_", "_run_", "Run", GH_ParamAccess.item, false);
        }

Posts: 3

Participants: 2

Read full topic


Kuka & English wheel paths from doubly curved surface:

$
0
0

@sethdefore wrote:

Backstory:
Way back in 2017, the R&D team (Elena Vazquez and James Coleman) at Zahner used a Kuka and an English wheel to develop a doubly curved surface. In short, they used grasshopper and kangaroo to extract the points and their direction from a surface, and then convert them to a 2d path for a Kuka and English wheel to follow. The results were beautiful.

In 2018 two researchers, Gabriella Rossi and Paul Nicholas pushed this even further. They basically added a Kinect, a network and AI so that the Kuka could learn and develop over time. Simply put. The results were, of course, more accurate. In theory, the more the Kuka wheels, the more accurate the results.

I’d like to test this theory and see how accurate we can really get using the point cloud/feedback loop setup.

Research:

https://www.researchgate.net/publication/325810118_Modelling_a_Complex_Fabrication_System_New_design_tools_for_doubly_curved_metal_surfaces_fabricated_using_the_English_Wheel!

I’ve attached an image from Zahner of what I’m trying to accomplish 1st.

Goal:
Of course, I’m not asking for someone to make anything but I would appreciate it if someone could point me in the right direction. Essentially, I’m trying to take a doubly curved surface, subdivide and extract the points, find their direction and translate that to a 2d path for which to follow.

I’m familiar with grasshopper but obviously not an expert.

For this project, accuracy is more important than saving time and cutting corners.

Thanks!

Double Curve to 2D Path.gh (4.4 KB)

Posts: 2

Participants: 1

Read full topic

Data tree replace negatives with zero

Kangaroo2 - Drape open mesh object (collision, gravity)

$
0
0

@BenjaminU wrote:

Hi,

I have some difficulties with “draping” my mesh with Kangaroo2. The mesh (a scan) is very complex and not possible to turn into a solid, it’s also important that the form is not modified.

My script works when I have a solid mesh/brep, then the “drape” object is falling like a fabric/cloth over the solid. But now I can’t find a function that accepts an open mesh or similar to use as input. (I used SolidPointCollide earlier, but this is not accepting an open mesh.)

Is this not possible to solve with Kangaroo2, or have I missed a function method somewhere to make this work?

All the best
Benjamin

Posts: 1

Participants: 1

Read full topic

Bug? Brep Intersection in Grasshopper and RhinoCommon not the same

$
0
0

@RIL wrote:

I might have had the wrong expectations, but I assumed that GH component Solid Intersection (pictured) followed the same logic as the RhinoCommon (RC) command Brep.CreateBooleanIntersection, but the latter doesn’t recognize if one Brep is entirely inside (“contains”) another Brep.

Fig 1. The component: “Solid Intersection”:
invalid_intersection_test_00

Fig 2. What’s the same: If any Brep’s surface or edge intersects any surface of the other Brep, then an intersection is detected (here some lower edges of a smaller BoundingBox is outside a larger BBox, and thus that part is cut off by the RC.CreateBooleanIntersection(). This is OK and expected:

Fig 3. What differs: However, when the inner BBox (green edges) is entirely inside the outer BBox (red edges), the intersection is not detected by RC.CreateBooleanIntersection() whereas the gh component “Solid Intersection” does detect it as an intersection:

My workaround: In C# code, when no intersection is found with the RC.CreateBooleanIntersection() command, I make an extra test for “Box.Contains(TheOtherBox)”.

What to say? Is this difference intended or is the gh “Solid Intersection” component meant to be an entirely different idea?

// Rolf

Posts: 1

Participants: 1

Read full topic

Three List GH Component

$
0
0

@eissamail wrote:

Dear All,

I am trying to create a GH component that looks like this picture:

image

Using Visual Studio C#.NET.

Could you please help me?

Thanks.

Posts: 3

Participants: 2

Read full topic

ghPython: how to write csv for excel to recognize columns and rows

$
0
0

@pawel.unger1 wrote:

Hi, I want to write a specific table with multiple rows and columns without using a GH plugin. CSV to Excel seems a good solution. Any suggestions about the formatting of CSV in ghPython to be readable as a rich excel file?

Posts: 2

Participants: 2

Read full topic

New inflation simulation component (not Kangaroo)

$
0
0

@zhuangjia777 wrote:

Hi all,

Here is a new inflation simulation component. Load a closed curve into “BaseCrv”, it gives an inflated balloon surface, and it is untrimmed! Use “Smooth number” to view animation effect.

Welcome everyone to explore the component and leave your comments.



InflateSimulation.ghx (139.8 KB)
Thanks.
Jia Zhuang

Posts: 9

Participants: 4

Read full topic


Multidimensional arrays in C# GH component

$
0
0

@Filipe_Brandao wrote:

Hi,

I’m using a 3d array on a C# component in Rhino6 (Windows) and every time I open the C# editor the code checker removes the comas inside the square brackets of the arrays declarations.

double[ , , ] xD = new double[ , , ]{{{1,2,3}}};
turns to
double[ , , ] xD = new double[]{{{1,2,3}}};
I’m not sure if this is a bug or if it is on purpose or but it is pretty annoying behavior.

Posts: 8

Participants: 3

Read full topic

Ghpy: how to use node-in-code with custom components

$
0
0

@jws wrote:

Hi,

I’d like to use some custom components (that were written in VBnet and are available as .gha) inside a GhPython component as described here.
Lets assume the component I want to access is in the Foo-tab under Bar-category and the component itself is called FooBar_Baz

Here’s the question:
How do I call the component from python?
I’ve already tried multiple versions including
ghcomp.Foo.Bar.FooBar_Baz, ghcomp.Foo.FooBar_Baz, ghcomp.FooBar_Baz, but none of them work (ie python complains about not finding the given module or function.

Thanks in advance,
Jacob

Posts: 4

Participants: 2

Read full topic

Rhino C# Extrude a surface to a solid

$
0
0

@rayaanajouz wrote:

Hi all,

What is the proper way to create a solid (rhino.geometry.brep) by extruding a rhino.geometry.surface?

I could not find a method that does this. While in the user interface of Rhino extruding a surface
as an operation is available (ExtrudeSrf).

BR,
Rayaan

Posts: 7

Participants: 4

Read full topic

Disable conduit automatically

$
0
0

@MichaelF wrote:

Hi,

I am working on a plug-in for Grasshopper that has a component that creates and interacts with a Rhino display conduit to display a textured mesh. It works great… almost too great… I can’t figure out how to shut it off automatically when the component is deleted or grasshopper is closed. I tried putting myConduit.Enabled=false in the visualization component’s destructor, but that code is not being executed when the component is deleted from Grasshopper.

How do I go about disabling or deleting the conduit when the owning grasshopper component disappears?

Thanks,
Michael

Posts: 4

Participants: 3

Read full topic

Persistence using c#/VB script component possible?

$
0
0

@yun.sung wrote:

Hello ,

I know you can override read and write of GH_IO.Serialization inside a custom component to gain persistence. But is it possible to get this behaviour using a script component instead? If not, is there an alternative method to gain persistence in another way, without writing to an external file.

I do not want to use custom components because that requires used to download and install a plugin.

Cheers

update: i found this thread: https://www.grasshopper3d.com/forum/topics/key-value-user-text-within-grasshopper-document. will see whether it solves my problem.

Posts: 2

Participants: 2

Read full topic

Viewing all 3642 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>