algorithmic modeling for Rhino
Hi to all
I would like to create a new type of parameter that extends a current one like the line param for example and add a few attributes.
I have searched on the online help but there is no example on how to extend if possible a current parameter, only the generic template GH_Param/span>'T> .
For example i would like to make a cable component, in input gets a bunch of lines
plus attributes and in output a cable parameter (lines + attributes).
of course this new parameter will be used in another component that knows how to use it.
Any hint or example on this ?
thanks
gerry
Tags:
Hi Gerry,
There are several ways to accomplish this. You can create your own geometry type (new class that inherits from GH_GeometricGoo or GH_Goo) or you can work with present Geometry types.
I'd suggest you save the attributes as UserData on the Line geometry.
A custom GH_ type will not be useful for other components. Since data stored as UserData on the geometry on one component will be consistent trough all components. On your custom component you have just to check if your data is present on the line geometry.
A bonus is, that when these lines are baked, the user data will be on that geometry, so your attributes will always be present.
Another argument is, that via rhinoscript or python you can set userdata ("strings") which might be handful at some point.
It's a little bit of work in the beginning. But it's worth it, user will appreciate this.
Cheers,
FF
Hi Florian
Well this is good new for me , since I already add user data
to Rhino Objects with the master Rhino plugin, this means
that the grasshopper part will be compatible with the rhino plugin that are designed
to be 2 separate programs but it seems they can see each other with this method.
Do you have a example on to add a user data (not strings , I need my own GuUID)
in c#, read & write
This will be the only thing I need I hope
thanks
gerry
I've done a quick example in c#. I've done a quick example with the GUID type, but different datatypes are possible to store...just take a look at this page: http://4.rhino3d.com/5/rhinocommon/html/AllMembers_T_Rhino_Collecti...
In addition i've added an example with a generic cast, maybe someday you need this.
If you're using this UserDictionary it might be best to use some prefix for all your keys like in the example "ix4_" so you can sort your keys out from other ones.
Cheers
FF
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by