I am working on a macro to:
1. Change Drafting Standard for all opened drawings in SolidWorks
2. Set all the dimensions and their tolerances to "Use document font" or "Use document size"
So far the macro is able to do the step 1, but I have no clue how to add the step 2 into the macro.
Can anybody help please?
Dim swApp As Object
Dim sDrawingCol As New Collection
Sub Main()
Set swApp = Application.SldWorks
Set swDrawModel = swApp.GetFirstDocument
' Check to see if a drawing is loaded.
If swDrawModel Is Nothing Then
MsgBox "There is no active drawing document"
Exit Sub
End If
Do While Not swDrawModel Is Nothing
If swDrawModel.GetType = swDocDRAWING Then
sDrawingCol.Add swDrawModel.GetPathName
Debug.Print swDrawModel.GetPathName
End If
Set swDrawModel = swDrawModel.GetNext
Loop
If sDrawingCol.Count > 0 Then
FileSave = True
Else
MsgBox "There is no active drawing document"
Exit Sub
End If
Set swDrawModel = swApp.GetFirstDocument
Do While Not swDrawModel Is Nothing
If swDrawModel.GetType = swDocDRAWING Then
Set swDraw = swDrawModel
'Update Drafting Standard
Set Ext = swDraw.Extension
Ext.LoadDraftingStandard ("C:\Drafting Standards\ISO-Metric.sldstd")
' set all notes on this drawing sheet to the default font
SetAnnotationsToDefaultFont swDraw
End If
Jump:
Set swDrawModel = swDrawModel.GetNext
Loop
Set sDrawingCol = Nothing
End Sub