• 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 PCB Editor
  3. Ask for help about the check pad/via overlap with the t...

Stats

  • Replies 5
  • Subscribers 160
  • Views 3058
  • Members are here 0
More Content

Ask for help about the check pad/via overlap with the text

jancho
jancho over 5 years ago

Hi all , now I have wrote a code to check if the pad/via overlap with the text ,but it always return"Total of text on TOP pad:0" 

Could you help to check and give some advice, thanks in advance!

Code shown as following:

<<

(defun refdes_on_pad ()

text_pad = t

layer = "TOP"

turn_on_layer(layer)

unselect_object()

axlSetFindFilter(?enabled '(noall pins vias) ?onButtons '(noall pins vias))

allpads = axlGetSelSet(axlAddSelectAll())

if(text_pad then

cnt = 0

foreach(pads allpads overlap())

axlMsgPut("Total of text on %s pad : %d" layer cnt)
)

)

(defun getpadarea ()
(prog ()

l0 = car(nth(0 pads->bBox))
t0 = cadr(nth(1 pads->bBox))
r0 = car(nth(1 pads->bBox))
b0 = cadr(nth(0 pads->bBox))

x0 = (r0+l0)/2
y0 = (t0+b0)/2

padsold=axlDBGetPad(pads , "PIN/SOLDERMASK_TOP" , "REGULAR")->bBox

padetch=axlDBGetPad(pads , "ETCH/TOP" , "REGULAR")->bBox

ls = car(nth(0 padsold))
ts = cadr(nth(1 padsold))
rs = car(nth(1 padsold))
bs = cadr(nth(0 padsold))

le = car(nth(0 padetch))
te = cadr(nth(1 padetch))
re = car(nth(1 padetch))
be = cadr(nth(0 padetch))

xs = (rs-ls)/2
ys = (ts-bs)/2

xe = (re-le)/2
ye = (te-be)/2

if(xe>xs then

xfinal=xe
yfinal=ye

else
xfinal=xs
yfinal=ys)

l2 = x0-xfinal
t2 = y0+yfinal
r2 = x0+xfinal
b2 = y0-yfinal)

return(list(l2:t2 r2:b2)))

(defun overlap ()

(prog ()

axlSetFindFilter(?enabled '(noall text) ?onButtons '(noall text))

if(axlSingleSelectBox(getpadarea())!= nil then

allbox = axlGetSelSet()

foreach(item allbox

if(item->objType == "text" then

if(item->layer ==strcat("REF DES/SILKSCREEN_" layer)|| item->layer == strcat( "PACKAGE GEOMETRY/SILKSCREEN_" layer) then

axlHighlightObject(list(item))

)
else nil
)
)
)
))

(defun unselect_object ()
(let (allsel)
axlSetFindFilter(?enabled '(noall shapes pins vias text) ?onButtons '(noall shapes pins vias text))

; axlSetFindFilter(?enabled '(all) ?onButtons '(all))

allsel = axlGetSelSet(axlAddSelectAll())

axlClearSelSet()

axlSetFindFilter(?enabled '(noall symbols) ?onButtons '(noall symbols))

allsel = axlGetSelSet(axlAddSelectAll())

axlClearSelSet()

))
(defun turn_on_layer ( layer)
axlVisibleDesign(nil)

Going_On=axlGetParam("paramLayerGroup:BOARD GEOMETRY/paramLayer:OUTLINE")

Going_On->visible=t

axlSetParam(Going_On)


Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:VIA CLASS/paramLayer:%s" layer))

if(layer == "BOTTOM" then
Going_On->visible=t

else
Going_On->visible=nil
)
axlSetParam(Going_On)

Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:PIN/paramLayer:%s" layer))

Going_On->visible=t

axlSetParam(Going_On)

Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:SILKSCREEN_%s" layer))

Going_On->visible=t

axlSetParam(Going_On)
Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:REF DES/paramLayer:SILKSCREEN_%s" layer))

Going_On->visible=t

axlSetParam(Going_On)


Going_On=axlGetParam(sprintf(dummy "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:PLACE_BOUND_%s" layer))

Going_On->visible =t
axlSetParam(Going_On)


axlUIWRedraw(nil)
axlClearSelSet()

)

>>

  • Sign in to reply
  • Cancel
