By Adam Nagy
If you want to save the document with a new file name and make it appear so in the user interface as well, just like in case of Inventor Menu >> Save As >> Save As,
then you need to create a copy of the file with the new name using SaveAs(..., SaveCopyAs=True), open this file and close the original one.
This is exactly what Inventor is doing as well in the background.
Note that SaveAs(..., SaveCopyAs=False) should only be used in case of a new file which has not been saved yet, as it is pointed out in the API help file too:
"SaveCopyAs: Input Boolean that indicates whether the file to be saved is new or is a copy of a previously existing file."
Here is also a table my colleague created describing the behaviour of the save functions in the API:
API
|
Expected Usage
|
Note
|
UI
|
Save/Save2
|
If the document was saved onto disk, this is just like you click the Save button in UI, it will save the changes in memory to the file on disk. If the document is unsaved, this will pop up the Save As dialog.
|
|
Save
|
SaveAs(,False)
|
This is for unsaved/new document only, and similar to the Document.Save but provide the full filename for unsaved document so no Save As dialog will pop up.
|
Don’t call this for a saved document, because this behaves different from the UI Save As function. The UI Save As will create a copy and then close the current open file and open the copied file, but the API won’t.
|
Save
|
SaveAs(,True)
|
Just save a copy of the document no matter the document is unsaved or saved.
|
|
Save Copy As
|