Grasshopper

algorithmic modeling for Rhino

Still wrapping my head around the transition from Processing to VB in grasshopper...

How would I setup multiple classes of objects within a VB grasshopper component?  Is this possible or do i have to consider each component as a separate class of objects which would have to be fed into another component to setup class interactions?  Does anyone have a simple example of how something like this is setup? Thanks!

Views: 558

Replies to This Discussion

You can create your own classes within a scripting component. However, those classes, even if declared as public, will only be accessible from within that particular scripting component.

The best thing to do to create multiple custom classes, which could be accessible from any and all components would be to create those classes in Visual Studio and compile your own dll. Then you just add the reference to that dll to the scripting component, and you should have access to the classes that you create. If you want different components to have access to the same information, not just classes, then you can create shared members or use a module instead of a class.
Thanks very much Damien. Im a bit of a fish out of water in visual studio as ive just started transitioning into VB and C++ the last few weeks. I tried looking at Ben Sitler's posted pdf on creating custom components here...
http://www.grasshopper3d.com/forum/topics/guide-to-creating-custom

...but had some immediate unfamiliar errors to debug...I'm wondering if you perhaps have an example of creating multiple classes within a single component for now as I continue to transition into writing components in visual studio. Is this as simple as copying everything from within "Public Class Script_Instance" and changing the name of the duplicate class to my own name? I imagine not...Any help with this would be really helpful. Thanks again.
I'd forget about custom components for right now. They are useful, but 9 times out of 10 you can get what you're looking to get done without them. Plus if your interested in creating classes, your still going to need to do that within a component anyway.

Luckily you don't really need much for actually creating your dll, since all it will be is literally the classes and that's it. No project structure to follow or anything like that. Just choose New Project, and choose Class Library and your done.
Alright that makes sense for now, thanks alot Damien
If I can I'll try to post an example. It isn't necessarily too hard, just new if your unfamiliar with the process.
That would be great if you have something applicable, thanks very much.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service