Delete all the elements created in the Dynamo script?

Basically I have a script that calculates the percentage of constructed area vs total area of a project, and the script does this by creating new floors, curves, polycurves, points, etc. The problem is that, in the end, all those elements are left in the project when the calculations are done, making my project look like this:

When it should look like this:

How can I delete all those leftover stuff? I really just want the result of the calculations. I tried using the springs package to delete elements but it doesn’t recognize curves, polycurves, points… as elements. What should I do?

Go to Revit, click undo, simple
Or close without saving

Are you writing the percentages to a parameter or just noting them? If just noting, then what @Marcel_Rijsmus suggests will work. If you are writing the percentages to a parameter, then try using Element.Delete from Revit package. Of course you will have to use a passthrough node to make sure the elements are deleted after your calculations have completed and the value is written to the assigned parameter.

Did you try using the OOTB node element.delete?

I would expect that these are not Revit elements, but Dynamo geometry. As such they shouldn’t need to be deleted, any temporary geometry will stop being displayed after you close Dynamo.

1 Like