• 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. Create many variables with While

Stats

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

Create many variables with While

Philippe LC
Philippe LC 24 days ago

Hi

I want to create x variables with the function While

Exemple: 

i=1

delta=408

while(nequal(i 8)
axlSingleSelectPoint(sym_x+560:sym_y+delta)
objet = axlGetSelSet()
printf("%s%L" ,"variable" i) ; i create world variable1 first and i want to assign -> variable1 = objet how to declare variable1 ?
delta = delta-4
i=i+1
);end while

  • Sign in to reply
  • Cancel
  • Philippe LC
    0 Philippe LC 24 days ago

    precision : i want -> variable1 = car(objet)->text

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Andrew Beckett
    0 Andrew Beckett 24 days ago in reply to Philippe LC

    First of all, you posted in the Custom IC SKILL whereas you're using Allegro functions, so I moved it to a more appropriate forum. 

    Now, I'm a Custom IC guy, so I don't know the Allegro axl APIs, but in general creating variables dynamically like this is not the best approach - you'd be better off using an array. Also, the while loop could be a for loop. If you used an array, it would be:

    declare(varArray[8]) ; the array starts from 0 to 7
    delta=408
    for(i 1 7
      axlSingleSelectPoint(sym_x+560:sym_y+delta)
      objet = axlGetSelSet()
      varArray[i]=car(objet)->text

      delta=delta-4
    )


    If you really must create separate 7 different variables (a pseudo array), you could do this:

    delta=408
    for(i 1 7
      axlSingleSelectPoint(sym_x+560:sym_y+delta)
      objet = axlGetSelSet()
      set(concat('variable i) car(objet)->text)

      delta=delta-4
    )

    It's a better idea to create an array for array-like data though.

    Andrew

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Philippe LC
    0 Philippe LC 23 days ago

    Hi Andrew

    Thanks for the answer.

    I test the second solution in a first time. it's perfect .

    I will try with an array later 

    Philippe

    • 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