Grasshopper

algorithmic modeling for Rhino

Hello All,

I would like to set the value of an input parameter from a form that i am using. Basically the user will enter values on the form and when he hits ok i want the input parameters to reflect what was chosen. This would give the user the option of using the form or using typical inputs from other modules. So i have been looking and i am unable to find anything referring to the command "set number" which appears when a user right clicks the parameter. I also need this data to be saved with the document at the end of the session. Dose anyone have any suggestions on how this can be achieved?

 

Thank you

 

Views: 304

Replies to This Discussion

Hi Erik,

 

you can only set values if the parameter in question does not have wires going into it. Well, you can set values anyway, but they won't be used. 

 

What you need to do is set the Persistent Data of a parameter. Once you have your parameter as a Kernel.Parameters.Param_Number, then call:

 

numParam.ClearPersistentData()              

numParam.AddPersistentData(New GH_Number(value))              

numParam.ExpireSolution(True)

 

If you want to set multiple parameters at the same time, use:

 

numParam.ExpireSolution(False)

 

Then call:

 

ghDocument.NewSolution(False)

 

when you're done setting all data.

 

Note that you cannot do this while a solution is being computed.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks David, works perfectly.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service