API get Custom Properties en invisible

Hello;

 

I'm in the middle of creating macros.

When the user clicks on it, the macro retrieves all the components, and at some point, it must retrieve the properties of each of these components.

The problem is that I can't do it without solid visibly opening each of the components.

 

I start by opening the component invisibly: "swApp.OpenDoc6 File, swDocPART, swOpenDocOptions_Silent, "", error, warning" that's ok.

When I get to "Set swModel = swApp.ActivateDoc2(File, True, error)" Solid shows the file. I would like to avoid if it is possible.

The best thing to do is for the original assembly to always remain open in appearance and for solid to retrieve data from the other components in the background.

Moreover, when the assemblies are large, it may take time to open all these files.

 

So that's my problem if you have an idea!

Thanks in advance

 

Hello

 

You can use the "DocumentVisible" API, look in the API help

this allows the document (modelDoc2) to be retrieved without activating it

At the beginning of the code we specify

swApp.DocumentVisible(swDocumentTypes_e.swDocPART, False)

 

.... The treatment ....

 

and at the end, put swApp.DocumentVisible(swDocumentTypes_e.swDocPART, True)

otherwise the newly opened rooms will be invisible to the user!

 

Also look at the "SolidWorks Document Manager" section of the API help, which allows you to work on documents (read properties for example, ...) without going through SolidWorks, only by specifying the location of the file.

 

I hope this will help you

 

 

 

8 Likes

You can use the "DocumentVisible" API, 

Ok I managed with that, it works!

 

Also see the "SolidWorks Document Manager" topic in the API Help

I looked, it seems really appropriate to read the properties without opening the files, but I admit I didn't understand everything. Now I work in VBA and I'm not too used to it but as soon as I get back to my .NET I get to work.

 

Thank you!