Today, let's return for a summary and a new, deeper look at a recurring topic:
Lately, a number of questions were raised on eTransmit and 'purge unused', e.g., in the Revit API discussion forum thread on eTransmit documentation:
Question: Is there documentation for eTransmit
?
I want to write a script to purge unused in files.
Answer: All I am aware of is what you can find in the online help and in the web in general:
Here are some past suggestions for purging unused elements:
Apparently, the last post in the list above is worthwhile pointing out again; you can purge unused using Performance Adviser, as Virone Lorenzo also underlined in his comment:
WOAW this post is awesome, and it seems to work in Revit 2021 very well! Thank you for the code and thanks to Ollie for publishing it in C#. It's better than a PostableCommand.
Matt Taylor, associate and CAD developer at WSP, provided the original implementation in VB.NET. Ollie ported it to both C# and Python, saying:
This is a massively underrated post! Thanks to Matt for sharing and to Jeremy for spreading the knowledge! I had a quick go at putting this together in C#. There's also an IronPython version of more or less the same in my GitHub
CodeSamples
repository. Feel free to edit / republish!
Many thanks again to Matt and Ollie for providing this.
Dr. Kai Kasugai of Formitas AG took
the task of purging a step further and implemented it for
the Forge Design Automation for Revit API, DA4R,
based on the Dynamo PurgeUnused
node:
Question: We are trying to implement the eTransmit functionality in DA4R, the Forge Design Automation API for Revit.
Answer: This might be another good instance of learning from the Dynamo for Revit code base, as there is
a PurgeUnused
node in
Dynamo for Revit 2022.
It starts around line 110 in
the module Document.cs.
Not sure how closely that follows the ETransmit code, or if it’s a viable option, but it's worth a review all the same.
Response: Thank you very much for the quick response. That looks very relevant, as it includes a method to purge materials.
Later: some feedback on the integration of the Purge Code from the Dynamo for Revit code base:
It really worked great and much faster than our previous attempts!
We tested it in a lot of scenarios, small and large files, and it always worked as expected.
This was a really important step for us, as this automation was one of the first that we integrated for our client and around 100 ACC users can now use that in the growing number of projects that we are currently moving from on-prem to ACC.
So, thank you very much.
As we derived most of the code from the source you provided, I am glad to share the few modifications that we made to make it work for us in Design Automation.
This code, as the DynamoRevit code, tries to delete all unused elements and materials from the document. I think the main modification was to step out of the recursive loop once the purgeable element count does not change anymore.
This is a point that we are considering improving further, as the count itself might not have changed, but the purgeable element ids did change.
Here is a hopefully complete set of functions required to implement the functionality:
Hot off the press from the factory, Now Available: Autodesk Revit IFC Manual Version 2.0:
The Autodesk Revit IFC Manual provides technical guidance for teams working with openBIM workflows. IFC is the basis for exchanging data between different applications through openBIM workflows for building design, construction, procurement, maintenance, and operation, within project teams and across software applications. According to buildingSMART, IFC is a standardized, digital description of the built environment, including buildings and civil infrastructure. It is an open, international standard, meant to be vendor-neutral, or agnostic, and usable across a wide range of hardware devices, software platforms, and interfaces for many different use cases. Download version 2 of the manual, available in 9 languages...
An AI now solves small human programming puzzles: DeepMind says its new AI coding engine is as good as an average human programmer; AlphaCode is good, but not great... not yet: