Hi to all,
I’m developing a custom component for Grasshopper. I use this component to create some geometry in RH/GH then created into another calculation software throught API. When this geometry is created throught API a GUID is assigned in the calculation software. This GUID is stored (in the GH component) and then when the component run again (because the inputs data in GH are changed) the component delete the old element in the calculation software and create the new one and new GUID is assigned. The GUID is then saved using Write() override and then Read() method run when the GH file is opened.
What I understand is that SolveInstance is (or can be) called many times within the same solution (refer to https://www.grasshopper3d.com/forum/topics/is-the-solveinstance-method-called-everytime-an-input-is-changed) but I don’t understand the behaviour when I open the GH file that has been saved. Debugging seems that the solution SolveInstance() run again and I’m worried that the element is created two times into the calculation software (that already containts the same element).
From my tests seems that, even if SolveInstance() run again after Grasshopper is opened seems that no new elements are created. Have Grasshopper some kind of check that the previous inputs have not changed when I open the file or I have to provide this control? This control can be to store data when the file is saved/closed, and set persistent data when the file is opened?
In few word I want to avoid or to control running a new solution when the .gh file is opened.
Then SolveInstance() can run many times within the same solution, but I don’t understand if the process is:
a.) Many loops of BeforeSolveInstance()-> SolveInstance() -> AfterSolveInstance()
b.) BeforeSolveInstance() -> many loop of SolveInstance() -> AfterSolveInstance()?
Since SolveInstance() has and iterator seems to be b.).
Additionally I have another question: Components run one at once or they run in the same time if they are not dependent on each other? I mean varius SolveInstance() can be called at the same time?