2 Replies Latest reply on Jun 18, 2014 7:32 AM by Adam Hoffman

    Simple question

    Checkcheck Master

      Hi there,


      Can I get a list of components from an assy without opening the model ?

      With  swApp.GetConfigurationCount(fileString)  and swApp.GetConfigurationNames(fileString) I can access a file without opening.


      Is it possible to assign a filename to ModelDoc2 ?


      Anyone ?



      Greetings !

        • Re: Simple question
          Matt Martens

          I am not 100% sure but I think the only way to access this is through the Document Manager API which requires a "key" that you can obtain for free through the SW website.

          • Re: Simple question
            Adam Hoffman

            Yes you can access a model without opening it. I always traverse an assembly by component children, see if that component is suppressed or not. If it's not suppressed, then you can call:


            Dim swCompModel As SldWorks.ModelDoc2 = Nothing


            swCompModel = swComp.GetModelDoc2


            From swCompModel I can then get configuration specific custom properties, or a list of all configuration names, or even save a specific configuration out as a step file. All of which does not require me to actually open the component model visually or in code. If the filename is all that you are needing, once you have swCompModel you can call GetPathName or GetTitle on that specific ModelDoc. But the only way I know of getting access to the ModelDoc without opening it is on the component level when traversing an open assembly. There is an example of how to traverse an assembly in the API help if you need to take a look at how to do that.