32.10. Simplify CAD/PDM configuration with macros

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) .[196]

Basically it is recommended to declare encompassing used macros in ifacecommon.cfg, otherwise in the respective specific configuration file.

Under Section 2.2.1, “Syntax and concepts ” in PARTsolutions - Administration Manual you can find general information on syntax.

Some examples follow:

  • Example from $CADENAS_SETUP/ifnxteamcenter.cfg:

    Macro definition to encode the part name:

    _ENCODE_PARTNAME=Application.GetObject("iface.teamcenter").EncodePartName

    Instead of using "Application.GetObject("iface.teamcenter").EncodePartName" you can simply execute "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",

  • Excerpt from $CADENAS_SETUP/ifsapplm.cfg:

    Standard macro definition in ifacecommon.cfg:

    [Macros]
    NAMEMACRO=GetObject("iface.calcnameservice").start(0).Format
    NAMEMACRO_ROOT=GetObject("iface.calcnameservice")
    .start(GetObject("iface.metaoptionservice").GetRoot()).Format

    Without replacement by macro:

    [PLM_MAPPING]
    MATNR(is3d,isRootDoc)=?GetObject("iface.calcnameservice").start(0).Format("<ATTR(MATNR)>")
    .value()NB_DE=?GetObject("iface.calcnameservice").start(0)
    .Format("<ATTR(german,NB)>").value()
    
    [CreationOptions]
    FileName(is3dpart,isVoithTestpartExport,1,1)=?GetObject("iface.calcnameservice").start(0)
    .Format("TESTPART_<ATTR(english,NB)>_").Add(GetObject("iface.calcnameservice")
    .start(GetObject("iface.metaoptionservice")
    .GetRoot()).Format("<ATTR(MATNR)>").value()).alnum("_").add(".ipt").value()
    
    FileName(hasRootMATNR,is3dasm) =?GetObject("iface.calcnameservice")
    .start(0).Format("<ATTR(english,NB)>_").Add(GetObject("iface.calcnameservice")
    .start(GetObject("iface.metaoptionservice").GetRoot()).Format("<ATTR(MATNR)>")
    .value()).alnum("_").add(".iam").value()

    With replacement by macro:

    [PLM_MAPPING]
    MATNR(is3d,isRootDoc)=?NAMEMACRO("<ATTR(MATNR)>").value()
    NB_DE=?NAMEMACRO("<ATTR(german,NB)>").value()
    
    [CreationOptions]
    FileName(is3dpart,isVoithTestpartExport,1,1)=?NAMEMACRO("TESTPART_<ATTR(english,NB)>_")
    .Add(NAMEMACRO_ROOT("<ATTR(MATNR)>").value()).alnum("_").add(".ipt").value()
    
    FileName(hasRootMATNR,is3dasm) =?NAMEMACRO("<ATTR(english,NB)>_")
    .Add(NAMEMACRO_ROOT("<ATTR(MATNR)>").value()).alnum("_").add(".iam").value()




[196] #37695, #32893