Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

External Application non-modifiable document

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
leslief
686 Views, 2 Replies

External Application non-modifiable document

I'm working with a DocumentChanged event in the ExternalApplication class.  I cannot figure out how to get the document that is passed to my DocumentChanged event to be modifiable.  Is it possible?  

 

My DocumentChanged event works fine when I trigger it from an IExternalCommand, so I think the main issue is the non-modifiable document passed from the External App.  Any help is appreciated!

2 REPLIES 2
Message 2 of 3
arnostlobel
in reply to: leslief

Actually, the document for which a DocumentChanged event is raised is never modifiable. Other documents (if there are other documents currently open) may be modifiable depending on their respective state, but the actual document in which the change was just made is always set to be read-only for the entire duration of the DocumentChanged event. This is completely intentional. The are several reasons, in fact. For one, if the change was a result of a completed transaction, the transaction has already been finalized and would not accept any other changes. That is the most common case of all. Or, if the event was raised as a result of undoing or redoing of transactions, the document is out of a transaction at that moment and therefore immutable. Furthermore, since creating new transactions while undoing or redoing cannot be allowed, the document must be set read-only.

 

As a general rule, the DocumentChanged was not designed for the scenarios in which a document gets modified as a result of some other changes happening in that very same document. In such scenarios, the Dynamic Updaters are the right tool to be utilized.

 

By the way, you cannot trigger the event from your External Command. Only Revit can trigger it, since the Revit Application is the event’s originator and sender. You can invoke your handler for that event, but that is not the same. When you invoke the handler explicitly, the document will have the state you are currently in, therefore it is perfectly expectable it would be modifiable if you are invoking it from an external command and you happen being in  in a transaction at that moment (either automatic or manual).

 

Thank you

 

Arnošt Löbel

Autodesk Revit R&D

Arnošt Löbel
Message 3 of 3
leslief
in reply to: arnostlobel

This is great!  Thank you, Arnošt. 

 

I hadn't yet discovered the Dynamic Updaters, but after reading your post I looked them up, and it seems to be what I need instead of the DocumentChanged event.  

 

For anyone else looking for this info, it's under IUpdater in the API, and here:

    wiki

http://wikihelp.autodesk.com/Revit/enu/2013/Help/00006-API_Developer%27s_Guide/0135-Advanced135/0152...

    webcast

http://au.autodesk.com/?nd=class&session_id=6843

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community