We have had users release drawings with extra sheets that have zero views. Need a macro for design checker to alert this Solidworks User as a custom check.
We have had users release drawings with extra sheets that have zero views. Need a macro for design checker to alert this Solidworks User as a custom check.
why do your drawings have so many pages?
Do you have an example print? Are the views just hidden?
something like this?
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim swDrawing As DrawingDoc
Dim swSheet As Sheet
Dim sheetNames As Variant
Dim vViews As Variant
Dim vView As Variant
Dim swView As View
Dim i As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swModel.GetType <> swDocumentTypes_e.swDocDRAWING Then
Exit Sub
End If
Set swDrawing = swModel
Set swSheet = swDrawing.GetCurrentSheet
sheetNames = swDrawing.GetSheetNames
For i = 0 To UBound(sheetNames)
Set swSheet = swDrawing.Sheet(sheetNames(i))
vViews = swSheet.GetViews
If IsEmpty(vViews) Then
swApp.SendMsgToUser2 swSheet.GetName & " has no views! Please check whether the sheet is still required!", swMessageBoxIcon_e.swMbWarning, swMessageBoxBtn_e.swMbOk
End If
Next i
End Sub
Some of our users inadvertently add a sheet and release it in that state.o Title block will show "Sheet 1 of 2" When the second sheet is just a mistake and empty.