Grasshopper

algorithmic modeling for Rhino

How to communicate with upstream components (sliders or custom objects).

I have already seen such behaviour implemented in Galapagos, Anemone and Centipede.

I can't find something related in IGH_Param.

Views: 619

Replies to This Discussion

Grasshoppers work flow is from left to right. Components on the right are considered downstream and left upstream

Incidentally if you look on the Edit Menu you will find a Modify Selection option that gives you various abilities to change what you have selected upstream and downstream

I think David Rutten can help me with these.

Neither of them are actually passing data backwards. I don't know how Anemone does it, but it's not possible to create a wire that works in the other direction. Sliders have methods on them that allow other objects to figure out how many distinct states a slider can have and then also set one of these states.

For example imagine a slider from 1.000 to 2.000 with 3 decimal places. This slider can have a states like: 1.000, 1.001, 1.002, 1.003, ..., 1.578, 1.579, 1.580, ..., 1.999, 2.000

This adds up to one thousand and one different states, which you can find out by using the Grasshopper.Kernel.Special.GH_NumberSlider.TickCount property. There's another method that allows some remote actor to set a specific state. For example you can say GH_NumberSlider.TickValue = 50, which will set the slider to 1.049. Galapagos prefers to use integral numbers to floating point numbers, so it talks to sliders using these ticks. If however you want to set specific values, then you can use TrySetSliderValue() and SetSliderValue() and assign decimal values directly.

It's important to note that the remote object (be it Galapagos or Anemone or whatever) has to call these methods specifically. There's no way to create a 'reverse connection' with a slider and have it work automatically.

--

David Rutten

david@mcneel.com

Thank you, this helps me a lot. (Grasshopper.Kernel.Special doesn't covered in my local copy of the SDK chm). Will try to find another way.

True, the CHM docs omit certain namespaces, you'll have to use intellisense to find out which classes and which methods/properties exist.

--

David Rutten

david@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service