Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations Danlap on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

StartCommand ON/OFF instead of toggling

hadzi11

Mechanical
Feb 6, 2025
1
Hi,

I'm working on a macro that uses CATIA.StartCommand, but it only toggles the command without a way to check its current state.

I need to: Set a StartCommand explicitly to ON (1) or OFF (0), instead of just toggling.

Is there a way to achieve this in Catia? Any advice would be appreciated!

Thanks!
 
Replies continue below

Recommended for you

hadzill,
what current state are you checking?

For example below, Script checks the current state of z-buffer setting.
In this case it will either be true or false.
Then it sets (toggles) it to the opposite.
But I think you could do a If/Then, Else, EndIf

If variibale is true (or false, whatever you are looking for) then run the startcommand, else do nothing.


Sub CATMain()
Set settingControllers1 = CATIA.SettingControllers
Set visualizationSettingAtt1 = settingControllers1.Item("CATVizVisualizationSettingCtrl")
visualizationSettingAtt1.AllZBufferElementMode = Not visualizationSettingAtt1.AllZBufferElementMode
visualizationSettingAtt1.SaveRepository
End Sub





something like

Sub CATMain()
Set settingControllers1 = CATIA.SettingControllers
Set visualizationSettingAtt1 = settingControllers1.Item("CATVizVisualizationSettingCtrl")

If visualizationSettingAtt1.AllZBufferElementMode = True Then
CATIA.StartCommand "Fit All In"
Else
End if

End Sub
 
Last edited:

Part and Inventory Search

Sponsor