• 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. Place Via Array Boundary

Stats

  • State Suggested Answer
  • Replies 4
  • Answers 1
  • Subscribers 17
  • Views 1595
  • Members are here 0
More Content

Place Via Array Boundary

karthikeyank
karthikeyank 10 months ago

Hi All,

I want to do some operations like Place->Via Array->Boundary, I have additional requirements. I don't know how to place via in ODD and ARC Segments. Can anyone plz help me out.

Program:

foreach(ClineDtlp ClineDt
foreach(ClineSegDtlp ClineDtlp->segments
ObVal = ClineSegDtlp->objType
XpointF = xCoord(car(ClineSegDtlp->startEnd))
YpointF = yCoord(car(ClineSegDtlp->startEnd))
XpointS = xCoord(cadr(ClineSegDtlp->startEnd))
YpointS = yCoord(cadr(ClineSegDtlp->startEnd))
println(ObVal)
if(ObVal == "line" then
LnVal = sprintf(nil "%s", ClineSegDtlp->lineType)
if(LnVal == "vertical" then
FirstVal = axlDBGetLength(ClineSegDtlp)
println(FirstVal)
FirstVal = round(FirstVal)
PassVal = FirstVal / 30
PassStr = sprintf(nil "%d", PassVal)
PassPrseStr = atoi(nth(0 parseString(PassStr "-")))
println(PassPrseStr)
if(YpointF > YpointS then
for(i 1 PassPrseStr
myvia = axlDBCreateVia("DUMMY_20MIL", XpointF + 50:YpointF, nil, nil, 0.0, nil)
YpointF = YpointF - 30
)
else
for(i 1 PassPrseStr
myvia = axlDBCreateVia("DUMMY_20MIL", XpointF + 50:YpointS, nil, nil, 0.0, nil)
YpointS = YpointS - 30
)
)
else
if(LnVal == "horizontal" then
;Code
else
if(LnVal == "odd" then
;Code
)
)
)
else
if(ObVal == "arc" then
;Code
)
)
)
)

