Grasshopper

algorithmic modeling for Rhino

Accessing a variable in another component (Without Input/Output wires)

Silly question, is it possible to access a variable from one component in another component, without plugging the one into the other?

Is there some sort of global 'Shared' variable or can you access another components variables via GUID.

I realize what I'm asking is counter intuitive and would be very fragile.... but I am curious none the less.

Thanks in advance ,

Carson

Views: 637

Replies to This Discussion

disclaimer: I don't know the real answer.

answer: no

explanation: You can define global variables in the lower portion of any VB or C# script that upon a canvas refresh or change to an input the variable will remain unchanged within the component. As far as accessing the same variable in a different VB or C# component I am 80% sure there is no way of doing that. The reason being that any object with the same name would try to be accessed and then the world ends. 

You may have to write a script within a script or have a meaningless output from the 2nd script plugged into the 1st one causing it to refresh... food for thought anyway.

Hi Carson,

even if you could reflect your way into the script, you will still have lots of problems with syncing and updates.

You can store data in a common place (somewhere on the disk or in the Grasshopper settings or the registry or something), but then there will be a lot of overhead accessing it.

I think creating a wire between two objects to share data is the best solution for now.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service