is this possible using dynamo?
I would like to automate this up until the number of unused elements is 0
Many thanks
is this possible using dynamo?
I would like to automate this up until the number of unused elements is 0
Many thanks
There is a parable command for it, so I believe so. Gonna take some api/python work though.
Hello Jacob,
Thanks for your comment
Can you point me on any direction?
Have you seen this topic before in the forum?
I believe @jacob.small meant a Postable Command, which executed in Dynamo via Python would open up the âPurge Unusedâ window the same way as opening it up in Revit. I donât believe there is any direct way to execute the commands within the Purge Unused dialog.
If you wish to discover and purge unused elements via Dynamo you would likely have to use some deductive logic to collect all elements of all categories and compare their element types to all element types in the project (family types and system types). The package Modelical has the nodes âDelete UnusedViewTemplatesâ and âDelete Unused Filtersâ and the package SteamNodes has a node âTool.UnusedTypesâ - these nodes could also be of use.
Iâm not sure if you could quite discover all of the unused elements that the Revit Purge Unused method discovers (materials and some styles i.e. arrowheads, etc.). Iâm curious of your reason for wanting to do this in Dynamo rather than the Revit OOTB way?
Thanks Amy,
We would like to automate purge with another def that delete views, sheets, dwgs and links.
I was surprised when I could not seen people talking about this in the forum.
Purging files everytime we need to do a model exchange up until the number of unused elems is 0 take a bit of time and if we can automate it muuuuch better, dont you agree???
Can you elaborate on this? The âPurge Unusedâ command in Revit doesnât eliminate views not on sheets, etc. so do you mean View Types? Placeholder sheets? DWGs and Links that are not being used somehowâŚ?
I agree it could be faster to eliminate everything all at once, rather than having to purge multiple times, but I also do not think that it would be simple or even entirely doable to find all the unused element types that the OOTB method catches
Hi Amy what I mean is that we have a dynamo def that delete views, sheets,etcâŚ
We would like that def to include after deleting to purge the unused content
I hope this is clear
I do think the OOTB Revit method would be most effective for catching all of the unused elements but if you do wish to try and automate it then what I described above would be the direction to take:
Have a look at the logic in the internal contents of the SteamNodes node Tool.UnusedTypes that I mentioned above as an example. Again, though, I believe there will be unused element types that would be difficult to identify in Dynamo i.e. the items that appear under âOther Stylesâ in the Purge Unused dialog
Better still would be to switch to a BIM360 workflow to eliminate the need for the exchange to begin with - everyone has access to everything as needed when needed.
The SteamNodes Tool.UnusedTypes would be a great starting point for catching a lot of the stuff youâd be looking to purge out. Might be that you canât get any closer to a truly âautomatedâ effort than running a few of those in succession without getting into executing commands via journals.
My thought with the postable command (thanks @awilliams for understanding my poor spelling) was that kicking off the dialog automatically and repeatedly until the user hits an âall clearâ button or you somehow pull a report that indicates no content was removed should be enough of an automation. Personally I feel that you want some degree of âok what changedâ when doing this sort of stuff anyway, so having the user hit âokâ a few times and see the list of âchecked itemsâ isnât necessarily a bad thing.
I do remember having an autodesk plugin that would cleanup my files before sharing it with others. The purging an deleting of views/sheets was an option there. Itâs a few years back, but one would think all commands used would be in the API or there was a method of doing such.
We have an automated cleaning process that does pretty much everything but the purge. We still have to do that manually - itâs just the most reliable and practical method.
However, because itâs not dependent on anything project related you might be able to set up a Revit log file that Dynamo could run. Havenât tried it but it might work.
I think you can initialize the purge unused by utilizing the command âPostCommandâ with a âRevitCommandId.LookupPostableCommandId(PostableCommand.PurgeUnused)â as input.
Though i am unsure how you could suppress the dialog box to automatically click purge/Ok as i think this is limited to how dynamo is linked into revit and what it can/cannot access as a process so you probably cannot access/do the final step of automating the actual dialog box.
Eg
Command_ID=RevitCommandId.LookupPostableCommandId(PostableCommand.PurgeUnused)
uiapp.PostCommand(Command_ID)
I dont know if this will help, i got this after loading
Hi Rijsmus,
What package is that?
Itâs not a package, itâs what they call a dynamic link library or dll.
Go to File, there is a command import library.
I donât know if it will work.
Itâs a bit too simple i think, to just expect it will work.
It might damage your Revit file, who knows
@Marcel_Rijsmus can you show me the graph how this works? for purged unused ?
I have not tried it
btw.
its a one click operation in revit, why automate it?
Maybe this could work
@Marcel_Rijsmus
i have to purge unused until it becomes 0 purge items.
It is 4-5 time repeated process.
if you could help with some script that would be helpful .
@Brendan_Cassidy
Any Python script for Purged unused?
The same question was asked yesterday :