Close function for Parts and Assemblies

Top  Previous  Next

When you have created a Part or Assembly you may want to close it with or without saving it. You will Close the assembly or part document, for example:

 

pAssemblyDoc->Close(VARIANT_TRUE) ;

 

The boolean (and remember to use VARIANT_TRUE or VARIANT_FALSE) tells Inventor whether the part should be saved before closing. For example:

 

pPartDoc->Close(VARIANT_TRUE) ; // "SkipSave" , no saving , just close the document

 

pPartDoc->Close(VARIANT_FALSE) ; // Don't "SkipSave", save, and maybe prompt

                                  // the user before closing the document

 

Also note that you can avoid any file saving dialogs by using the "silent" operation. For example:

 

pInvApp->SilentOperation = VARIANT_TRUE ; // don't show any dialogs, save with default names

 

// Not you can only do this if the file has not already been saved

pAssemblyDoc->put_FullFileName (CComBSTR(m_csAssemblyFullFileName)) ; // set the name

 

pAssemblyDoc->Save () ;   //  do the actual save

 

pAssemblyDoc->Close(VARIANT_TRUE) ; // close without saving (again)

 

Remember to switch off SilentOperation at the end of your functions.

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)