• 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 - Skill
  3. How do we calculate length & width of an arc custom shape...

Stats

  • Replies 2
  • Subscribers 17
  • Views 2397
  • Members are here 0
More Content

How do we calculate length & width of an arc custom shape, or get the mid point of an arc.

JerryWilson
JerryWilson over 6 years ago

Hi Dave, all

I have an issue on getting custom shapes size from a padstack. Some shapes which has arcs gives a rounded value if we use a bounding box. Example if the shape Bbox is(-0.362 -0.572)(0.362 0.572) , if we measure length & width in custom shape it sometimes can be 0.5715 instead of 0.572(rounded). I have raised to cadence & they have provided me with a code which i worked on. Attach is the code. When i asked cadence how do i get the length & width, the advice that  the min x can be subtracted from the max to obtain the width.The same can be done for the height using the y values. Below is the modified code that i manage to do.I still see issues when ever i see a half moon shape with arcs. If i can get the mid point of every arcs then i might solve this issue, unless you can suggest a better way. Please help & advice. Attach also snap shots of the results & shapes that i see which does not gives correct results.

Thanks

Jerry

From Cadence

defun( _TEST_getTopPadData (pin_dbid)
prog( ( pad_id xy cw acp wdth)
pad_id = axlDBGetPad( pid "PIN/TOP" "REGULAR")
axlMsgPut("Pad shape name: %s" pad_id->name)
axlMsgPut("Bounding Box: %L" pad_id->bBox)
fig_id= car(pad_id->figure)
pth_seg_list = axlPathGetPathSegs(fig_id)
seg_number = 1
foreach(seg pth_seg_list
xy = seg->_endPoint
if( seg->_arcClockwise then
cw = "Clockwise"
else
cw ="Counter_clockwise"
)
if( seg->_arcCenter then
acp=seg->_arcCenter
else
acp=list("Line")
)
wdth = seg->_width
if( acp=seg->_arcCenter then
axlMsgPut( "Seg No: %d Arc EndPoint: %L Arc Dir: %s Arc Center: %L Width:%f"
seg_number
xy
cw
acp
wdth
)
else
axlMsgPut( "Seg No: %d Line EndPoint: %L Width: %f" seg_number xy wdth)
)
seg_number++
)

return(nil)
))

Modified

defun( _TEST ()

axlVisibleDesign(nil)
axlVisibleLayer("PIN/TOP" t)
axlSetFindFilter(?enabled list("noall" "pins" "text") ?onButtons list("noall" "pins" "text"))
axlSetFindFilter(?enabled '(noall pins text) ?onButtons '(pins text))
np=axlAddSelectAll()
pin_dbid=car(axlGetSelSet(np))

list_x=nil
list_y=nil
list_1=nil

prog( ( pad_id xy cw acp wdth acp2 rad )
pad_id = axlDBGetPad( pin_dbid "PIN/TOP" "REGULAR")
axlMsgPut("Pad shape name: %s" pad_id->name)
axlMsgPut("Bounding Box: %L" pad_id->bBox)
fig_id= car(pad_id->figure)
pth_seg_list = axlPathGetPathSegs(fig_id)
seg_number = 0
foreach(seg pth_seg_list
xy = seg->_endPoint
if( seg->_arcClockwise then
cw = "Clockwise"
else
cw ="Counter_clockwise"
)
if( seg->_arcCenter then
acp=seg->_arcCenter
acp2=seg->startEnd
rad=seg->radius
else
acp=list("Line")
)
wdth = seg->_width
mid=axlMidPointArc(acp2 acp rad width t)
if( acp=seg->_arcCenter then
axlMsgPut( "Seg No: %d Arc EndPoint: %L Arc Dir: %s Arc Center: %L Width:%f"
seg_number
xy
cw
acp
wdth
)


else
axlMsgPut( "Seg No: %d Line EndPoint: %L Width: %f" seg_number xy wdth)
)
seg_number++
p_o=list(xy)
xpo=caar(p_o)
ypo=cadar(p_o)
list_x=cons(xpo list_x)
list_y=cons(ypo list_y)



;axlMsgPut("list_sx: %L" listx)
;axlMsgPut("list_sy: %L" listy)
;axlMsgPut("list_minx: %L" xmin)
;axlMsgPut("list_maxx: %L" xmax)



)

;listpts=reverse(list_x)
listx=sort(list_x 'lessp)
listy=sort(list_y 'lessp)

lx=length(listx)
ly=length(listy)

xmi=nthelem(1 listx)
xmx=nthelem(lx listx)

ymi=nthelem(1 listy)
ymx=nthelem(ly listy)


x_wid=abs(xmx-xmi)

y_hgt=abs(ymx-ymi)


axlMsgPut("list_x: %L" listx)
axlMsgPut("list_y: %L" listy)

axlMsgPut("x: %.3f" x_wid)
axlMsgPut("y: %.3f" y_hgt)



return(nil)
)
)

2350.custom_shape_error.docx

  • Cancel
  • Sign in to reply
Parents
  • eDave
    eDave over 6 years ago

    I'm a little bit confused about what is going on here.

    I see you have a y offset on the second shape - this probably isn't correct.

    Anyway, to measure the pad I might use a polygon method.

    poly = car(axlPolyFromDB(pin, ?layer "ETCH/TOP", ?padType 'REGULAR))

    poly ->bBox will give you the extents.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • JerryWilson
    JerryWilson over 6 years ago in reply to eDave

    Hi Dave

    Thanks for the command. I tested it looks like its working. I will work on this function.

    Thanks

    Jerry

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • JerryWilson
    JerryWilson over 6 years ago in reply to eDave

    Hi Dave

    Thanks for the command. I tested it looks like its working. I will work on this function.

    Thanks

    Jerry

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