Grasshopper

algorithmic modeling for Rhino

I am interested in knowing whether or not I should create a new class or project within Visual Studio for each new component.

For example, if I am interested in creating two components that does addition and subtraction, should I create two classes called addition() and subtraction(), or two projects called addition() and subtraction()?

If I opt for the multiple-classes-per-project, do I simply create a new class on top of a project i.e. http://puu.sh/5p2n9/977b42e44a.png

Views: 260

Replies to This Discussion

You typically create a new class within an existing GHA project. Grasshopper ships with 11 projects that together contain the 890 components and parameters that are native.

You can create a new component class in a number of different ways. Either you can create a new Class using the VS interface (like the image you posted). Or you can just start typing on a new class in the same file as another component class. Or -ideally- you'd use the Visual Studio wizards that Giulio has put together. When you create a new component class, pay attention to these things:

  • The class must be PUBLIC.
  • The class must either implement IGH_Component or (a thousand times better) inherit from GH_Component.
  • The class must have a PUBLIC constructor which takes no arguments.

If you meet these three requirements then you can add as many different component per GHA project as you want.

--

David Rutten

david@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service