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.
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.
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:
i have the same Poblem here... can someone please post a little code snipped how that would look like?
Thanks a lot!