I am writing a TCL script for Capture, and part of the functionality, is that I must be able to set a property on the FlatNet of a Wire selected by the user. I thought that simply setting the property on the Net of the Wire, would be sufficient, but apparently that is not the case. While I am able to set the property, and have it reflected in the FlatNet, there is a twist. Follow these steps:
- Open any demo project that has a hierarchy
- Source in the script
- Select a Wire at the top level
- Execute the command ::nsTest::setMyProperty "Top Value"
- Observe that the property "MySpecialProperty" has been added, and this is reflected in both the Schematic Nets and the Flat Nets tabs
- Descend the hierarchy and select a wire connected to the same FlatNet.
- Execute the command ::nsTest::setMyProperty "Bot Value"
- Observe that the property "MySpecialProperty" has been changed in the Schematic Nets tab, but the original value ("Top Value") is still present in the Flat Nets tabs.
- Ascend the hierarchy and find the first Wire again. Select it.
- Execute the command ::nsTest::setMyProperty "My New Top Value"
- Observe that the property "MySpecialProperty" has changed, and this is reflected in both the Schematic Nets and the Flat Nets tabs this time
It seems to me that I am not operating on the correct DboObject, in my code. What DboObject should I operate on in order to always get the property reflected in the Flat Net? How do I get to this DboObject from a selected Wire (Wire, Wire_Scalar, Wire_Bus or Wire_Bundle)?
The example script:
# source {C:/Temp/setMyWireProperty.tcl}
# ::nsTest::setMyProperty "Your value goes here"namespace eval ::nsTest {
}proc ::nsTest::setMyProperty { pValue } {
set lSelObjs1 [GetSelectedObjects]
set lStatus [DboState]
set lPrpName [DboTclHelper_sMakeCString "MySpecialProperty"]
set lPropValueCStr [DboTclHelper_sMakeCString $pValue]
set gWireTypes [list $::DboBaseObject_WIRE $::DboBaseObject_WIRE_SCALAR $::DboBaseObject_WIRE_BUS $::DboBaseObject_WIRE_BUNDLE]
for {set i 0} {$i<[llength $lSelObjs1]} {incr i} {
set lObj [lindex $lSelObjs1 $i]
set lObjType [DboBaseObject_GetObjectType $lObj]
# Make sure we're dealing with a Wire
if { [lsearch -exact $gWireTypes $lObjType] >= 0 } {
set lNet [$lObj GetNet $lStatus]
set lStatus [$lNet SetEffectivePropStringValue $lPrpName $lPropValueCStr]
}
}
}