How to activate an object 3DX macro
To activate an object in CATIA V5 with a macro, use this code. It checks to make sure only one object is selected, and if so it activates it, otherwise a message box appears telling the user to only select one object:
Dim oDocument As Document
Set oDocument = CATIA.ActiveDocument
Dim oSel As Selection
Set oSel = oDocument.Selection
If oSel.Count = 1 Then
CATIA.StartCommand “FrmActivate”
Else
Msgbox “Please select only one object then execute the program again.”
End If
Here’s how to activate an object in V6 with a macro:
Dim oEditor As Editor
Set oEditor = CATIA.ActiveEditor
Dim oSel As Selection
Set oSel = oEditor.Selection
If oSel.Count = 1 Then
CATIA.StartCommand “FrmActivate”
Else
Msgbox “Please select only one object then execute the program again.”
End If
That’s it! Want to know more 3Dexperience programming? Then tell us in the comments!