Assembly document or part document? C#

Top  Previous  Next

You can try casting with the As keyword to find out what sort of document you have:

 

Inventor.AssemblyDocument AsmDoc = m_Inventor.ActiveDocument as Inventor.AssemblyDocument;

if (AsmDoc != null)

{

       MessageBox.Show("This is an assembly");

}

else 

{

       Inventor.PartDocument PartDoc = m_Inventor.ActiveDocument as Inventor.PartDocument;

       if (PartDoc != null)

       {

               MessageBox.Show("This is a part");

       }

       else 

       {

               MessageBox.Show("This is something else");

       }

}

 

 

 

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