• 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. group ref des to reduce line

Stats

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

group ref des to reduce line

Philippe LC
Philippe LC over 1 year ago

Hi

In a skill program I want to group ref des to reduce the length of the line

example :

R101,R102,R103,R104,R110,R117,R122,R123,R128,R129,R133,R134,R135,R148,R168,R169,R170,R171,R172,R183 t->  R101-R104,R110,R117,R122,R123,R128,R129,R133-R135,R148,R168-R172,R183

is there a function ? 

Any idea ?

Thanks for your answer

  • Sign in to reply
  • Cancel
  • eDave
    0 eDave over 1 year ago

    Hi Phillippe,

    Try this function. It won't handle all possible reference designators but should be a good starting point.

    defun( DE_CompactRefdesList (refdesList)
    let((prefixList, pRefdesList, n1, suffix1, tempList, sortedRefdesList, suffix2, n2, fullList)
    rexCompile("[0-9]")
    prefixList = sort(unique(mapcar(lambda((refdes), car(parseString(rexReplace(refdes, " ", 0))) || ""), refdesList)), 'alphalessp)
    foreach(prefix, prefixList
    rexCompile("[0-9]")
    pRefdesList = setof(refdes, refdesList, (car(parseString(rexReplace(refdes, " ", 0))) || "") == prefix)
    n1 = suffix1 = tempList = nil
    sortedRefdesList = sort(pRefdesList, lambda((str1, str2), minusp(alphaNumCmp(str1, str2))))
    ;rexCompile("[A-Za-z]")
    foreach(refdes, sortedRefdesList
    rexCompile("[0-9]")
    suffix2 = cadr(parseString(rexReplace(refdes, " ", 0)))
    rexCompile("[A-Za-z]")
    n2 = readstring(rexReplace(refdes, "", 0))
    if(!n1 || onep(n2 - n1) && suffix2 == suffix1 then
    tempList = cons(refdes, tempList)
    when(refdes == lastelem(sortedRefdesList)
    fullList = cons(caseq(length(tempList), (1, refdes), (2,strcat(lastelem(tempList), ",", car(tempList))), (t, strcat(lastelem(tempList), "-", car(tempList)))), fullList)
    )
    else
    fullList = cons(caseq(length(tempList), (1, car(tempList)), (2, strcat(lastelem(tempList), ",", car(tempList))), (t, strcat(lastelem(tempList), "-", car(tempList)))), fullList)
    when(refdes == lastelem(sortedRefdesList), fullList = cons(refdes, fullList))
    tempList = list(refdes)
    )
    n1 = n2
    suffix1 = suffix2
    )
    )
    buildString(reverse(fullList), ",")
    ))

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Philippe LC
    0 Philippe LC over 1 year ago in reply to eDave

    Hi

    Thanks for the answer and sorry for the long time but i was on holidays.

    to test your function i add an put  this in a file "concat.il" :

    axlCmdRegister( "Compact" `DE_CompactRefdesList)

    prerefdesList = "D100,D101,D102,D103,D104,D105,D106,D107,D108,D109,D110,D111,D15,D16,D17,D18,D19,D20,D21,D22,D23,D24,D25,D26,D27,D28,D29,D30,D31,D32,D33,D34,D39,D40,D41,D42,D43"
    refdesList = parseString( prerefdesList ",")

    and your code

    .defun( DE_CompactRefdesList (refdesList)

    .

    .

    .buildString(reverse(fullList), ",")
    ))

    and when i try i have this error.

    Skill > DE_CompactRefdesList (refdesList)

    E- *Error* eval: undefined function - refdesList

    ERROR

    Skill >

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • eDave
    0 eDave over 1 year ago in reply to Philippe LC

    Remove the space character. The command should be:

    DE_CompactRefdesList(refdesList)

    • 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