• 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. How to get pin position and location?

Stats

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

How to get pin position and location?

Morgan
Morgan 3 months ago

Hi friends of the community,

After select one Symbol on Page with Capture CIS, How to get all pin position(Top, Bottom, Left, Right), and pin location (X,Y) to place wire, use TCL?

  • Sign in to reply
  • Cancel
Parents
  • CadAP
    0 CadAP 3 months ago

    Hi Morgan,

    Below api will help you to get X and Y position of hotspot where we connect wire.

    Once you have hotspot of pin use that coordinate to draw wire using first point (x,y ) of pin hotspot.

    DboPortInst_sGetHotSpotX(obj, status) : returns int
    Parameters:
    obj: DboBaseObject *
    status: DboState &
    DboPortInst_sGetHotSpotY(obj, status) : returns int
    Parameters:
    obj: DboBaseObject *
    status: DboState &

    Hope it helps.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Morgan
    0 Morgan 3 months ago in reply to CadAP

    Thank you, CadAP, Now the question becomes:

    1. What value should be give to variable obj?

    2. How to get pin position on the Symbol, such as Top, Bottom, Left or Right?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Morgan
    0 Morgan 3 months ago in reply to CadAP

    Hi CadAP,

    1.When I use code: $portInst GetId $lStatus, get the pin ID, and pass it to DboPortInst_sGetHotSpotX, it error;

    2.Get pin position to place wire, if the pin is on Top, the wire will go to top from pin hotspot; if the pin is on right, the wire will go to right from pin hotspot, so must know the pin position on the Symbol.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 3 months ago in reply to Morgan

    Hi Morgan,

    1.When I use code: $portInst GetId $lStatus, get the pin ID, and pass it to DboPortInst_sGetHotSpotX, it error;

    Ans: DboPortInst_sGetHotSpotX $portInst $lStatus -- correct command.

    2.Get pin position to place wire, if the pin is on Top, the wire will go to top from pin hotspot; if the pin is on right, the wire will go to right from pin hotspot, so must know the pin position on the Symbol.

    Ans: Need to create a script to get pin position. I'll create a sample and share it with you.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • KD202502275710
    0 KD202502275710 3 months ago in reply to CadAP

    I didnt get this one. Could you please elaborate. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • CadAP
    0 CadAP 3 months ago in reply to KD202502275710

    KD202502275710 

    whish part you didn't understand?

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

    Morgan 

    Please find below code for getting pin position(Left, Right, Top, Bottom):

    proc lGetPinPos {lPin} {
    set lStatus [DboState]
    set lPinName [DboTclHelper_sMakeCString]
    $lPin GetPinName $lPinName
    set PinName [DboTclHelper_sGetConstCharPtr $lPinName]
    # set lSelObj [GetSelectedObjects]
    # set lSelloc []
    set lPinHOtSpotCP [$lPin GetHotSpot $lStatus]

    set lPinHOtSpotCPx [DboTclHelper_sGetCPointX $lPinHOtSpotCP]
    set lPinHOtSpotCPy [DboTclHelper_sGetCPointY $lPinHOtSpotCP]

    #get the location point
    set lStartCP [$lPin GetStartPoint $lStatus]

    set lStartCPx [DboTclHelper_sGetCPointX $lStartCP]
    set lStartCPy [DboTclHelper_sGetCPointY $lStartCP]

    if {[expr {$lStartCPx - $lPinHOtSpotCPx}] > 0} {

    puts "Pin $PinName is Left Pointed"

    } elseif {[expr {$lStartCPx - $lPinHOtSpotCPx}] < 0} {

    puts "Pin $PinName is Right Pointed"

    } elseif {[expr {$lStartCPy - $lPinHOtSpotCPy}] > 0} {

    puts "Pin $PinName is Top Pointed"

    } elseif {[expr {$lStartCPy - $lPinHOtSpotCPy}] < 0} {

    puts "Pin $PinName is Bottom Pointed"

    }

    }

    set lStatus [DboState]
    set lSelObj [GetSelectedObjects]

    set lIter [$lSelObj 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
    lGetPinPos $lPin
    #get the next pin of the part
    set lPin [$lIter NextPin $lStatus]
    }
    delete_DboPartInstPinsIter $lIter

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
Reply
  • CadAP
    0 CadAP 3 months ago in reply to CadAP

    Morgan 

    Please find below code for getting pin position(Left, Right, Top, Bottom):

    proc lGetPinPos {lPin} {
    set lStatus [DboState]
    set lPinName [DboTclHelper_sMakeCString]
    $lPin GetPinName $lPinName
    set PinName [DboTclHelper_sGetConstCharPtr $lPinName]
    # set lSelObj [GetSelectedObjects]
    # set lSelloc []
    set lPinHOtSpotCP [$lPin GetHotSpot $lStatus]

    set lPinHOtSpotCPx [DboTclHelper_sGetCPointX $lPinHOtSpotCP]
    set lPinHOtSpotCPy [DboTclHelper_sGetCPointY $lPinHOtSpotCP]

    #get the location point
    set lStartCP [$lPin GetStartPoint $lStatus]

    set lStartCPx [DboTclHelper_sGetCPointX $lStartCP]
    set lStartCPy [DboTclHelper_sGetCPointY $lStartCP]

    if {[expr {$lStartCPx - $lPinHOtSpotCPx}] > 0} {

    puts "Pin $PinName is Left Pointed"

    } elseif {[expr {$lStartCPx - $lPinHOtSpotCPx}] < 0} {

    puts "Pin $PinName is Right Pointed"

    } elseif {[expr {$lStartCPy - $lPinHOtSpotCPy}] > 0} {

    puts "Pin $PinName is Top Pointed"

    } elseif {[expr {$lStartCPy - $lPinHOtSpotCPy}] < 0} {

    puts "Pin $PinName is Bottom Pointed"

    }

    }

    set lStatus [DboState]
    set lSelObj [GetSelectedObjects]

    set lIter [$lSelObj 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
    lGetPinPos $lPin
    #get the next pin of the part
    set lPin [$lIter NextPin $lStatus]
    }
    delete_DboPartInstPinsIter $lIter

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