Grasshopper

algorithmic modeling for Rhino

 

Dear all and David,

I would like to create a custom stepped numeric slider and a custom checklist which would contain several different checklists on the one component.

I also want the custom checklist and the custom numeric slider to be able to talk to each other, so that when options are updated on the numeric slider these updates are reflected on the checklist.

Firstly is this possible? I saw this discussion here however I am still confused what is the best approach.

To me, it appears from the discussion that I can create my checklists and numeric sliders using both components and parameters but using a parameter will be easier. Is this correct?

Regardless of whether I use a component or parameter what exactly should I be overriding and where is the best place to start?

Also any sample code would be most appreciated!

Thankyou!

Views: 1649

Replies to This Discussion

Firstly is this possible?

Yes, though it may be difficult.

Parameters are easier objects to control because they are just individual things. Components are aggregates of objects (specifically, the component itself and all its input and output parameters), and therefor harder to control.

If your object only requires at most a single input and a single output, then you definitely want to stick to IGH_Param. Did you get the Grasshopper SDK documentation (via the GH help menu)? It contains an example object with overridden display. Probably a good place to start.

David,

Thanks for your reply, I've taken the approach of inheriting from Grasshopper.Kernel.Special.GH_NumberSlider and then creating custom attributes.

However I can't seem to find a way of getting and setting the actual values seen by the number slider in Grasshopper apart from using the  Grasshopper.GUI.Base.GH_SliderBase, should I be doing it this way?


Thanks

You can go http://www.food4rhino.com/app/panda ,and you can also use Panda_UI to create slider and checklists.

Panda,

Thanks, I see that you have written some code that will change the transparency of the numeric sliders what else can Panda do with numeric sliders?

Thanks,

Anton

Anton,

The founction of panda sliders is almost the same as gh sliders except animation,but panda sliders can be increased by steps like 1,3,5...

Hi Panda,

Yes I see this now this is cool. I still need to add some custom functionality though and for this it would be best to create my own sliders, however I still haven't worked out how to do this. Would you be able to share your code?

Thanks

Anton,

It would be complex.You shou overwrite the component attributes.

I will upload a example of mine which you can use as a reference.

Attachments:

Panda,

Again many thanks for sharing your code which I’ve now gone through.

I assume that the logic which you’ve written in this code is used in the discontinuity option component is that correct?

What I am having trouble understanding is how do you relate the logic contained with this code back to a Grasshopper Param or Component and make it act like a number slider.

I assumed that you would inherit the class Grasshopper.Kernel.Special.GH_Slider like what Andrew Heuman does here: https://bitbucket.org/andheum/falsestarttoggle/src/446c2d1fbe83fa44...

(David is this the best approach?)

Have you done this? Basically what I am asking is what is the code in the class PANDA_CONTROL_SLIDER_FORM? I can see that you are making an instance of it but that’s all I can see.

Is this the class that you are using to make a GH component that acts like a slider?

感谢您的帮助 ; )

 

Anton,

PANDA_CONTROL_SLIDER_FORM is just a windows form

You can use Grasshopper.Kernel.Special.GH_Slider like what Andrew do.

Anton,

It's too complicated to rewrite a new gh_slider.

If you just want to Realize the function of drag slider by step,you can set slider expresion.

For example:if the step=4,then set slider expresion:4*x.

Hi Panda,

You are right I actually worked out a compromise it seems to work quite well, it forces certain numbers when the user is sliding

Attachments:

RSS

About

Translate

Search

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service