Solidworks API read-only attribute
Solidworks API read-only attribute
(OP)
I am new to API programming and I was wondering if anyone can point me in the right direction. I need to write a small program that enables a solidworks user to set the 'read-only' attribute from within solidworks. At present we set this attribute in windows explorer under properties. I would like this to be an icon within a toolbar that pops up a small window with a check option for read-only.
Any help would be appreciated.
Steve
Any help would be appreciated.
Steve






RE: Solidworks API read-only attribute
' code by Tick
'http://www.EsoxRepublic.com
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Dim retval As Variant
Dim ReadOnlyState As Boolean 'TRUE= only, FALSE = not
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
ReadOnlyState = Part.IsOpenedReadOnly()
If ReadOnlyState = False Then ReadOnlyState = True Else ReadOnlyState = False
boolstatus = Part.SetReadOnlyState(ReadOnlyState)
End Sub
http://www.EsoxRepublic.com
RE: Solidworks API read-only attribute
Steve
RE: Solidworks API read-only attribute
I ran the code and the program works well, however it only temporarily sets the drawing to read-only whilst the file is open. What I was hoping for was to permanently set the attribute to 'read-only' in the properties window in Windows Explorer. Ideally I'm attempting to code a button that once clicked will first save the file and then change the read-only attribute.
Thanks again for your help
RE: Solidworks API read-only attribute
You'll have to dig into Windows API for what you want, I think. Declare Function etc. etc.
http://www.EsoxRepublic.com