Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've created a Revit add-in that uses the EtransmitForRevitDB DLL to purge unused elements (based on Emiliano Capasso's approach: Why Revit Purge Command & Act of Love via API). The purge functionality works fine for project documents, but I'm encountering an issue when trying to purge family documents.
Is the EtransmitForRevitDB purge functionality compatible with family documents?
Has anyone successfully used this approach for purging family documents?
See below for my structure:
Code Structure: I have a DocumentUtilities class that handles the purging:
csharp
public bool Purge() { eTransmitUpgradeOMatic eTransmitUpgradeOMatic = new eTransmitUpgradeOMatic(_uiApplication.Application); UpgradeFailureType result = eTransmitUpgradeOMatic.purgeUnused(_document); if (result == UpgradeFailureType.UpgradeSucceeded) return true; else return false; }
And I'm calling this method in my family batch processor:
csharp
private static void PurgeFamily(Document familyDoc, string familyPath) { // Purge unused elements DocumentUtilities docUtil = new DocumentUtilities(familyDoc); docUtil.Purge(); }
Error: When trying to purge a family document, I get the following error:
"Invalid call to Revit API! Revit is currently not within an API context"
Solved! Go to Solution.