• 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. coloring pins

Stats

  • State Verified Answer
  • Replies 10
  • Answers 2
  • Subscribers 157
  • Views 3683
  • Members are here 0
More Content

coloring pins

masamasa
masamasa 9 months ago

hello

 

is there an easy way to color the pins based on the xy coordinates?

  

i have a list of the xy coordinates for about 100 pins.

  

i do know that i can color them one by one but i would like to find some easy way to do this.

 

regards

masa

  • Sign in to reply
  • Cancel
  • DavidJHutchins
    0 DavidJHutchins 9 months ago

    Below is a skill function to read an ascii csv file containing pin coordinates to color the pins...

    procedure(csv_coord_import( @optional (x_col nil) (y_col nil) (color nil))
       prog((FileName inport DataLine DataList Color Status LineCnt Pin_x Pin_y Pins Assigned ErrorCnt)
          unless(x_col
             (DataLine = axlEnterString(?prompts  ,"Enter X_col number:"))
             (x_col = charToInt(DataLine))
             unless(x_col
                (axlMsgPut "Invalid number entered")
                return()
             )
          )
          unless(y_col
             (DataLine = axlEnterString(?prompts  ,"Enter Y_col number:"))
             (y_col = charToInt(DataLine))
             unless(y_col
                (axlMsgPut "Invalid number entered")
                return()
             )
          )
          unless(color
             (DataLine = axlEnterString(?prompts  ,"Enter Color Index number:"))
             (color = charToInt(DataLine))
             unless(color
                (axlMsgPut "Invalid number entered")
                return()
             )
          )
          when(stringp(x_col) (x_col = atoi(x_col)))
          when(stringp(y_col) (y_col = atoi(y_col)))
          when(stringp(color) (color = atoi(color)))
          (LineCnt = 0)
          (ErrorCnt = 0)
          (Assigned = 0)
          (Pins = list())
          (FileName = axlDMFileBrowse( nil nil ?optFilters " files(*.csv)|*.csv|"))
          if(( stringp(FileName) && (isFile(FileName) == t)) then
             (inport = infile(FileName))
             (axlClearSelSet)
             (axlSetFindFilter ?enabled list("noall" "pins") ?onButtons list("noall" "pins"))
             while(gets(DataLine inport)
                (LineCnt++)
                (DataList=parseString(DataLine ",\n\r"))
                if( length(DataList) > y_col then
                   (Pin_x = atof(nthelem(x_col DataList)))
                   (Pin_y = atof(nthelem(y_col DataList)))
                   when(floatp(Pin_x) && floatp(Pin_y)
                       (axlClearSelSet)
                       (axlSingleSelectPoint (Pin_x:Pin_y))
                       when((axlGetSelSet)
                           (Pins = cons(car(axlGetSelSet()) Pins))
                       )
                   )
                )
             )
             close(inport)
             drain()
             (Assigned = length(Pins))
             axlCustomColorObject(Pins color)
             axlMsgPut("%d lines read, %d color assignments made, %d errors found" LineCnt Assigned ErrorCnt)
          else
             axlMsgPut("No valid file selected")
          )
       )
    )
    axlCmdRegister("csv_coord_import" 'csv_coord_import  ?cmdType "general")

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • masamasa
    0 masamasa 9 months ago in reply to DavidJHutchins

    thank u, david, to create the skill code.

     

    when i run the csv_coord_import command, i get this.

     

     

    when i enter the x coordinate, -7411.15, i get this error message,

    *Error* charToInt: argument #1 should be a symbol (type template = "s") - "-7411.15"

     

    when i enter the csv file name, i get this.

    *Error* charToInt: argument #1 should be a symbol (type template = "s") - "Book1.csv"

     

    regards

    masa

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • DavidJHutchins
    0 DavidJHutchins 9 months ago in reply to masamasa

    Masa,

    This skill code was created to read an ASCII comma separated file ( i.e. csv files ) for the pin location data...

    The initial Prompt for 'Enter X_col number:' is asking for which column in the ASCII file contains the 'X' coordinate of the Pin.

    The 2nd Prompt for  'Enter Y_col_number:' is asking for which column in the ASCII file contains the 'X' coordinate of the Pin.

    The 3rd prompt for "Enter Color Index number:" is asking for which Allegro color number to use as the pin highlight color.

    Lastly a file browser will appear for you to select the ASCII file to parse for the coordinate data:

    After this, it will read the file & color the pins, a summary message is written:

    32 lines read, 28 color assignments made, 0 errors found

    An updated version of the code is provided below:

    procedure(csv_coord_import( @optional (x_col nil) (y_col nil) (color nil))
    prog((FileName inport DataLine DataList Color Status LineCnt Pin_x Pin_y Pins Assigned ErrorCnt)
    unless(x_col
    (DataLine = axlEnterString(?prompts ,"Enter X_col number:"))
    (x_col = atoi(DataLine))
    unless(x_col
    (axlMsgPut "Invalid number entered")
    return()
    )
    )
    unless(y_col
    (DataLine = axlEnterString(?prompts ,"Enter Y_col number:"))
    (y_col = atoi(DataLine))
    unless(y_col
    (axlMsgPut "Invalid number entered")
    return()
    )
    )
    unless(color
    (DataLine = axlEnterString(?prompts ,"Enter Color Index number:"))
    (color = atoi(DataLine))
    unless(color
    (axlMsgPut "Invalid number entered")
    return()
    )
    )
    when(stringp(x_col) (x_col = atoi(x_col)))
    when(stringp(y_col) (y_col = atoi(y_col)))
    when(stringp(color) (color = atoi(color)))
    (LineCnt = 0)
    (ErrorCnt = 0)
    (Assigned = 0)
    (Pins = list())
    (FileName = axlDMFileBrowse( nil nil ?optFilters " files(*.csv)|*.csv|"))
    if(( stringp(FileName) && (isFile(FileName) == t)) then
    (inport = infile(FileName))
    (axlClearSelSet)
    (axlSetFindFilter ?enabled list("noall" "pins") ?onButtons list("noall" "pins"))
    while(gets(DataLine inport)
    (LineCnt++)
    (DataList=parseString(DataLine ",\n\r"))
    if( length(DataList) > y_col then
    (Pin_x = atof(nthelem(x_col DataList)))
    (Pin_y = atof(nthelem(y_col DataList)))
    when(floatp(Pin_x) && floatp(Pin_y)
    (axlClearSelSet)
    (axlSingleSelectPoint (Pin_x:Pin_y))
    when((axlGetSelSet)
    (Pins = cons(car(axlGetSelSet()) Pins))
    )
    )
    )
    )
    close(inport)
    drain()
    (Assigned = length(Pins))
    axlCustomColorObject(Pins color)
    axlMsgPut("%d lines read, %d color assignments made, %d errors found" LineCnt Assigned ErrorCnt)
    else
    axlMsgPut("No valid file selected")
    )
    )
    )
    axlCmdRegister("csv_coord_import" 'csv_coord_import ?cmdType "general")

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • masamasa
    0 masamasa 9 months ago in reply to DavidJHutchins

    thank u, again, david, for the explanation.

     

    for testing, i use this csv file.

     

    then i get this message.

      

     

    what is the color index number that i should enter?

     

    regards

    masa

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • DavidJHutchins
    0 DavidJHutchins 9 months ago in reply to masamasa

    So with that file you use column 1 for the X_col number & 2 for the Y_col number

    The color index  numbers can be found by opening the Color dialog window,

    as you browse the colors in the 'available colors' area it will show the color index as shown in the image below:

    • 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