Parents
  • jancho
    jancho over 5 years ago

    My idea is as following:

    first get the bBox of pin/via ,then judge if the regular pad or solder is bigger , then judge if  the bigger bBox area exist a text , if have text , then highlight the text.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • eDave
    eDave over 5 years ago in reply to jancho

    Whatever else this code is doing, cnt isn't being incremented.

    Add cnt++ before or after axlHighlightObject

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • eDave
    eDave over 5 years ago in reply to jancho

    Whatever else this code is doing, cnt isn't being incremented.

    Add cnt++ before or after axlHighlightObject

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • jancho
    jancho over 5 years ago in reply to eDave

    Thank you eDave! This is my mistake.

    There seems also have other wrong place.When code run finished , return "Total of text on TOP pad:0" , and all pin/via highlighted.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • DavidJHutchins
    DavidJHutchins over 5 years ago in reply to jancho

    I ran your code thru the checking utility sklint & corrected the issues it found, corrected a couple of logic issues and added a couple of debug printing statements, please try using the updated code shown below:

    procedure(refdes_on_pad()
    let((text_pad layer cnt tmp allpads)
    (text_pad = t)
    (layer = "TOP")
    turn_on_layer(layer)
    unselect_object()
    (axlSetFindFilter ?enabled '(noall pins vias) ?onButtons '(noall pins vias))
    (allpads = (axlGetSelSet (axlAddSelectAll)))
    axlMsgPut(";; total pin cnt %d" length(allpads))
    if(text_pad then
    (cnt = 0)
    foreach(pad allpads
    (tmp = text_overlap(pad layer))
    (cnt = (cnt + tmp))
    )
    (axlMsgPut "Total of text on %s pad : %d" layer cnt)
    )
    )
    )
    procedure(getpadarea(pads)
    prog((l0 t0 r0 b0 x0 y0 padsold padetch ls ts rs bs le te re be xs ys xe ye xfinal yfinal l2 t2 r2 b2)
    (l0 = car(nth(0 (pads->bBox))))
    (t0 = cadr(nth(1 (pads->bBox))))
    (r0 = car(nth(1 (pads->bBox))))
    (b0 = cadr(nth(0 (pads->bBox))))
    (x0 = ((r0 + l0) / 2))
    (y0 = ((t0 + b0) / 2))
    (padsold = ((axlDBGetPad pads "PIN/SOLDERMASK_TOP" "REGULAR")->bBox))
    (padetch = ((axlDBGetPad pads "ETCH/TOP" "REGULAR")->bBox))
    (ls = car(nth(0 padsold)))
    (ts = cadr(nth(1 padsold)))
    (rs = car(nth(1 padsold)))
    (bs = cadr(nth(0 padsold)))
    (le = car(nth(0 padetch)))
    (te = cadr(nth(1 padetch)))
    (re = car(nth(1 padetch)))
    (be = cadr(nth(0 padetch)))
    (xs = ((rs - ls) / 2))
    (ys = ((ts - bs) / 2))
    (xe = ((re - le) / 2))
    (ye = ((te - be) / 2))
    if((xe > xs) then
    (xfinal = xe)
    (yfinal = ye)
    else
    (xfinal = xs)
    (yfinal = ys)
    )
    (l2 = (x0 - xfinal))
    (t2 = (y0 + yfinal))
    (r2 = (x0 + xfinal))
    (b2 = (y0 - yfinal))
    return(list((l2:t2) (r2:b2)))
    )
    )
    procedure(text_overlap(pad layer)
    prog((allbox cnt)
    (cnt = 0)
    (axlSetFindFilter ?enabled '(noall text) ?onButtons '(noall text))
    when((axlSingleSelectBox getpadarea(pad))
    axlMsgPut(";; %d text found near pad @ (%f %f)" length(axlGetSelSet()) xCoord(pad->xy) yCoord(pad->xy))
    (allbox = (axlGetSelSet))
    foreach(item allbox
    if(((item->objType) == "text") then
    when((((item->layer) == strcat("REF DES/SILKSCREEN_" layer)) || ((item->layer) == strcat("PACKAGE GEOMETRY/SILKSCREEN_" layer)))
    (axlHighlightObject list(item))
    (cnt++)
    )
    )
    )
    )
    return(cnt)
    )
    )
    procedure(unselect_object()
    let((allsel)
    (axlSetFindFilter ?enabled '(noall shapes pins vias text) ?onButtons '(noall shapes pins vias text))
    (allsel = (axlGetSelSet (axlAddSelectAll)))
    (axlClearSelSet)
    (axlSetFindFilter ?enabled '(noall symbols) ?onButtons '(noall symbols))
    (allsel = (axlGetSelSet (axlAddSelectAll)))
    (axlClearSelSet)
    )
    )
    procedure(turn_on_layer(layer)
    let((Going_On)
    (axlVisibleDesign nil)
    (Going_On = (axlGetParam "paramLayerGroup:BOARD GEOMETRY/paramLayer:OUTLINE"))
    (Going_On->visible = t)
    (axlSetParam Going_On)
    (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:VIA CLASS/paramLayer:%s" layer)))
    if((layer == "BOTTOM") then
    (Going_On->visible = t)
    else
    (Going_On->visible = nil)
    )
    (axlSetParam Going_On)
    (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:PIN/paramLayer:%s" layer)))
    (Going_On->visible = t)
    (axlSetParam Going_On)
    (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:SILKSCREEN_%s" layer)))
    (Going_On->visible = t)
    (axlSetParam Going_On)
    (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:REF DES/paramLayer:SILKSCREEN_%s" layer)))
    (Going_On->visible = t)
    (axlSetParam Going_On)
    (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:PLACE_BOUND_%s" layer)))
    (Going_On->visible = t)
    (axlSetParam Going_On)
    (axlUIWRedraw nil)
    (axlClearSelSet)
    )
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • jancho
    jancho over 5 years ago in reply to DavidJHutchins

    Thanks David! Thanks for your kindly help! Now it worked, amazing!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • 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