Grasshopper

algorithmic modeling for Rhino

How to Change Input Params DataType of GH_Component At Runtime

Hello Everyone!

How to change the input params datatype of the compoment at runtime? My Code is as below(ScreenShot):

Unfortunaly, There has an problerm that, When I Click the MenuItem to change the data type of the param, the param name has change as predict, but when I hover to the params, the tooltip content is the param's change before. At the same time, I can not connect the params  with Another.

Is anyone Know How to Slove the Problern? Thankyou

Views: 541

Replies are closed for this discussion.

Replies to This Discussion

Try calling ParameterServer.OnParamsChanged (or something close to that, can't remember the exact naming). You don't have to cache the GH_ComponentParameterServer btw. you can just invoke directly on Params each time.

Alternatively, create a single parameter type which can handle various kinds of inputs without having to be swapped out. Then you could more easily persist wire connections and modifiers.

ThankYou David.

Is there any Code Demo for Dynamic change the  parameter  of the Grasshopper Component?

No, it's not exactly a common thing to do. Even changing parameter properties such as access, optionality and such is a rare thing during runtime.

OK, Thanks David,

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service