Grasshopper

algorithmic modeling for Rhino

Hi All,

 

I was wondering (and couldn't really find a direct answer on the forum) whether it is possible to dynamically control the number of input parameters. Let's say if a small component with only one input, receives and input, a second input appears, and so on...

I would like to develop a component which has this functionality (mainly from a user friendliness perspective).

Thanks for your suggestions.

 

Joost

Views: 1666

Replies to This Discussion

I'm adding a number of functions to the core that should make all this way easier. Turns out a lot of the parameter management stuff is pretty low-level and difficult to use (even for me, and I wrote the damn code!).

 

If you can wait a few more days, I can get you a better SDK.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

That would be very nice! I'm still very much interested in a proper solution.

Give me a sign when I can start playing around with these new functions.

 

Thanks!

Hello,

 

Question: Why cannot we modify the number of parameters during a solution?

 

After disobeying that with the attached code(Test.cs), I am able to add input parameters from within the SolveInstance() method. Surprisingly enough, the component works fine(Untitled2.png), but after producing the error (Untitled1.png) 'n' number of times, where n is the number of dynamically added input parameters.

 

Any chance of getting rid of the error?

 

I am guessing that I should have gone about the task via EventHandlers, but I am still learning how it works and so have no clue how to access the data inside the initial input parameter using them.

 

Attachments:

EventHandlers, you are my bitch!!

Woohoo, fixed it! And this time, not inside SolveInstance(). Code attached!


 

 

Attachments:

Getting pretty close to having a much better SDK and GUI (ZUI actually) for variable parameters.

 

http://www.youtube.com/watch?v=XgRWE4r2FH8

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

 

Hi David, any news on this development?

 

And I have another question, currently I'm developing a toolbox using a somewhat older version of Grasshopper (0.8.0010). I'm slightly hesitant to change to a newer version as it might skrew up my current configuration. One minor issue however is that I haven't been able to find a 'rhinoScriptInterface.RunSolver()' or any similar method, which I know exists in newer SDK's. Is there such a method for my version?

 

Regards.

 

Joost

Yes. The GH_ParamServer class now has events that allow you to keep track of parameter changes. Basically it channels all events from all the parameters and provides a single bottleneck event for them all, which means you only have to register a single event handler instead of registering and unregistering for every input and output parameter in your component.

 

There are 3 events, two special ones and a generic one:

 

this.Params.ParameterNickNameChanged(Object sender, GH_ParamServerEventArgs e);

this.Params.ParameterSourcesChanged(Object sender, GH_ParamServerEventArgs e);

 

these two are called whenever a nickname or a source list is modified on any parameter associated with the component.

 

this.Params.ParameterChanged(Object sender, GH_ParamServerEventArgs e);

 

this one is called all the time, for any type of change (including the above two).

 

I'll add a topic to the SDK docs about how to use these events, but if you have a specific question, ask away.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

That topic could be really useful :)

I'm having problems figuring out where to place the "AddHandler" statement (I've putted it inside component constructor) and how to code and where to place the handler Sub.

Regards.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service