New to both C# and Grasshopper. I'm stuck creating a very simple component

Hello

I am trying to make a quick component to help learn C# and Grasshopper. I just want to invoke the Curve.DivideByLength method in a custom Grasshopper Component. Code is below, What am I missing? I think it is something to do with assigning the Point3d array to the output param. Also do we have a c# grasshopper discord?

HI
The access type of your output parameters should be set to list.


Then use DA.SetDataList(0, splitpoints) to output

Hi,
If you want to output a list it should be set in the gh param access in line 33 also you should it change in line 55 to list

Thanks guys - this worked. Looks like i wasnt so far off after all :slight_smile:

I apologize for the trivial questions, this is the first time I’ve tried C # and I’m trying to follow the guide on the site Simple Component with C#, VB

  1. do I have to create a guid for each component?

  2. How should I use the https://www.guidgenerator.com/ site to generate an ID?

For each new component, you have to replace the ComponentGuid string with a new one generated with that tool (is the one that I use) via copy-paste. Otherwise, when GH loads the component, it will tell you that a component with that ID already exists.

Use Guidgen.exe, which is included with Visual Studio (Tools > Create GUID).

– Dale

1 Like