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 OrCAD capture TCL script to find pin names of a compone...

Stats

  • State Suggested Answer
  • Replies 7
  • Answers 1
  • Subscribers 13
  • Views 8879
  • Members are here 0
More Content

OrCAD capture TCL script to find pin names of a component

Usman Mehmood
Usman Mehmood over 3 years ago

I want to print pin names of a component using a TCL script in OrCad capture. I used the TCL reference document provided by cadence, and this is what the code looks like. 


#? Iterate over all pins of a part instance / drawn instance
set lIter [$lInst NewPinsIter $lStatus]
set lNullObj NULL
# get the first pin of the part
set lPin [$lIter NextPin $lStatus]
while {$lPin !=$lNullObj } {


    #! placeholder: do your processing on $lPin
    set lPinName [DboTclHelper_sMakeCString]
    $lPin GetName $lPinName
    set lPinName_name [DboTclHelper_sGetConstCharPtr $lPinName]
    puts "   Pin:\t\"$lPinName_name\"\t\"$lPinName\"\t\"$lPin\""


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

So there are three variables, lPinName_name, lPinName, and lPin. None of them return anything useful, instead returning strange character sequences. Am I missing something or doing something wrong here? 
Any help regarding this would be highly appreciated. 
  • Sign in to reply
  • Cancel
Parents
  • krzysztofd
    0 krzysztofd over 3 years ago

    Assuming, that the lInst in your example holds a pointer acquired from calling the NextPartInst method
    and lStatus holds a pointer acquired from calling the DboState method
    and, if the pin names or pin numbers are all you are after, then for example:


    set result [list]
    set count [$lInst GetPinCount $lStatus]
    for {set index 0} {$index < $count} {incr index} {
        set portInst [$lInst GetPin $index $lStatus]
        set pName [DboTclHelper_sMakeCString];
        set pNumber [DboTclHelper_sMakeCString];
        $portInst GetPinName $pName;
        $portInst GetPinNumber $pNumber;
        lappend result [list [DboTclHelper_sGetConstCharPtr $pNumber] [DboTclHelper_sGetConstCharPtr $pName] ]
    }

    puts $result
    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • KVN
    0 KVN over 2 years ago in reply to krzysztofd

    How to get pin position and pin type?
    There is function "GetPinType"and "GetPinPosition"
    But how to use it to get position and type?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • krzysztofd
    0 krzysztofd over 2 years ago in reply to KVN

    # relating to the variables from the previous example:

    set pinTypeText {}

    switch [$portInst GetPinType $lStatus] $::DBO_IN {
        set pinTypeText IN
    } $::IO {
        set pinTypeText IO
    } $::DBO_OUT {
        set pinTypeText OUT
    } $::OC {
        set pinTypeText OC
    } $::PAS {
        set pinTypeText PAS
    } $::HIZ {
        set pinTypeText HIZ
    } $::OE {
        set pinTypeText OE
    } $::POWER {
        set pinTypeText POWER
    }

    puts $pinTypeText

    set ordinalPositionOfThePin [$portInst GetPinPosition $lStatus]; # it's just an integer

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • KVN
    0 KVN over 2 years ago in reply to krzysztofd

    Thanks for the quick reply.. How to get x and y location of the pins?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • krzysztofd
    0 krzysztofd over 2 years ago in reply to KVN

    # you'll need both starting point and the hotspot

    set lStartPoint [$portInst GetStartPoint $lStatus]
    set lStartPointX [DboTclHelper_sGetCPointX $lStartPoint]
    set lStartPointY [DboTclHelper_sGetCPointY $lStartPoint]


    set lHotSpot [$portInst GetHotSpot $lStatus]
    set lHotSpotX [DboTclHelper_sGetCPointX $lHotSpot]
    set lHotSpotY [DboTclHelper_sGetCPointY $lHotSpot]

    puts "The pin starts at ( $lStartPointX, $lStartPointY ) and connects at ( $lHotSpotX, $lHotSpotY )"

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • KVN
    0 KVN over 2 years ago in reply to krzysztofd

    Thanks Slight smile

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • KVN
    0 KVN over 2 years ago in reply to krzysztofd

    Thanks Slight smile

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
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