Grasshopper

algorithmic modeling for Rhino

Is it possible (VB, C, or Python) to call the command "Save State" from the Solution drop down menu while Galapagos is running?

Views: 800

Replies to This Discussion

This code is a bit sloppy, but it will save a state for ALL "state aware" objects. You could set it up to be more selective about which objects to save the state for. Also notice this does not include any cleanup code to support overwriting existing states - it is possible with this code to wind up with a bunch of states with identical names. 


GH_State state = new GH_State();
foreach(IGH_DocumentObject obj in GrasshopperDocument.Objects){
if(obj is IGH_StateAwareObject){
IGH_StateAwareObject SAO = (IGH_StateAwareObject) obj;
state.AddStateObject(SAO, obj.InstanceGuid);
}
}
state.Name = "Name of State";
GrasshopperDocument.StateServer.Add(state);

I got to the GH_State method but didn't understand in args for it.  I'll give this a go.  Thanks for this starter.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service