You can collect a sequence of instructions or declarations under a macro name, in order to execute these with one simple command (instead of the single commands) .
Example from $CADENAS_SETUP/ifnxteamcenter.cfg
:
Macro to encode the part name:
_ENCODE_PARTNAME=Application.GetObject("iface.teamcenter").EncodePartName
Instead of using "Application.GetObject("iface.teamcenter").EncodePartName
", you can also simply run "zb
_ENCODE_PARTNAME
".
Excerpt from $CADENAS_SETUP/ifacecommon.cfg
:
[Macros] _CALCNAME=GetObject("iface.calcnameservice") _FORMAT_DOC=GetObject("iface.calcnameservice").start("DOC").Format _FORMAT_0=GetObject("iface.calcnameservice").start(0).Format _METAOBJ=GetObject("iface.metaoptionservice").GetObj() _METAOBJ_ROOT=GetObject("iface.metaoptionservice").GetRoot() ; Macro to decrypt a password. _DECRYPT_PW=getObject("iface.passwordService").decryptPassword ; Macro to start a ChainCall _START_CHAINCALL=meta_plm.startChainCall().chainCall ; Maco to get the active iface module _ACTIVE_IF_MODULE=getObject("pdm.ManagerService").getActiveIfaceModule() ; Macro to get the active iface item (InterfaceInfoC) _ACTIVE_IFACE_ITEM=GetObject("pdm.ManagerService").GetActiveIfaceItem() ; Macro to get the current CAD name _CURRENT_CAD_NAME=GetObject("pdm.ManagerService").GetActiveIfaceItem().getCurrentCadname() ;Macro to get the TeamcenterHookService object. _TC_HOOK_SERVICE=teamcenter_public_api.getTeamcenterPublic().PDMHookservice("9.1") ;Macro to get the value of a specific Creationoption. Only works in CreationOptions ! _CREATION_OPTION(=context.getGlobalOption("CreationOptions",
It is generally advisable to declare macros that are required across the board in ifacecommon.cfg
, otherwise in the respective special configuration file.