Python 3.9 component crashes while processing some BREPs in rhino 8

260924DissertationGhScriptKripa.gh (2.9 MB)
I am trying to process BREPs which represent rooms in my python component. Will first convert them into topologic cells (TopologicPy python library) and analyse them to get few properties. The component works perfectly for some BREP items (polysurfaces), and crashes for others. (mostly corridors).
Any help is much appreciated.

How do I replicate the crash? Would just opening the GH definition causes the crash?

if you try to connect the BREP for corridor to the python component it would crash for me. (currently classroom BREPs are connected)

1 Like

Ok great. I can replicate the crash and will look into it. Here is the YT ticket:

RH-84029 Python 3 crash on processing BREP

1 Like

@Kripa_Parimal_Panjar

I looked into your script. Seems like the topologicpy functions sometimes fail at creating the faces from edges. When processing this specific brep, the error below is printed on the terminal and Face.ByEdges method returns None. I added the null checks below to your script and is no longer crashing. I think these null pointers are being added to the lists in your script and being passes to the underlying topologicpy native code that causes the seg fault and crashes Rhino:

Geometry causing crash:

Topologiccpy Error Message. Note the Returning None message:

Wire.ByEdges - Error: The operation failed. Returning None.
Wire.IsManifold - Error: The input wire parameter is not a valid topologic wire. Returning None.
Face.ByEdges - Error: Could not create the required wire. Returning None.

Fix:

P.S: Script editor has a debugger that is handy in these situations to iterate the loop step by step and see where the problems are.

Thanks so much for your time and guidance. I suspected the donut geometry to cause problems. Saved me a tonne of time! thank you :smiley:

1 Like

Anytime :smiley: Thanks for using the new scripting editor and the feedback