algorithmic modeling for Rhino
I have a custom component that sets parent/child relationships in a nodal network.
If data is added my system works, however if data is deleted (e.g. curve deleted from list of inputs or disconnected) it fails to work.
There can be several of these components that are unaware of one another so I cannot just clear the data and add to it afresh.
If I perform a manual recompute (F5) it solves my problems.
Is there a way I can force a full recompute from within my code? I am aware of NewSolution but not sure about how I could go about implementing it (would I not end up in a never ending loop? I am also struggling to find out how to get the active grasshopper document from within the code of my component).
Any help would be very much appreciated.
Tags:
Yes you can, here are the steps:
F5 calls GH_Document.ExpireSolution(true), which first expires all objects prior to recomputing. You do not need this kind of sledgehammer approach.
--
David Rutten
david@mcneel.com
Thank you for the reply David.
Excuse me for being a bit stupid, but would you mind posting a code snippet (preferably C#) retrieving the active GH_Document and calling NewSolution(false)?
Found out how to do it, for anyone in the future it is in:
Grasshopper.Instances.ActiveCanvas.Document
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by