I’m programming some nodes using python scritps, but I have a terrible crash everytime I test my nodes in big models. The goal of the code is to intersect a big surface, using a matrix of small surfaces. In the pictures you can watch the procedure. I think that the code is correct because sometimes it generate every surface correctly, but sometimes it doesn’t. When I use less horizontal divisions, and less vertical divisions (stories of a building), Dynamo works perfect, but when I increase the number of those divions, Dynamo crashes repently. And also when you change the number of divisions from a small number (e.g. 3) to a bigger number (e.g. 30) also crashes. I show part of the code, it’s pretty basic, do you think there is a better way to do it?
Have you ever experienced something like this? I don´t know if the computer, the code, the python platform or dynamo is causing this problem.
@Michael_Kirschner just a query, when the import statement is used in Python is it not the equivalent of the using statement within C#? What I’m getting at is, is object disposal not handled by method 1 (of the link) and using the Dispose() method in this case is consequently a redundant action?
Thanks for the info. If I understand correctly then, the ‘directive’ using statement does garbage collection not the statement…and python has no equivalent. Cheers!
I should have been more clear - the using directive is analogous to the python import statement it just references a namespace / assembly
the using statement with {}
calls dispose before the block exits - neither do garbage collection… dispose is unused for unmanaged code (native code like c++) that doesnt know anything about .net garbage collection and thus must be cleaned up manually with dispose or using.
The solution proposed by @Michael_Kirschner works perfectly! I didn’t know that python nodes need to dispose higher dimension geometries as surfaces and solids.
I used the method Dispose() in those geometries, and in some cases I used “del” method, in the cases of lists. And also I used the destructor del within some object classes.
The solution by @Konrad_K_Sobon its nice too, I used in one function. I recommend to read the link that he shared. It’s important to maintain the code clean to dispose the objects correctly and avoid the strange behavior of dynamo.
Doing this, it came to my mind another doubt… I hope you can help me:
I’m programming some nodes in python to create a package and publish it… But I read that you can code in C#, using something called Zero Touch and even you can custom your own nodes, like create combobox nodes… My question is: is it better/more efficient to create nodes using C#? Is it difficult to translate the python code to C#? (I don’t know nothing about C#)