Grasshopper

algorithmic modeling for Rhino

Before I lose a month of my life messing around with this in Visual Studio, I figure it might be smarter just to toss this out here.

(note: im pulling this example from the sample code thats provided in the grasshopper assembly on the visual studio site)

Im new to trying to right my own .gha in visual studio. Im curious to know the particulars about setting the output data type.

i see that you can create one like so

pManager.Register_CurveParam("Spiral", "S", "Spiral curve");

if in my code i create a my own class (object type) can i set my output as that type ergo

pManager.Register_MyAwesomeDataType(... yada yada yada ...)?

or is the best i can do something like

pManager.Register_GenericParam();

Mario.

Views: 562

Replies to This Discussion

Hi Mario,

at first you should not use the Register_??? methods anymore, cause they're obsolete. Use the Add??? methods (see the SDK)

You can use AddParameter method to register custom type data...look at this post: http://www.grasshopper3d.com/forum/topics/persistent-data?commentId... and leave the part with persistent data.

Hope this helps,

FF

Yup, you're right. I tried to jump in feet first without checking out the SDK... Lesson learned.

If you create your own data type you'll either have to use the Generic parameter OR you can create a custom parameter class that handles your data type. Then you can create a new instance of this parameter and use the pManager.AddParameter() method.

--

David Rutten

david@mcneel.com

Tirol, Austria

Hey, thanks everybody for you help, trying to crack this VS C# egg should be a fun time, and your help really makes it worth the effort.

is there any work in the pipeline to produce an updated VS Grasshopper template?

Mario

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service