Image:

  • Sign in to reply
  • Cancel
  • Hoangkhoipcb
    0 Hoangkhoipcb 9 months ago

    Hi karthikeyank!

    You can try this code. It work on version 17.2 or latest

    ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    axlCmdRegister("div_cline" 'div_cline)
    (defun div_cline ()
    axlClearSelSet()
    axlSetFindFilter(?enabled '(noall CLINES NAMEFORM) ?onButtons '(noall ALL))
    axlSingleSelectPoint()
    cline = car(axlGetSelSet())
    axlClearSelSet()
    if(cline != nil then
    pitch_via_via = axlDBGetLength(cline) * 0.1 ; 10% total of the cline length
    loop = t
    vias = setof(e axlDBGetConnect(cline t) e->objType == "via" )
    if(length(vias) == 2 then
    point = car(vias)->xy
    if(member(point car(cline->segments)->startEnd) == nil then
    point = cadr(vias)->xy
    )
    point_list = list(point)
    curr_seg = nil
    while(loop == t
    if(curr_seg == nil then
    tmp = cline->segments
    curr_seg = car(tmp)
    else
    tmp = member(curr_seg cline->segments)
    )
    tmp_point = nil
    while(length(tmp) > 0
    seg = car(tmp)
    st_seg = seg->startEnd
    if(seg->objType == "arc" then
    cir_line = axlGeoCircleCircleInt(point pitch_via_via seg->xy seg->radius)
    else
    cir_line = axlGeoCircleLineInt2(car(st_seg) cadr(st_seg) point pitch_via_via)
    )
    if(cir_line != nil then
    seg_poly = car(axlPolyFromDB(seg ?endCapType 'ROUND))
    cir_line = setof(e cir_line axlGeoPointInShape(e seg_poly nil) == t)
    cir_line = setof(e cir_line member(e point_list) == nil && e != point && setof(e2 point_list axlDistance(e e2) < seg->width * 0.5) == nil )
    if(cir_line != nil then
    if(length(cir_line) == 1 then
    tmp_point = car(cir_line)
    curr_seg = seg
    tmp = nil
    else
    if(length(cir_line) == 2 then
    dis1 = axlDistance(car(cir_line) point)
    dis2 = axlDistance(cadr(cir_line) point)
    tmp_point = car(cir_line)
    if(dis1 < dis2 then tmp_point = cadr(cir_line))
    curr_seg = seg
    tmp = nil
    )
    )
    )
    )
    tmp = cdr(tmp)
    )
    if(tmp_point != nil then
    point = tmp_point
    point_list = cons(point point_list)
    d_actual = car(cline->segments)->width
    d = axlMXYAdd( 0:d_actual point)
    r_path = axlMakeDynamicsPath(list(list(d d 0.0 point d_actual t) list(d d) ) )
    poly = car(axlPolyFromDB(r_path ?endCapType 'ROUND))
    axlDBCreateShape(poly t "ANTI ETCH/ALL" nil)
    axlVisibleLayer("ANTI ETCH/ALL" t)
    else
    loop = nil
    )
    )
    )
    )
    )

    HoangKhoi.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • karthikeyank
    0 karthikeyank 9 months ago in reply to Hoangkhoipcb

    Hi HoangKhoi,

    Thank you for your reply actually I'm using 16.6 version so any other ways to do by skill program, if yes can you update the program that would be so helpful.

    Thanks,

    Karthi

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Hoangkhoipcb
    0 Hoangkhoipcb 9 months ago in reply to karthikeyank

    Hi karthikeyank!

    it work on 16.6 version or latest.

    ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    axlCmdRegister("div_cline" 'div_cline)
    (defun div_cline ()
    axlClearSelSet()
    axlSetFindFilter(?enabled '(noall CLINES NAMEFORM) ?onButtons '(noall ALL))
    axlSingleSelectPoint()
    cline = car(axlGetSelSet())
    axlClearSelSet()
    if(cline != nil then
    pitch_via_via = axlDBGetLength(cline) * 0.1 ; 10% total of the cline length
    loop = t
    vias = setof(e axlDBGetConnect(cline t) e->objType == "via" )
    if(length(vias) == 2 then
    point = car(vias)->xy
    if(member(point car(cline->segments)->startEnd) == nil then
    point = cadr(vias)->xy
    )
    point_list = list(point)
    curr_seg = nil
    while(loop == t
    if(curr_seg == nil then
    tmp = cline->segments
    curr_seg = car(tmp)
    else
    tmp = member(curr_seg cline->segments)
    )
    tmp_point = nil
    while(length(tmp) > 0
    seg = car(tmp)
    st_seg = seg->startEnd
    if(seg->objType == "arc" then
    cir_line = PointsCirCir(point pitch_via_via seg->xy seg->radius)
    else
    cir_line = PoinstLineCircle(car(st_seg) cadr(st_seg) point pitch_via_via)
    )
    if(cir_line != nil then
    seg_poly = car(axlPolyFromDB(seg ?endCapType 'ROUND))
    cir_line = setof(e cir_line axlGeoPointInShape(e seg_poly nil) == t)
    cir_line = setof(e cir_line member(e point_list) == nil && e != point && setof(e2 point_list axlDistance(e e2) < seg->width * 0.5) == nil )
    if(cir_line != nil then
    if(length(cir_line) == 1 then
    tmp_point = car(cir_line)
    curr_seg = seg
    tmp = nil
    else
    if(length(cir_line) == 2 then
    dis1 = axlDistance(car(cir_line) point)
    dis2 = axlDistance(cadr(cir_line) point)
    tmp_point = car(cir_line)
    if(dis1 < dis2 then tmp_point = cadr(cir_line))
    curr_seg = seg
    tmp = nil
    )
    )
    )
    )
    tmp = cdr(tmp)
    )
    if(tmp_point != nil then
    point = tmp_point
    point_list = cons(point point_list)
    else
    loop = nil
    )
    )
    point_list = unique(point_list)
    foreach(point point_list
    d_actual = car(cline->segments)->width
    d = axlMXYAdd( 0:d_actual point)
    r_path = axlMakeDynamicsPath(list(list(d d 0.0 point d_actual t) list(d d) ) )
    poly = car(axlPolyFromDB(r_path ?endCapType 'ROUND))
    axlDBCreateShape(poly t "ANTI ETCH/ALL" nil)
    )
    axlVisibleLayer("ANTI ETCH/ALL" t)
    )
    axlShell("div_cline")
    )
    printf("Last Update: 07/11/2024 -Version 1.0\n")
    )
    ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    (defun PointsCirCir (point1, r1, point2, r2)
    let((point_list2)
    prog((point_list2)
    x1 = xCoord(point1)
    y1 = yCoord(point1)
    x2 = xCoord(point2)
    y2 = yCoord(point2)
    d = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
    if(d > r1 + r2 || d < abs(r1 - r2) || d == 0 then
    return(nil)
    else
    a = (r1 * r1 - r2 * r2 + d * d) / (2 * d)
    px = x1 + a * (x2 - x1) / d
    py = y1 + a * (y2 - y1) / d
    h = sqrt(r1 * r1 - a * a)
    p1 = px + h * (y2 - y1) / d : py - h * (x2 - x1) / d
    point_list2 = cons(p1 point_list2)
    if(d != r1 + r2 && d != abs(r1 - r2) then
    p2 = px - h * (y2 - y1) / d : py + h * (x2 - x1) / d
    point_list2 = cons(p2 point_list2)
    )
    )
    return(point_list2)
    )
    )
    )
    (defun PoinstLineCircle (point1, point2, center, radius)
    let((point_list2)
    prog((point_list2)
    dx = xCoord(point2) - xCoord(point1)
    dy = yCoord(point2) - yCoord(point1)
    A = dx * dx + dy * dy
    B = 2 * (dx * (xCoord(point1) - xCoord(center)) + dy * (yCoord(point1) - yCoord(center)))
    C = (xCoord(point1) - xCoord(center)) * (xCoord(point1) - xCoord(center)) + (yCoord(point1) - yCoord(center)) * (yCoord(point1) - yCoord(center)) - radius * radius
    delta = B * B - 4 * A * C
    if(delta > 0 then
    t1 = (-B + sqrt(delta)) / (2 * A)
    t2 = (-B - sqrt(delta)) / (2 * A)
    if(t1 >= 0 && t1 <= 1 then
    point_list2 = cons(xCoord(point1) + t1 * dx : yCoord(point1) + t1 * dy point_list2)
    )
    if(t2 >= 0 && t2 <= 1 then
    point_list2 = cons(xCoord(point1) + t2 * dx : yCoord(point1) + t2 * dy point_list2)
    )
    )
    return(point_list2)
    )
    )
    )
    ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    HoangKhoi.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • karthikeyank
    0 karthikeyank 9 months ago in reply to Hoangkhoipcb

    Hi HoangKhoi,

    Thanks a lot. Appreciate your support It works well.

    • 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