Home
  • Products
  • Solutions
  • Support
  • Company

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  • Products
  • Solutions
  • Support
  • Company
Community PCB Design & IC Packaging (Allegro X) Allegro X Scripting - TCL Is there a way to get all parts connected to a flat-net...

Stats

  • State Verified Answer
  • Replies 5
  • Subscribers 11
  • Views 1277
  • Members are here 0
More Content

Is there a way to get all parts connected to a flat-net?

Jadystone
Jadystone 7 months ago

I am trying to use TCL to check all capcitors voltage whether is below permitting voltage. So I first get a flatnet which net name gives me the voltage information such as VCC3.3. Then I iterate all capcitors connected to the flatnet and check the description of the capcitor to get rating voltage. I compare the net allowing voltage with the rating voltage from capcitor. If they are not matching, I print a warnig out

  • Sign in to reply
  • Cancel
  • CadAP
    0 CadAP 7 months ago

     Jadystone 

    Please find the below code:

    It will check the property value Rated Voltage and pin connected wire name if both different value, then it will report pinname. 

    set object [GetSelectedObjects]
    set lPropCString [DboTclHelper_sMakeCString "Rated Voltage"]
    set lPartRefCString [DboTclHelper_sMakeCString "Part Reference"]
    set lPropValCString [DboTclHelper_sMakeCString ]
    set lPartRefValCString [DboTclHelper_sMakeCString ]
    set lPinCString [DboTclHelper_sMakeCString ]
    set lWireCString [DboTclHelper_sMakeCString ]
    set lNetCString [DboTclHelper_sMakeCString ]
    set lState [$object GetEffectivePropStringValue $lPropCString $lPropValCString]
    set lState [$object GetEffectivePropStringValue $lPartRefCString $lPartRefValCString]
    set lVoltage "[DboTclHelper_sGetConstCharPtr $lPropValCString]"
    set lPartRef "[DboTclHelper_sGetConstCharPtr $lPartRefValCString]"
    set lNullObj NULL
    set lStatus [DboState]
    set lIter [$object NewPinsIter $lStatus]
    #get the first pin of the part
    set lPin [$lIter NextPin $lStatus]
    while {$lPin !=$lNullObj } {

    $lPin GetPinName $lPinCString
    set lPinName [DboTclHelper_sGetConstCharPtr $lPinCString]
    set lWire [$lPin GetWire $lStatus]
    set lNet [$lPin GetNet $lStatus]

    if {$lWire != $lNullObj || $lNet != $lNullObj} {
    $lWire GetNetName $lWireCString
    # $lWire GetNetName $lNetCString
    set lWireName [DboTclHelper_sGetConstCharPtr $lWireCString]
    if {$lWireName != $lVoltage } {

    puts "Comp with Refdes=$lPartRef has pin $lPinName has connected to Net $lWireName but volatge rating of comp is $lVoltage"
    }

    }

    #get the next pin of the part
    set lPin [$lIter NextPin $lStatus]
    }
    delete_DboPartInstPinsIter $lIter

    Hope it helps!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Jadystone
    0 Jadystone 7 months ago in reply to CadAP

    CadAP,

    Maybe I didn't describe it clearly.  My question is how to obtain the flatnet of a wire connected to a part's pin. 

    My idea is below.

    1. Iterating all capcitors of my design.  I determined that the device is a capacitor by PN prefix.  

    2. I get the voltage (V1) of the capcitor from its description. 

    3. I iterate all the pins of a capcitor to get the connected wire's flatnet (flatnet1) which is not net name.

    4. I compare the flatnet  (flatnet1)  with a given flatnet  (flatnet2)  which I know its voltage (V2) on .

    5. If they are equal (flatnet1=flatnet2), I will compare whether V1 < V2.

    6. If false, put out a warning message.

    My question is the 3rd step.  How  to get the flat net of a wire.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Jadystone
    0 Jadystone 7 months ago in reply to CadAP

    My tcl code work. It can only work on the top schematic which has a same netname for a net.  But It cannot work into the hierarchical block in which has a differient netname.  I don't how to get the flat net of a wire.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    +1 CadAP 6 months ago in reply to Jadystone

    Please see the below code for getting flat nets:


    set lSession $::DboSession_s_pDboSession
    DboSession -this $lSession
    set lNullObj NULL
    set lStatus [DboState]

    set pDesign [$lSession GetActiveDesign]

    set lFlatNetsIter [$pDesign NewFlatNetsIter $lStatus]
    #get the first flat net of design
    set lFlatNet [$lFlatNetsIter NextFlatNet $lStatus]
    while {$lFlatNet!=$lNullObj} {
    #placeholder: do your processing on $lFlatNet
    set lNetName [DboTclHelper_sMakeCString]
    $lFlatNet GetName $lNetName
    #get the next flat net of design

    puts [DboTclHelper_sGetConstCharPtr $lNetName]
    set lFlatNet [$lFlatNetsIter NextFlatNet $lStatus]
    }
    delete_DboDesignFlatNetsIter $lFlatNetsIter

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Jadystone
    0 Jadystone 6 months ago in reply to CadAP

    It work!

    Thank you very much.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Cadence Guidelines

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information