Grasshopper

algorithmic modeling for Rhino

Hi everyone,

I'm working on a GH assembly in Visual studio and I have a question regarding the following:

Is it possible to preset the starting value of an input? I'm guessing it is, but can someone tell me how to do this in the VB code? Should I do this at the RegisterInputParams Sub?

Ideally this would work equal to the 'series' component, where also some initial values are set.

Thank you in advance!

Michael

Views: 349

Attachments:

Replies to This Discussion

Hi Michael.
You can specify default values of an input if you register your input using pManager method.


something like this:

Protected Overrides Sub RegisterInputParams(pManager As     Grasshopper.Kernel.GH_Component.GH_InputParamManager)
pManager.AddIntegerParameter("yourinput name", "yourinput nickname", "description", GH_ParamAccess.item, "default value")
End Sub

Works great! Thank you!

And if the overload you need doesn't exist, you can always get the parameter, cast it to the correct type and assign values to the PersistentData.

Dim param2a As IGH_Param = pManager(2)

Dim param2b As Param_Number = TryCast(param2a, Param_Number)

param2b.XXXXXX

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service