macroscatia

Catia Macro " Collapse all geometrical sets "


I would like to know if there is any macro that can collapse all geometrical sets. I have a macro that can create multiple geometrical sets, but unfortunately in expanded way . that means every time should collapse manually .

thank you in advance


Solution

  • @ C R johnson's code , working good

    Sub CATMain()
        ' Check if CATIA is running
        If CATIA Is Nothing Then
            MsgBox "CATIA is not running."
            Exit Sub
        End If
    
        ' Try to collapse all
        On Error Resume Next
        CATIA.StartCommand ("Collapse All")
        If Err.Number <> 0 Then
            MsgBox "Failed to execute command: " & Err.Description
            Err.Clear
        End If
        On Error GoTo 0
    End Sub