API - Test if the open file is read-only

Hello

I wanted to know if it is possible to do a test on the open document to find out whether or not it is read-only. We have a SW license in our workshop which is read-only and we have "common"  macros with our design office except that I would like in the case of the design office licenses that the file be saved automatically but not from the workshop license. Otherwise, I will do a test with the license number SW.

Thank you in advance.

 

 

Check out this tutorial from @.PL you should find a few lines of code that may suit you.

http://www.lynkoa.com/tutos/3d/macro-solidworks-retirer-lecture-seule-pour-fichiers-de-bibliotheque

By the way, thank you for this very well done tutorial!

2 Likes

Hello

Yes as sbadenis indicates, I posted a tutorial on Lynkoa to change the read-only, the exact instruction is:

ReadOnlyState = Part.IsOpenedReadOnly()

The corresponding help page:

http://help.solidworks.com/2010/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDoc2~IsOpenedReadOnly.html

 

2 Likes

Thank you very much, I'll see if I find my happiness in your links.