This question has been asked a few times, but I haven’t really found a solution in the answers…
Is there a way to prevent automatic flushing out of objects when creating and passing them inside classes between GHPython components? See a very simplified example below, where I first store a rectangle inside a class, that is passed through a second component to modify one parameter:
But, the curve that is stored in the first component is automatically removed from memory afterwards, so when changing the value of “mass” in the second component, the third component will generate an error:
Is there a better way to do this? Should I use Rhinocommon instead, and how? The fact that I don’t see it covered a lot in the forum must mean that this is not common practice when wanting to create custom Grasshopper components, as is my goal.
So, I’m just posting a working setup for future reference for anybody wanting to pass geometries between custom classes by what was proposed by @AndersDeleuran and use rhinocommon directly instead and also solve the problem of null object errors: