• 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. How to merge the multiple overlap shapes by single clic...

Stats

  • Replies 5
  • Subscribers 159
  • Views 15558
  • Members are here 0
More Content

How to merge the multiple overlap shapes by single click

krthik15
krthik15 over 6 years ago

Hi all,

I can merge the  two overlap shapes in the net by using following code. If number of overlap shapes increases, need to run the command multiple times to merge shapes.

Is there a  way to merge the multiple no of overlap shapes in the net by single click?

#Merge shape code

axlSetFindFilter(?enabled "Nets" ?onButtons "Nets")

while(axlSelect()

net_db = axlGetSelSet()

foreach(net net_db

shapes=()

foreach(branch, net ->branches

foreach(child, branch ->children

when(child ->objType == "shape"
shapes= cons(child, shapes)
);wh

);fe
);fe

l = length(shapes)

s1 = car(shapes)

s2 = cdr(shapes)

s_primary = axlShapeMerge(s1 s2 'quiet)

);while

Thanks in advance,

Karthik

  • Sign in to reply
  • Cancel
  • DavidJHutchins
    DavidJHutchins over 6 years ago

    I would try replacing the following:

    s1 = car(shapes)

    s2 = cdr(shapes)

    with the code below:

    (setq cnt 0)
    foreach(shp shapes
    when(shp->nSegs > cnt
    (setq cnt shp->nSegs)
    (s1 = shp)
    )
    )
    s2 = remq(s1 shapes)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • krthik15
    krthik15 over 6 years ago in reply to DavidJHutchins

    Hi David,

    Thanks for the code. I have already tried the same but the problem is , Assume i have 4 shapes in the net so Shape dbid is (S1_db , S2_db, S3_db ,S4_db). While running the code first two shapes are merged and created the merged shape so the DBID had changed it is not in the shapes list. So that i need to run the code multiple times to merge all the shapes. 

    Regards,

    karthik

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

    I duplicated your issue this morning, try replacing:

    s_primary = axlShapeMerge(s1 s2 'quiet)

    with the following code:

    (s_result = axlShapeMerge(s1 s2 'quiet))
    foreach(shp s2 unless(shp->nSegs (s2 = remq(shp s2))))
    while(length(s2) > 0
    when(s_result if(listp(s_result) then (s1 = car(s_result)) else (s1 = s_result)) (s_result = axlShapeMerge(s1 s2 'quiet)))
    foreach(shp s2 unless(shp->nSegs (s2 = remq(shp s2))))
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • krthik15
    krthik15 over 6 years ago in reply to DavidJHutchins

    Thanks David!!  It's working Well.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Sivaji Chowdary
    Sivaji Chowdary over 5 years ago in reply to krthik15

    Hi Karthik,

    Can you upload the complete working code and the way to execute it.

    • 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