How to Call Revit Purge Button from the API

How to Call Revit Purge Button from the API

Anonymous
Not applicable
1,004 Views
3 Replies
Message 1 of 4

How to Call Revit Purge Button from the API

Anonymous
Not applicable

Hello there, 

I'm developing a plugin to detached a document from central and when its done it will be purged as well. I'm struggling writing the code for purge, I'm thinking to call the Revit Purge button from the code. If it is possible, would appreciate the support or maybe share the code for writing the purge command in the API.

Thank you

0 Likes
Accepted solutions (1)
1,005 Views
3 Replies
Replies (3)
Message 2 of 4

aignatovich
Advisor
Advisor
Accepted solution

Hi!

 

I didn't try it, but there is a PostableCommand.PurgeUnused. I think something like this should work:

var commandId = RevitCommandId.LookupPostableCommandId(PostableCommand.PurgeUnused);

uiApp.PostCommand(commandId);
Message 3 of 4

Anonymous
Not applicable

Hi @aignatovich Thanks for sharing the code. it worked

0 Likes
Message 4 of 4

matthew_taylor
Advisor
Advisor

Also worth doing a search! 😉

Check out this one for a non-postcommand solution: https://forums.autodesk.com/t5/revit-api-forum/purge-unused-via-the-api/m-p/6431564


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes