3 Replies Latest reply on Apr 11, 2017 11:44 AM by Jana Fischer

    Check if a configuration exists for a suppressed component

    Jana Fischer

      I have an IComponent2 object "comp" which is currently suppressed.

      I also have a string "conf".

       

      I want to find out if there exists a configuration for comp with name conf.

      How do I do that without unsuppressing comp and without the user noticing anything?

       

      If comp was unsuppressed, I could call comp.GetModelDoc2(), by this get the IModelDoc2 object "compDoc" and call compDoc.GetConfigurationByName(conf).

      If the result is not null/Nothing, I know that such a configuration exists.

       

      But because comp is suppressed, com.GetModelDoc2() will only return null/Nothing.

       

      I could still get the IModelDoc2 this way:

      1. Call comp.GetPathName() to get the file name "compPath" of comp.

      2. Call ISldWorks.GetOpenDocSpec(compPath) to get an IDocumentSpecification "docSpec".

      3. Call ISldWorks.OpenDoc7(docSpec) to get the desired IModelDoc2.

       

      BUT:

      This will open the model visibly to the user (as if the user had opened it with the File->Open dialog).

      Even if I set docSpec.Silent = true prior to calling OpenDoc7, the user will see the document opened.

       

      Any ideas?