Batch open documents, delete elements, save and close / delete elements in multiple files

Hi!

I’m trying to automatically open a large number of rvt files (created from ifc links), delete certain elements (in this case bolts and generic models) and then save.

I have a similar script that successfully purges all of the files (thanks for sharing @Alban_de_Chasteigner), however I am struggling to make the attached work. The graph appears to run successfully, however the elements I expect to be removed / deleted from the models are still there.

Does anyone have any experience of doing a similar thing or any ideas on where I’m going wrong?

Many thanks in advance.
BatchDeleteRevitDocumentElements.dyn (56.2 KB)

2 Likes

Hi @thomas.lundUUGP8,

For several documents, the Delete Elements in Document node should work with a longest lacing.

Thanks @Alban_de_Chasteigner. I’ve tried switching that node to longest lacing but it still doesn’t seem to have delete the elements I expected it to. I’m not actually sure if it’s removed anything:


It is working fine with standard Revit files.
Did you try to delete IFC elements with Dynamo in a current document and does it work ?

Hi @Alban_de_Chasteigner, I had it working using the below - this worked on the ifc elements:
DeleteElementsInDoc.dyn (40.3 KB)

A few different nodes in use as these didn’t work with the batch version.

Can you share one of your Revit files ?

Sure:

It is working with your sample file.
One document :

Several documents (3 copies of your example file) :

Not sure why it doesn’t work for you.

How odd! Many thanks for testing - I’ll try to figure out why it’s not working at my end and post here.

1 Like

So it finally ran and it looked to have worked, however looks like it’s only deleted elements in the original file (and not the duplicated ones):

.

Did it remove in all of the files for yourself?

Yes you’re right. This custom node probably needs a code review.

1 Like

Hi,

I forgot about this topic but the Delete Elements custom node has been updated in Genius Loci v2021.3.23 and after checking the deletion now works for several files.

2 Likes