Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng 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

Status
Not open for further replies.

hadzi11

Mechanical
Joined
Feb 6, 2025
Messages
4
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!
 
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:
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top