Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

You could also create a module and put both options as sub modules in there so you can call them from the ribbon.

 

Public Sub ShowAll3DSketches()
    Dim thisAssembly As Document
    Set thisAssembly = ThisApplication.ActiveDocument
    
    If ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject Then
        MsgBox ("This macro can only be run in assembly documents")
        Exit Sub
    End If
    
    'get the model browser pane
    Dim oModelBrowserPane As BrowserPane
    Set oModelBrowserPane = thisAssembly.BrowserPanes.item("Model")
        
    'search through all browser nodes and set visibility of sketches found
    Call SearchNodes(oModelBrowserPane.TopNode.BrowserNodes, True)
    
End Sub

Public Sub HideAll3DSketches()
    Dim thisAssembly As Document
    Set thisAssembly = ThisApplication.ActiveDocument
    
    If ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject Then
        MsgBox ("This macro can only be run in assembly documents")
        Exit Sub
    End If
    
    'get the model browser pane
    Dim oModelBrowserPane As BrowserPane
    Set oModelBrowserPane = thisAssembly.BrowserPanes.item("Model")
        
    'search through all browser nodes and set visibility of sketches found
    Call SearchNodes(oModelBrowserPane.TopNode.BrowserNodes, False)
    
End Sub

Private Sub SearchNodes(oNode As BrowserNodesEnumerator, sketchVisiblilty As Boolean)
    'set instance objects
    Dim oSubNode As BrowserNode
    Dim o3DSketch As Sketch3DProxy
    
    'quits routine when it comes to a node that is empty
    If oNode.Count = 0 Then
        Exit Sub
    End If
    
    'search through nodes
    For Each oSubNode In oNode
        'if node contains child nodes, search through those
        If oSubNode.BrowserNodes.Count > 0 Then
            Call SearchNodes(oSubNode.BrowserNodes, sketchVisiblilty)
        End If
        
        'search for 3D Sketches and set the visiblity
        If Not oSubNode.NativeObject Is Nothing Then
            If oSubNode.NativeObject.Type = kSketch3DProxyObject Then
               Set o3DSketch = oSubNode.NativeObject
               o3DSketch.Visible = sketchVisiblilty
            End If
        End If
    Next
End Sub