• 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 retain variable during skill session

Stats

  • Replies 6
  • Subscribers 160
  • Views 13757
  • Members are here 0
More Content

how to retain variable during skill session

Ejlersen
Ejlersen over 13 years ago

Hi

I've got a skill program that parses data to a new .dra file.

So the program actually saves the current session then start a new dra file and after it is finished with the dra file it reloads the original session.

I'm however experiencing that variables get lost so when I return to the original session. Is there any way to prevent this from happening.

At the same time I would like to clear the memory for all variables when the program terminates.

Best regards

Ole

  • Sign in to reply
  • Cancel
Parents
  • Ejlersen
    Ejlersen over 13 years ago

    Hi Dave

    Somone (maybe you) once posted the defun AFn_OpenDesign (code further down) which I use together with the following code

    currentDesign = axlCurrentDesign()
    state = axlSaveEnable()
    if(upperCase(axlDesignType(nil)) == "LAYOUT" then
      tempDesignName = "ns_temp.brd"
      if(isFile("ns_temp.brd") then deleteFile("ns_temp.brd"))
    else
      tempDesignName = "ns_temp.dra"
      if(isFile("ns_temp.dra") then deleteFile("ns_temp.dra"))
    )
    axlSaveDesign(?design tempDesignName, ?mode "nocheck", ?noMru t)
    AFn_OpenDesign(?design strcat(draName, ".dra"), ?mode "wf", ?noMru t, ?noConfirm t, ?forceNew t)
    axlSetSymbolType("shape")
    axlDBChangeDesignUnits("millimeters" 3) 

    Some code to generate .dra file

    axlDBChangeDesignExtents(extents)
    axlSaveDesign(?noMru t)
    AFn_OpenDesign(?design tempDesignName, ?mode "wf", ?noMru t, ?noConfirm t)
    axlRenameDesign(currentDesign)
    deleteFile(tempDesignName)
    axlSaveEnable(state)

    ----

    defun( AFn_OpenDesign (@key design, (mode "w"), noMru, noConfirm, forceNew)
     let((noconfirmStatus, result)
      when(noConfirm, noconfirmStatus = axlGetVariable("NOCONFIRM"), axlSetVariable("NOCONFIRM", t))
      when(forceNew && isFile(design), deleteFile(design))
      result = if(noMru && axlVersion('version) >= 16.0
       then axlOpenDesign(?design design, ?mode mode, ?noMru t)
       else axlOpenDesign(?design design, ?mode mode)
      )
      when(noConfirm, if(noconfirmStatus then axlSetVariable("NOCONFIRM", t) else axlUnsetVariable("NOCONFIRM")))
      result
    ))

    Best regards

    Ole

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • Ejlersen
    Ejlersen over 13 years ago

    Hi Dave

    Somone (maybe you) once posted the defun AFn_OpenDesign (code further down) which I use together with the following code

    currentDesign = axlCurrentDesign()
    state = axlSaveEnable()
    if(upperCase(axlDesignType(nil)) == "LAYOUT" then
      tempDesignName = "ns_temp.brd"
      if(isFile("ns_temp.brd") then deleteFile("ns_temp.brd"))
    else
      tempDesignName = "ns_temp.dra"
      if(isFile("ns_temp.dra") then deleteFile("ns_temp.dra"))
    )
    axlSaveDesign(?design tempDesignName, ?mode "nocheck", ?noMru t)
    AFn_OpenDesign(?design strcat(draName, ".dra"), ?mode "wf", ?noMru t, ?noConfirm t, ?forceNew t)
    axlSetSymbolType("shape")
    axlDBChangeDesignUnits("millimeters" 3) 

    Some code to generate .dra file

    axlDBChangeDesignExtents(extents)
    axlSaveDesign(?noMru t)
    AFn_OpenDesign(?design tempDesignName, ?mode "wf", ?noMru t, ?noConfirm t)
    axlRenameDesign(currentDesign)
    deleteFile(tempDesignName)
    axlSaveEnable(state)

    ----

    defun( AFn_OpenDesign (@key design, (mode "w"), noMru, noConfirm, forceNew)
     let((noconfirmStatus, result)
      when(noConfirm, noconfirmStatus = axlGetVariable("NOCONFIRM"), axlSetVariable("NOCONFIRM", t))
      when(forceNew && isFile(design), deleteFile(design))
      result = if(noMru && axlVersion('version) >= 16.0
       then axlOpenDesign(?design design, ?mode mode, ?noMru t)
       else axlOpenDesign(?design design, ?mode mode)
      )
      when(noConfirm, if(noconfirmStatus then axlSetVariable("NOCONFIRM", t) else axlUnsetVariable("NOCONFIRM")))
      result
    ))

    Best regards

    Ole

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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