algorithmic modeling for Rhino
For Each Obj As igh_DocumentObject In GrasshopperDocument.Objects 
  If (Obj.NickName = "LockMe") Then
    Dim comp As gh_activeObject = DirectCast(obj, gh_activeObject)
    comp.Locked = Not comp.Locked 
  End If
 Next
This does not work (only with some componentes/params). Error:
"An object expired during a solution".
D'oh!
Oh yeah, I got that too, but figured I would find out what to do about that next.
Hello! how to solve this problem "An object expired during a solution". thank you!
 previewAndenable.gh, 15 KB
 previewAndenable.gh, 15 KB                            Thanks for the fast and accurate replies Marcus and Dani:)   
Have I understood correctly if I say I need to cast to GH_ActiveObject (or GH_Component or - indeed Marcus - System.Object) to get access to the components Locked property? 
Thanks!
Hello! how to solve this problem "An object expired during a solution". thank you!
Thanks for the replies! There is no way to solve the problem? can you help me! thank you
You cannot change the state of the document while a solution is being computed. You need to make your changes after or before a solution runs. One way to do this is to put your logic inside a menu or window (the mouseclicks won't be handled until after a solution is done) or to schedule a solution on the document and use the callback method to trigger your changes. There are also events associated with the beginning and ends of solution you can subscribe to.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
    © 2025               Created by Scott Davidson.             
    Powered by
    