• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Allegro X Scripting - TCL
  3. Get part occurrences reference designators and pin numbers...

Stats

  • State Verified Answer
  • Replies 6
  • Answers 1
  • Subscribers 13
  • Views 2629
  • Members are here 0
More Content

Get part occurrences reference designators and pin numbers connected to a flat net

VB202505089850
VB202505089850 4 months ago

Hello,

I want to iterate through all the flat nets in my hierarchical design in OrCAD Capture using a Tcl/Tk script. For each net, I need to print the flat net name, the reference designators of the components it is connected to, and the relevant pin numbers of these components (for example: N4958340: U1.2 R11.1 U3.1, N9487723: U1.1 U1.3).

However, I am having trouble retrieving the reference designators of the part occurrences. I can only access the reference designators of the part instances, but that is not what I need. Below is my code so far—perhaps someone can help me:

variable cstr DboTclHelper_sMakeCString
variable str DboTclHelper_sGetConstCharPtr

set dsn [GetActivePMDesign]

set lStatus [DboState]

set lNullObj NULL

# Get iterator for flat nets
set netIter [$dsn NewFlatNetsIter $lStatus]
if {$netIter == $lNullObj} {
  return
}

# Iterate over flat nets
set net [$netIter NextFlatNet $lStatus]
while {$net != $lNullObj} {

  # Get net name
  set netNameCStr [$cstr]
  if {[catch {$net GetName $netNameCStr}]} {
    set netName ""
  } else {
    set netName [$str $netNameCStr]
  }

  if {$netName != ""} {
    # Get port (pins) connected to this net
    set pinIter [$net NewPortOccurrencesIter $lStatus]
    set pinList {}

    set pin [$pinIter NextPortOccurrence $lStatus]

    while {$pin != $lNullObj} {
      set pinInst [$pin GetPortInst $lStatus]

      # Get reference designator into $refdes
      # How to get it? I need to find the part occurrence somehow, either from the port occurrence or from the flat net, but how?

      # Get pin number
      set pinNumCStr [$cstr]
      if {[catch {$pinInst GetPinNumber $pinNumCStr}]} {
        set pinNum ""
      } else {
        set pinNum [$str $pinNumCStr]
      }

      if {$refdes != "" && $pinNum != ""} {
        lappend pinList "$refdes.$pinNum"
      }
      set pin [$pinIter NextPortOccurrence $lStatus]
    }
    delete_DboFlatNetPortOccurrencesIter $pinIter

    # Store the net and its pins (sorted for consistency)
    if {[llength $pinList] > 0} {
    dict set netsdict $netName [lsort $pinList]
    }
  }
  set net [$netIter NextFlatNet $lStatus]

}

delete_DboDesignFlatNetsIter $netIter

  • Cancel
  • Sign in to reply
  • VB202505089850
    0 VB202505089850 4 months ago in reply to CadAP

    Thank you CadAP  ! It seems to be working.

    • 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