Recompute whole definition after running script

Hi,

i’m looking for a way to recompute the whole grasshopper definition after running a vbscript. In the old forum, I found this post:

Do i have to add something more than “Call Grasshopper.Instances.ActiveCanvas.Document.ExpireSolution(True)” at the end of my code?

Thanks!

May I ask why you’re unhappy with whatever cached data is still retained from a previous solution?

GH_Document.NewSolution(true) is what you need to expire all objects in a document and then run a new solution.

1 Like

I’m referencing rhino geometry with the elefront plugin based on user attributes. Within the script, I change these attributes to True/False of the rhino objects. This attribute change is triggerd with a button. Last step is I need to recompute either the whole definition or the Elefront Componant which is referencing the rhino geonetry based on the attributes.

I have attached a small example.

recompute.3dm (54.5 KB)
Recompute.gh (12.2 KB)

I tried your advise but I’m not sure how to use it.
Thank you so much!

1 Like

Perhaps script the entire attribute referencing and subsequent actions?

that would be nice as well, but I couldn’t find any examples how to reference Rhino objects based on usertext or with the vbscript component.

The less different plugins I need the better.

RhinoObjects store Geometry and Attributes. Attributes hold information about Name, Colour, Material, Visibility … etc.
So whenever you search for RhinoObjects you can also check its attributes for its “Name” and additional UserData.

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_RhinoObject.htm#fullInheritance
https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_ObjectAttributes.html
https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_Custom_UserDataList.htm

1 Like