I have a part numbering system that has the drawing rev built into the filename for example: 11111234A-PM.slddrw
Previously the Macro used to save this drawing would get the revision from custom properties.
This field is no longer updated and there is now a need to retrieve the revision from the filename instead.
Below is a clip of the current macro, in the "get revision" section is what was used to get the rev, I want to get the revision from the 9th digit of the file name as "rev"
any help would be greatly appreciated.
Dim longstatus As Long, longwarnings As Long
Dim swModel As SldWorks.ModelDoc2
Dim swApp As SldWorks.SldWorks
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swModel = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Dim proj As String
Dim dwg As String
Dim filename As String
Dim saveLoc As String
Dim lastTwoChar As String
Dim rev As String
Dim trueRev As String
Set swCusPropMgr = swModel.Extension.CustomPropertyManager("")
filename = swModel.GetPathName
If filename = "" Then
MsgBox "Please save the file first and try again", vbCritical
End
End If
'Get Revision
retval = swCusPropMgr.Get3("Revision", False, rev, trueRev)
If rev = "-" Then
rev = "-"
End If
SolidworksApi macros