saving and closing a file without prompting user

saving and closing a file without prompting user

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

saving and closing a file without prompting user

Anonymous
Not applicable

i m using revit 2016 api and when i run the command doc.saveandclose() , it prompts me to "do you want to save changes?" , does anyone knows how can i do it without prompting the user, i have opend an adsk file using revit api and also in the active session , i m having different file as i know that revit api cant close the current doc, so i want to save and close the behind adsk file using revit api, help please?

0 Likes
1,285 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk

You could first call Document.Save to ensure it is properly saved, and the close it:

 

http://www.revitapidocs.com/2018/8dec13b6-71f4-45d2-74e3-b109153721b5.htm

 

No, much better: just call the Close method with the option to save if needed:

 

http://www.revitapidocs.com/2018/5948b03d-5537-33d4-6e38-a8f16d5d6779.htm

 

Please always check  the docs yourself before asking any questions.

 

Thank you!

 

Cheers,

 

Jeremy 

 



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

0 Likes
Message 3 of 3

Anonymous
Not applicable

but sir, the file is an imported one adsk model , so when i tried to use the save or close function, the code doesnt work and produces an error, but i can use the saveas method and saveandclose method, they work but once again they prompt user to click yes/no button and then prompt user to press the save button.
sir as much i had studied i find out thhat if a model is created in current session we can use only the saveas and saveclose method and user must have to be prompted, and that is what i want to ask,is there any possible way to do the save for the model imported in the current session without prompting the user.
(apology for grammer mistakes!)

0 Likes