Quantcast
Channel: Cadence PCB Design Forum
Viewing all articles
Browse latest Browse all 5525

Set property on FlatNet, using selected Wire in TCL

$
0
0

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:

  1. Open any demo project that has a hierarchy
  2. Source in the script
  3. Select a Wire at the top level
  4. Execute the command ::nsTest::setMyProperty "Top Value"
  5. Observe that the property "MySpecialProperty" has been added, and this is reflected in both the Schematic Nets and the Flat Nets tabs
  6. Descend the hierarchy and select a wire connected to the same FlatNet.
  7. Execute the command ::nsTest::setMyProperty "Bot Value"
  8. 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.
  9. Ascend the hierarchy and find the first Wire again. Select it.
  10. Execute the command ::nsTest::setMyProperty "My New Top Value"
  11. 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]
}
}
}


Viewing all articles
Browse latest Browse all 5525

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>