• 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. It Worked the First Time! Why Does My SKILL Code Fail on...

Stats

  • Replies 0
  • Subscribers 20
  • Views 34
  • Members are here 0
More Content

It Worked the First Time! Why Does My SKILL Code Fail on the Second Run?

JuanCR
JuanCR 20 hours ago

Have you ever run a SKILL function successfully, only to find that running it again produces an error or unexpected behaviour?

One common cause is that the first execution changes the database or application state that the code assumes will still be available on the next run. For example, your code may keep references to database objects that have since been deleted, replaced, or modified.

A useful troubleshooting technique is to avoid relying on database object IDs stored globally between executions. Instead, retrieve the objects you need each time the function runs and validate the returned values before operating on them.

For instance:

procedure(processSelectedObject()
  let((obj)

    obj = car(axlGetSelSet())

    if(obj then
      printf("Current object: %L\n" obj)
      ; Process obj here
    else
      printf("No object is currently selected.\n")
    )
  )
)

This also demonstrates another useful habit: check the result before using it. For example:

obj = car(axlGetSelSet())

when(obj
  printf("Selected object type: %L\n" obj->objType)
)

Database objects aren't the only thing to consider. A SKILL script can also change session state such as the current selection or Find Filter. If your function depends on a particular state, the second execution may start under different conditions than the first.

When debugging this kind of problem, try this approach:

  1. Run the function once.
  2. Check what changed in the design or session.
  3. Run it again and identify the first operation that behaves differently.
  4. Add printf() statements around your operations.
  5. Inspect database objects and return values instead of assuming they are valid.
  6. Where appropriate, reacquire database objects rather than relying on references retained from an earlier execution.

These steps are crucial specially when you're testing loose SKILL commands, where moving the canvas, zooming in or modifying the position of the elements might change the dbIDs of the objects. 

The important question isn't always "Why did my SKILL code fail?" Sometimes the better question is:

"What did the first execution change that the second execution wasn't expecting?"

That small shift in troubleshooting approach can make intermittent SKILL problems much easier to isolate.

Have you encountered a SKILL function that behaves differently on its second execution? What was the root cause, and how did you track it 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.

© 2026 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information