Purge only old residual .dwg files

SO I know how to do an all purge using dynamo. but we all know that is a bad thing unless you know what you are doing. What I want to do is just purge out the old residual linked or imported dwg files that are no longer in the project.

GetUnusedElements Method
This method with the appropriate category (which I believe is INVALID for import types) should be all you need.

isn’t that for Revit 2024 and above. we are still using Revit 2023 Thanks in advance.

Ah. In that case you have to define what an “unused” import is yourself. It should be as straight forward as any import symbol with no instances. So all you need to do now is get all import symbols, get all instances of each symbol, and filter for those with no instances.

Ugh still fighting this cant seem to find the way to purge the unused .dwg before all the find imports fires.
Find Imports_script.dyn (79.3 KB)

Can you share a screenshot of what you have so we can see what’s going on?

like I said I only want to purge out the unused .dwg not all unused (they do not show up when I run this script since they are deleted but the old .dwg still remains.

You’re getting all ImportInstances. Of course those imports will be in use because the instance exists. You want to get all import symbols (types) and then check to see which types have no instances.

EDIT: Admittedly, I can’t find where Import Symbols live. I could have sworn they were available but I may be mistaken. You may have to go through all imports or symbols and filter accordingly. I’ll let you know if I find something, but you need to identify the types rather than the instances. That’s what gets purged.

1 Like
2 Likes

Thank you, @GavinCrump! I knew it was somewhere.

2 Likes

Ohhh there we go now to filter them problem 2 lol thank you Nick and Gavin

Wow finally got it! (Thank you so much) just one more question is it possible to open multiple views using the show elements. or can it only open 1 at a time.

1 Like

Or can you make the Data shapes box stay open and you can keep selecting CAD i at a time and when you are finished browsing all of them (to verify if they are valid) then you can close the dialog box

That sounds like modeless form behavior which DS doesnt support to my understanding nor Dynamo. I cant think of a way to achieve a looping behavior without modifying the DS nodes (e.g. you keep picking until you choose a proceed option, running the UI each time).

1 Like