Select faces of walls with python script crash!

Hi everyone,

I have problem with my dynamo code and i can’t find solutions. So I post my problem here if someone met this !

Let me present you the aim of my code :

I want to find the highest point and the second highest point of walls. I have 3 categories of walls.
-Classic wall without modification edges or profil
-Walls with modification of profil or edges
-Walls with wallsweep on the top (for acroterions)

For the first and third categories no problem because i use « Element.Geometry » « Boundingbox » and « maximum.items ». Geometries are uncomplicated.

Second category : Element.Geometry doesn’t work because he finds « null » randomly . I have chosen to write a python script in order to select faces with Api Revit. Convert with « ToProtoType() » and OUT “surfaces” to apply « boundingbox ».

When I run it for the first time it’s ok. For the second time, I have an avertissement and the third time crash Revit. This is very unstable ! My python script have detected 200 faces for 1 wall so i filtered with « FaceNormal » and « Z>0.1 » (because all top surfaces have Z component >0).

I have several messages when the python script fail « Operation fail », « Polycurve may be branching», « NO_CUR_BB – no current bulletin Board » the most disturbing « memory damage Volation access memory » (or something like that, so I need to restart the computer).

Can you help me ? Did I make a mistake in my python script ? Are there other fonctions in order to simplify the python script and reduce memory ?

I attach pictures of my dynamo code and my python script after this message.

Thank you

Audran,

1 Like

Hello @acalin welcome on the Dynamo Forum

try to remove the intention in these lines like in the picture below

you can also Dispose each geometry object at the end of the first loop

Note:
remember to copy these python codes then to format them with the </> button

Hello @c.poupin

Thank you very much for your help.

I checked my script with your advice. There are 2 good news and 1 bad new.

First, the « OUT of my code give me just 80 faces that is exactly what I want !! Against 501 before, I think this new python script is more efficient.

Second, there are no error message when I run it (no violation system, no problem with « ToProtoType() »… ).

The bad new : if I run 4 times my dynamo program, Revit and Dynamo will close directly without message or dynamo will become « blank » with « No response ». So I stop it manually. It’s annoying because this code will not run just 1 time but several time during a project.

I don’t understand why this programm crash again.

Hello @acalin

  • Have you tried closing and reopening Dynamo or using DynamoPlayer ?

  • Have you tried to release any resources of Geometry Objects (Dispose())?

Hello @c.poupin ,

Sorry for my delayed response . I had a lot of work before Christmas holidays.

Yes i tried to use dynamo, dynamo player and add disope() at the end of my script like you adviced me. Like I responsed before the script was more efficient. But there was no change on the stability of the code overall.

I’m beginner in python so I’m not familiar with python script. After discution with my collegues and reflection, I change entirely my script because there was a lot of incrementation. It was not necessarily optimise. I have focused on NormalFace and « If » condiction for exemple.

My new script work properly (I haven’t this script with me currently). No crash, no error message. If you want i can post my script python when i will return to my office.

I will use this programm for my next project, I will see if my script is ok or not.

Thank you for your help

Audran

1 Like

Hello,

As agreed, This is the python script that work properly.

Happy new year,

Audran

1 Like