Use the customization script to build on top of an existing realization.
Customization scripts are run after the full realization is done. Any property,
materials, contacts, and so on are created in full and the element organization
options are completed.Figure 1.
Classic: TCL
# Set the list of connectors to work with
set connectorList [hm_getmark connectors 1]
foreach ceID $connectorList {
# Put the Connector into a user control mode
*createmark connector 1 $ceID
*CE_SetSpecificDetail 1 2 1 0
# Get the Realization Information
foreach group [hm_ce_getallfe $ceID 0] {set realizeArr([lindex $group 0]) [lrange $group 1 end]}
# <Insert Customer Logic>
# <USE THE DEVELOPER TOOLS TO FIND OUT WHAT APIs/STEPS ARE NEEDED>
# Update the Realization
foreach type [array names realizeArr] {
set array_length [expr (3 + [llength $realizeArr($type)])]
*createmark connectors 1 $ceID
eval *createarray $array_length $ceID 0 [llength $realizeArr($type)] $realizeArr($type)
*CE_FE_RegisterAdvanced $type 1 $array_length
}
# Turn off the user control mode
*createmark connector 1 $ceID
*CE_SetSpecificDetail 1 2 0 0
}
API Simplification: TCL
# Set the list of connectors to work with
set connectorList [hm_getmark connectors 1]
foreach ceID $connectorList {
# Put the Connector into a user control mode
*setvalue connector id=$ceID ce_usercontrolmode=1
# Get the Realization Information
set realizationList [hm_getvalue connector id=$ceID dataname=ce_realents]
# <Insert Customer Logic>
# <USE THE DEVELOPER TOOLS TO FIND OUT WHAT APIs/STEPS ARE NEEDED>
# Update the Realization
*setvalue connector id=$ceID ce_realents=$realizationList
# Turn off the user control mode
*setvalue connector id=$ceID ce_usercontrolmode=0
}
API Simplification: Python
# Set the global Model
import hm
import hw
import hm.entities as ent
model = hm.Model()
# Set the list of connectors to work with
ids_str = globals().get("connector_ids")
connectorList = [eval(x) for x in ids_str]
# Loop through the connectors
for ceID in connectorList:
ce = ent.Connector(model,ceID)
# Put the Connector into a user control mode
ce.ce_usercontrol=True
# Get the Realization Information
realizationList = ce.ce_realents
# <Insert Customer Logic>
# <USE THE DEVELOPER TOOLS TO FIND OUT WHAT APIs/STEPS ARE NEEDED>
# Update the Realization
ce.ce_realents= realizationList
# Turn off the user control mode
ce.ce_usercontrol=False