Hello everyone.
I found this macro on the forum and it's "almost" exactly what i need. The problem is I have 2 layers.
What I can't figure out is adding the code to turn off a layer.....for example
I have text on layer A and layer B. I want a macro that will display layer A and turn off Layer B. Then, if your run it again, it will display layer B and turn off layer A
Thanks....Rob
Dim swApp As Object
'------------------------------------
' Preconditions:
' (1) Drawing document is open.
' (2) Drawing document contains a layer named PROTO.
'
' Postconditions:
' If PROTO layer is visible, then it becomes not visible.
' - or -
' If PROTO layer is not visible, then it becomes visible.
'
'------------------------------------------------------------------
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swLayerMgr As SldWorks.LayerMgr
Dim swLayer As SldWorks.Layer
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swLayerMgr = swModel.GetLayerManager
Set swLayer = swLayerMgr.GetLayer("PROTO")
If swLayer.Visible = False Then
' Toggle layer on
swLayer.Visible = True
Debug.Assert True = swLayer.Visible
Else
' Toggle layer off
swLayer.Visible = False
Debug.Assert False = swLayer.Visible
End If
End Sub