Closing a model without creating a backupfile

Closing a model without creating a backupfile

Anonymous
Not applicable
1,069 Views
2 Replies
Message 1 of 3

Closing a model without creating a backupfile

Anonymous
Not applicable

Hi

 

I am looping throught a lot of models to extract data, dwf files pictures etc, but when I close the model, it alwayes generate a backupfile

I use OpenDoc.Close()

Is there a way to close the model, I don't need to save it, to avoid the backup file ?

 

Anders

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

ollikat
Collaborator
Collaborator
Hi.

At least Revit 2015 API has another overload: Document.Close(bool saveModified
)

Isn't it what you are exactly looking for?
Message 3 of 3

jeremytammik
Autodesk
Autodesk
Accepted solution

Dear Anders,

 

Thank you for your query.

 

I agree with ollikat.

 

To clarify a bit more:

 

I am surprised.

 

Have you looked at the documentation at all?

 

Just one single little glance?

 

I would have thought it is very easy and obvious to close the file without saving, and that such an operation should not generate a backup copy.

 

Do you close without saving?

 

One overload of the Document.Close method takes a Boolean variable saveModified:

 

Closes the document with the option to save; saveModified indicates if the current document should be saved before close operation.

 

Have you set that to false?

 

Furthermore, if you run your own external command in a model and do not modify anything with it, you should set your transaction mode to read-only:

 

TransactionMode.ReadOnly:

 

No transaction (nor group) will be created, and no transaction may be created for the lifetime of the command. The External command may use methods that only read from the model, but not methods that write anything to it. Exceptions will be thrown if the command either tries to start a transaction (or group) or attempts to write to the model.

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder