I am a complete beginner on tcl scripts. I have searched and failed to find any info on how to parse through a complete design and add a custom property onto all of the parts in a design. The closest information I could find was in the OrCAD_Capture_TclTk_Extensions pdf. There is an example script that is on page 12:
proc addPropertyToAllPartsOnPage { pPage } {
set lNullObj NULL
set lStatus [DboState]
set pPartInstsIter [$pPage NewPartInstsIter $lStatus]
set pInst [$pPartInstsIter NextPartInst $lStatus]
# iterate over all parts
while {$pInst!=$lNullObj} {
set lPropNameCStr [DboTclHelper_sMakeCString "PartVersion"]
set lPropValueCStr [DboTclHelper_sMakeCString "1.1"]
#add the property to part
set lStatus [$pInst SetEffectivePropStringValue $lPropNameCStr $lPropValueCStr]
set pInst [$pPartInstsIter NextPartInst $lStatus]
}
delete_DboPagePartInstsIter $pPartInstsIter
$lStatus -delete
}
If I source this script in the command window and try to call it, I cannot pass any parameter to indicate the page (pPage). I have tried simpler scripts that show other examples of procedures such as:
proc square {i} {
expr {$i*$i}
}
This works as expected in the command window, but the "addPropertyToAllPartsOnPage" proc does not.
The biggest problem I have is pressure on me to write this script by tomorrow. I'm scratching my head trying to work out what to do.
Any help would be appreciated.