• 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. PB in foreach

Stats

  • Replies 4
  • Subscribers 159
  • Views 12960
  • Members are here 0
More Content

PB in foreach

Yann00
Yann00 over 12 years ago

Hi guys,

I wanna do a foreach to read all my film names and I wanna print something if we are in the case "C02" or "SMB".

I tried that:

my_films_members = axlGetParam("artwork")->groupMembers

foreach(film my_films_members->groupMembers
filmparams = axlGetParam(strcat("artwork:" film))

  (case film
("C02" printf ("tout est ok"))
("SMB" printf("ok")))))

But it doesn't work.

Could someone have an idea please? I have only 2 days to close that.

 

  • Sign in to reply
  • Cancel
  • ztzg
    ztzg over 12 years ago
    Hi Yann00,

    Not sure what you're trying to achieve exactly, but the first `printf`
    might be the culprit. In SKILL/SKILL++,

    printf("foo")

    is interpreted as:

    (printf "foo")

    whereas (notice the extra space):

    printf ("foo")

    is interpreted as, well, an error. (Technically, a reference to the
    `printf` variable, and an attempt at calling a string.)

    Hope this helps,
    Damien

    --
    http://crosstwine.com
    tel: +49 89 2189 2939
    cell: +49 174 3489 428

    “Strong Opinions, Weakly Held”
    — Bob Johansen
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • D912349
    D912349 over 12 years ago

    Try removing ->groupMembers  at foreach line.

    try this, this is exactly same as your program, only removed the ->groupMembers part

    my_films_members = axlGetParam("artwork")->groupMembers 

    foreach(film my_films_members->groupMembers 
    filmparams = axlGetParam(strcat("artwork:" film))

      (case film
    ("C02" printf ("tout est ok"))

    ("SMB" printf("ok"))))) 

     

    Hope it helps. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • fxffxf
    fxffxf over 12 years ago

    Change your code to the following since you taking groupMembers twice, once in axlGetParam and again in foreach exprList argument.

    fm = axlGetParam("artwork")->groupMembers

    foreach(film fm
       fp = axlGetParam(strcat("artwork:" film))

       (case film
       ( "C02"   printf("C02 Hi\n"))
       ( "SMB" printf("SMB Hi\n"))
       )
    )

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Yann00
    Yann00 over 12 years ago

    That's brillant, it works exactly like I want.

    Really thanks to you fxffxf,  D912349,  ztzg.

    My printf was wrong, and my groupMembers too!

     

    • 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