Component Creation

How to Create a Component in vs C# similar to a Image Sampler?

Override GH_Component.CreateAttributes() and assign the m_attributes variable a new instance of your custom attributes (GH_Attributes). In the attributes overwrite the Layout and Render method to create the box model and draw on it.

Don’t expect it to be easy to create custom attributes like this one at the first time.

1 Like

Thanks Dani_AbaldeI
I have worked on the thing that you told me and I have created the component. However, I do not know how to access the component input data( in SolveInstance) inside the custom parameter attributes.

Attributes are in charge of drawing the component on the canvas and handling mouse and keyboard events. The components are in charge of reading the parameters, computing the component and making the following components have to be executed. They are very different entities, although one is created and stored in the other.

What you can do is put accessible fields in the GH_Component where to store your inputs, assigned in SolveInstance, and from your attributes read them. There are other ways to do it, if you need something more sophisticated open a new post.

1 Like