Grasshopper

algorithmic modeling for Rhino

Guide to creating custom grasshopper 0.6.X components

People might find this useful.  Please do let me know if you find any errors or omissions.

Best regards,

Ben Sitler

Note: on 2/4 at 13:00 I updated the manual to reflect the discussion on where to locate components on the Grasshopper ribbon.

Views: 19146

Attachments:

Replies to This Discussion

Stability wise, I wouldn't say so. Speed wise, there's a definite advantage, both in execution and development. Because the code is already compiled it will run faster, since it doesn't have to be compiled on the fly. IMHO, its easier/faster to develop within VS than within the GH scripting component. Intellisense is better, there's better error descriptions, you can debug your code. Not to mention that there's more freedom to develop a component (in regards to creating your own class structures, etc) than there is a regular script.
One approach is not more stable and is not necessarily quicker/slower than the other. Damien mentions some good points, but the time spend compiling a script is mere milliseconds, and it only has to be compiled once.

Stability is purely a result of how good your code is. You can crash Grasshopper+Rhino just as easily from within a VB component as from within a custom component. I do handle most exceptions for you in both cases though.

There is however (especially now) a performance impact with data transfer. If you plug a Brep into a VB component, it will get copied first. This is not necessarily the case with custom components. The next release of Grasshopper (based on the RhinoCommon SDK) will not have this impact anymore, due to the nifty way RhinoCommon handles unmanaged pointers.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
David,

You mention the copying of geometry. Does this only happen with Breps or all geometry? For example, if I pass in a whole bunch of lines or curves, does this geometry get duplicated and thus might impair speed of the script?

With this discussion, would it be best to wait till the GH transition to Rhino common and see how script performance possibly improves and decide whether it is necessary to go to custom components?
Yes, it happens with all data types, not just geometry. Obviously copying a bool or a plane is no big deal, but Breps and Meshes can take up quite a few cycles. In the new approach, only a shallow copy is made (which takes the same amount of time for all data types), and a true copy is only made when needed, i.e. when you perform an action on the Brep that changes it (for example a Transformation).

I think it's an excellent idea to wait for the next version, since a lot will change. Not just the data types Grasshopper works with but also how Grasshopper works.

I understand why people are eager to start coding up custom components and if you're ok with having to rewrite your code once 0.7 comes out then feel free to start now.

I think it likely that at some point I'll include a new type of component, which carries its own source code around and compiles itself on the spot. This would make it much easier to adapt existing components and it will make the distinction between scripting and compiling even more fuzzy.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
props!
very nice!!

everybody sharing his own components its a powerfull idea.

good work Ben
Brilliant. Thanks Ben

Looking forward to many new useful and interesting components !

Spotted what I think is one tiny error in the last paragraph - I think the default keyboard shortcut for Force IntelliSense (In Visual Studio Express at least) is Ctrl + Shift + Space
WOW!!! great work!!!
thanks!
Great job man, thanks a lot.
I think this might add the need for a "custom components" database / library sub-site here at grasshopper3D. That could be one single spot for sharing new custom stuff!
Why not build that browser into Grasshopper itself?

--
David Rutten
david@mcneel.com
Poprad, Slovakia

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service