8 Replies Latest reply on Sep 15, 2018 7:03 AM by Artem Taturevych

    Get if a part is Virtual using Document Manager API

    Carmen Lopera


      Is it possible to know if a part is virtual reading the document through document manager API?

      I am using GetDocument to get the part file and then GetComponents, so I can then look isVirtual property on the component.


      The problem is for the virtual part is returning None so I can go on checking if its virtual


      swDocPart = (SwDMDocument19)mDocumenManager.GetDocument(path, nDocType, true, out nRetVal); => RETURNED NONE


                          if (nRetVal != SwDmDocumentOpenError.swDmDocumentOpenErrorNone)


                              // if it can't find the file

                              if (nRetVal == SwDmDocumentOpenError.swDmDocumentOpenErrorFileNotFound)


                                  // look if its virtual

                                  SwDMConfiguration12 config;

                                  SwDMConfigurationMgr configMgr = swDocPart.ConfigurationManager;

                                  config = (SwDMConfiguration12)configMgr.GetConfigurationByName(configMgr.GetActiveConfigurationName());

                                  object comps = config.GetComponents();

                                  Array arrComps = (Array)comps;



                                  foreach (SwDMComponent9 swComp in arrComps)


                                      bool isVirtual = swComp.IsVirtual;