• 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. Rename subclass with SKILL

Stats

  • Replies 7
  • Subscribers 18
  • Views 10366
  • Members are here 0
More Content

Rename subclass with SKILL

mir0mik
mir0mik over 4 years ago

Hi,

Could someone help me, give me some pointers on how to rename user-defined subclass by SKILL?

I know how to add/remove subclasses by SKILL, but I can not figure out how to rename them (it is possible to rename them "manualy" so I suppose it is also possible by SKILL).

Thanks!

Miro

  • Cancel
  • Sign in to reply
Parents
  • B Bruekers
    B Bruekers over 4 years ago

    If you have 17.4 then you can use axlLayerRenameNonConductor(). 

    If <17.4 then you need to do this with a script file (calling 'define subclass' and rename the subclass)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • B Bruekers
    B Bruekers over 4 years ago

    If you have 17.4 then you can use axlLayerRenameNonConductor(). 

    If <17.4 then you need to do this with a script file (calling 'define subclass' and rename the subclass)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • mir0mik
    mir0mik over 4 years ago in reply to B Bruekers

    Hi B Bruekers,

    Thanks for super fast reply!

    I had SKILL reference from Jun 2020 where axlLayerRenameNonConductor() doesn't exist so I updated to December 2020 :)

    I have 17.4 but unfortunately, I coding this for 17.2... so the second option could you please give more info about this approach?

    Do you mean axlShell( "define subclass") and I don't know how then rename the subclass by SKILL.

    Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • B Bruekers
    B Bruekers over 4 years ago in reply to mir0mik

    Hi,  something like this:

    renameSc("MANUFACTURING"  "new_subclass" "test123")
    defun( renameSc (class scFrom scTo)
        let( (file p)
            axlLayerCreateNonConductor( strcat(class "/" scFrom))
            file = "./tmp.scr"
            p = outfile(file "w")
            fprintf(p "setwindow pcb\n")
            fprintf(p "trapsize 0\n")
            fprintf(p "generaledit\n")
            fprintf(p "define subclass\n")
            fprintf(p "setwindow form.subclass\n")
            fprintf(p "FORM subclass %s pick\n" class)
            fprintf(p "setwindow form.subclass_nonetch\n")
            fprintf(p "FORM subclass_nonetch %s rename %s\n" scFrom scTo)
            fprintf(p "setwindow form.subclass\n")
            fprintf(p "FORM subclass done\n")
            fprintf(p "setwindow pcb\n")
            fprintf(p "generaledit")
            close(p)
            axlShell(lsprintf("replay  %L" file))
        )
    )

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mir0mik
    mir0mik over 4 years ago in reply to B Bruekers

    Hi,

    I've tried tried, but it doesn't work:

    axlShell( sprintf( nil "define subclass\nsetwindow form.subclass\nFORM subclass board_geometry pick\nsetwindow form.subclass_nonetch\nFORM subclass_nonetch %s rename %s\nsetwindow form.subclass\nFORM subclass done" "ncroute_path" "NEW NAME"))

    I'm going to look at your code and test it... I suppose this will not run on background (not blinking the subclasses menu)... right?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • mir0mik
    mir0mik over 4 years ago in reply to B Bruekers

    Hi,

    So tested, your code works (there are some issues with spaces - script replace " " with "_" so "BOARD GEOMETRY" need to be "BOARD_GEOMTERY" for the script part, but that's OK).

    I'm a little bit disappointed that by CADENCE that such essential function is not present in SKILL for 17.2... If I would work on some quick SKILL code it would be OK, but I want to integrate this to something else (bigger) and I really don't like the fact that it is "just" script. But, thanks, now I know there is no command for this...

    What do you think about this, would this be usable?

    - create new "subclass"

    - find out what objects are members of the "old" subclass

    - change current subclass for all objects from "old" to "new" subclass

    - once the "old" subclass is empty it can be deleted

    I'm not fully satisfied with this, but it would run on the background (no flashing windows)...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • B Bruekers
    B Bruekers over 4 years ago in reply to mir0mik

    Sucht approach should also work. However you need to do more coding to get all elements from one to another sclass.

    Only change layer change api i'm aware of is the axlChangeLayer()

    However I'm not sure about  if this can correctly move all objects to another layer, including properties, parent (when assigned) and groupparent (if grouped).

    If the sclass only contain a few items then this way should go fast.

    But if a sclass has a lot of elements (like a dxf import or so) then it can take some time, perhaps more than just running a script file...

    • 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