• 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. skill to create shape based on vias

Stats

  • State Suggested Answer
  • Replies 13
  • Answers 2
  • Subscribers 18
  • Views 5382
  • Members are here 0
More Content

skill to create shape based on vias

zpofrp
zpofrp over 1 year ago

Hi 

Attached,

i want use skill to create a shape based on select via,but i can't wirte the skill.

 Play this video

  • Sign in to reply
  • Cancel
Parents
  • Hoangkhoipcb
    0 Hoangkhoipcb over 1 year ago

    Hi zpofrp!

    Please refer this code.

    HoangKhoi.

    ;#####################################################################
    axlCmdRegister("createShapeByVia" 'createShapeByVia )
    (defun createShapeByVia ()
    vi_via = setof(e axlSubclassRoute(?field 'isEtch) axlIsVisibleLayer(strcat("VIA CLASS/" e )))
    if(length(vi_via) > 1 then
    axlUIConfirm( "Visible Via must one layer")
    else
    layer = car(vi_via)
    axlClearSelSet(vi_via)
    axlSetFindFilter(?enabled '(noall VIAS NAMEFORM) ?onButtons '(noall VIAS))
    mypopup = axlUIPopupDefine(nil (list (list "Done" 'axlFinishEnterFun) (list "Cancel" 'axlCancelEnterFun)))
    axlUIPopupSet( mypopup)
    while(axlSelect(?prompt "Please select an element...")
    Input_List = axlGetSelSet()
    axlClearSelSet()
    if(length(Input_List)>1 then
    tmp = nil
    net = car(Input_List)->net
    foreach(via Input_List
    foreach(via2 setof(e Input_List e->xy != via->xy)
    sizeVia1 = getSizeVia(via, layer)
    sizeVia2 = getSizeVia(via2, layer)
    lineWidth = max(sizeVia1,sizeVia2)
    r_path = axlPathStart(list( via->xy via2->xy ) lineWidth)
    r_path_poly = car(axlPolyFromDB(r_path ?line2poly t ?endCapType 'ROUND))
    tmp = cons(r_path_poly tmp)
    )
    )
    poly_tmp = car(axlPolyOperation(car(tmp) cdr(tmp) 'OR))
    if(poly_tmp->holes != nil then
    hole_list = nil
    foreach(h poly_tmp->holes
    hole_list = cons(car(axlPolyFromHole(h)) hole_list)
    )
    poly_tmp = car(axlPolyOperation(poly_tmp hole_list 'OR))
    )
    create_shape = axlDBCreateShape(poly_tmp t strcat("ETCH/" layer) net )
    )
    )
    )
    )
    (defun getSizeVia (via, layer)
    prog((sizeVia)
    pad_box = axlDBGetPad(via strcat("VIA CLASS/" layer) "regular")->bBox
    p1 = car(pad_box)
    p2 = xCoord(car(pad_box)) : yCoord(cadr(pad_box))
    p3 = xCoord(cadr(pad_box)) : yCoord(car(pad_box))
    sizeVia = max(axlDistance(p1 p2), axlDistance(p1 p3))
    return(sizeVia)
    )
    )
    ;#####################################################################

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • danle
    0 danle over 1 year ago in reply to Hoangkhoipcb

    your script saved me so much time!

    what would you do to make if work over multiple layers? i.e that the shape will be created over the whole via path,

    if the via is 1-4 you will have a shape in L1, L2, L3 and L4

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Hoangkhoipcb
    0 Hoangkhoipcb over 1 year ago in reply to danle

    ;#####################################################################
    axlCmdRegister("createShapeByVia" 'createShapeByVia )
    (defun createShapeByVia ()
    vi_via = setof(e axlSubclassRoute(?field 'isEtch) axlIsVisibleLayer(strcat("VIA CLASS/" e )))
    if(length(vi_via) > 1 then
    axlUIConfirm( "Visible Via must one layer")
    else
    layer = car(vi_via)
    axlClearSelSet(vi_via)
    axlSetFindFilter(?enabled '(noall VIAS NAMEFORM) ?onButtons '(noall VIAS))
    mypopup = axlUIPopupDefine(nil (list (list "Done" 'axlFinishEnterFun) (list "Cancel" 'axlCancelEnterFun)))
    axlUIPopupSet( mypopup)
    while(axlSelect(?prompt "Please select an element...")
    Input_List = axlGetSelSet()
    axlClearSelSet()
    if(length(Input_List)>1 then
    tmp = nil
    net = car(Input_List)->net
    zlenVia = nil
    foreach(via Input_List
    startEndVia = via->startEnd
    zlenVia = cons(list(axlViaZLength(car(startEndVia) cadr(startEndVia)) cadr(parseString(car(startEndVia) "/")) cadr(parseString(cadr(startEndVia) "/"))) zlenVia)
    foreach(via2 setof(e Input_List e->xy != via->xy)
    sizeVia1 = getSizeVia(via, layer)
    sizeVia2 = getSizeVia(via2, layer)
    lineWidth = max(sizeVia1,sizeVia2)
    r_path = axlPathStart(list( via->xy via2->xy ) lineWidth)
    r_path_poly = car(axlPolyFromDB(r_path ?line2poly t ?endCapType 'ROUND))
    tmp = cons(r_path_poly tmp)
    )
    )
    poly_tmp = car(axlPolyOperation(car(tmp) cdr(tmp) 'OR))
    if(poly_tmp->holes != nil then
    hole_list = nil
    foreach(h poly_tmp->holes
    hole_list = cons(car(axlPolyFromHole(h)) hole_list)
    )
    poly_tmp = car(axlPolyOperation(poly_tmp hole_list 'OR))
    )
    zlenVia = sortcar(zlenVia 'lessp) ; filter long length Via
    lastViaSE = lastelem(zlenVia)
    stLayer = member(cadr(lastViaSE) axlSubclassRoute(?field 'isEtch) )
    stLayer = reverse(member(caddr(lastViaSE) reverse(stLayer)))
    foreach(item stLayer
    create_shape = axlDBCreateShape(poly_tmp t strcat("ETCH/" item) net )
    )

    )
    )
    )
    )
    (defun getSizeVia (via, layer)
    prog((sizeVia)
    pad_box = axlDBGetPad(via strcat("VIA CLASS/" layer) "regular")->bBox
    p1 = car(pad_box)
    p2 = xCoord(car(pad_box)) : yCoord(cadr(pad_box))
    p3 = xCoord(cadr(pad_box)) : yCoord(car(pad_box))
    sizeVia = max(axlDistance(p1 p2), axlDistance(p1 p3))
    return(sizeVia)
    )
    )
    ;#####################################################################

    Hi danle !

    Refer this code.

    Hoang Khoi.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • danle
    0 danle over 1 year ago in reply to Hoangkhoipcb

    thank you so much!

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • danle
    0 danle over 1 year ago in reply to Hoangkhoipcb

    thank you so much!

    • 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