• 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. Generating BOM from PCB File

Stats

  • Replies 11
  • Subscribers 161
  • Views 18376
  • Members are here 0
More Content

Generating BOM from PCB File

wERerABbiT
wERerABbiT over 16 years ago

Hi All,

I'm trying to write a skill function to:-

1) Automatically select all components in a board.

2) Group the selected components by Symbol 

3) Print to file a simple BOM list.

 

For the first part the code is 

axlClearSelSet()
axlSetFindFilter(?enabled "ALL" ?onButtons "NOALL")
axlSetFindFilter(?enabled "ALL" ?onButtons "symbols")
axlAddSelectAll()

 

1) The components are all selected, but how do I access the dbids?

2) After obtaining the dbids how do I access the Reference Designator and the Symbol Name?

 

Thanks All 

 

 

 

  • Sign in to reply
  • Cancel
Parents
  • pcbgeorge
    pcbgeorge over 16 years ago
    Here's another one:
     
    (prog
      (
        symDefs       ; Symbol Definitions list
        totCount      ; total Symbol count
      )
     
      ; Get definitions from database
      (setq symDefs (axlDBGetDesign)->symdefs )
      (setq totCount 0)
      (setq BOM (axlDMOpenFile "ALLEGRO_TEXT" "bom_test" "w"))
     
      ; Go through them and print the info
      (fprintf BOM "+--------------------------------------------------+\n")
      (fprintf BOM "|             Silly little BOM Report              |\n")
      (fprintf BOM "+--------------------------+---------------+-------+\n")
      (fprintf BOM "| NAME                     | TYPE          | COUNT |\n")
      (fprintf BOM "+--------------------------+---------------+-------+\n")
      (foreach device symDefs
        (when (or (equal device->type "MECHANICAL" )
                  (equal device->type "PACKAGE"))
          (fprintf BOM "| %24s | %13s | %5d |\n"
                   device->name device->type (length device->instances))
          (fprintf BOM "+--------------------------+---------------+-------+\n")
          (setq totCount (plus totCount (length device->instances)))
        );  end-when
      );  end-foreach
      (fprintf BOM "| %40s | %5d |\n" "TOTAL" totCount )
      (fprintf BOM "+------------------------------------------+-------+\n")
      (axlDMClose BOM)
    );  end-prog
     
    This prints to a text file:
    +--------------------------------------------------+
    |             Silly little BOM Report              |
    +--------------------------+---------------+-------+
    | NAME                     | TYPE          | COUNT |
    +--------------------------+---------------+-------+
    |                  LOTCODE |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                   GOV_ID |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                  ULTAG_A |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                   JC008B |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                MH250C131 |       PACKAGE |     5 |
    +--------------------------+---------------+-------+
    |                   S0603E |       PACKAGE |    65 |
    +--------------------------+---------------+-------+
    |                  STCD542 |       PACKAGE |     5 |
    +--------------------------+---------------+-------+
    |                  SCT3528 |       PACKAGE |    10 |
    +--------------------------+---------------+-------+
    |                   S1812A |       PACKAGE |     9 |
    +--------------------------+---------------+-------+
    |                    S0402 |       PACKAGE |    28 |
    +--------------------------+---------------+-------+
    |                   S1206B |       PACKAGE |     7 |
    +--------------------------+---------------+-------+
    |        SMLF64_050_281NWA |       PACKAGE |     2 |
    +--------------------------+---------------+-------+
    |              SFL_9KCB70C |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                  SLDLW31 |       PACKAGE |    20 |
    +--------------------------+---------------+-------+
    |                   SOT89B |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                  SCT3216 |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                SCT501700 |       PACKAGE |     4 |
    +--------------------------+---------------+-------+
    |                   SL1108 |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |             LABELID_SILK |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |             LABELPN_SILK |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                 S1208_NL |       PACKAGE |     2 |
    +--------------------------+---------------+-------+
    |             GLRFID40RING |       PACKAGE |     3 |
    +--------------------------+---------------+-------+
    |               LAYNO_SM_4 |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                FILMBLK_4 |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |             SO08TSPWRPAD |       PACKAGE |     4 |
    +--------------------------+---------------+-------+
    |                    SL505 |       PACKAGE |     4 |
    +--------------------------+---------------+-------+
    |                                    TOTAL |   180 |
    +------------------------------------------+----+
     
    We have a property attached to all symbols, if I wanted to I get the property instead of the Package name and give a REAL bom (something that can't be done in the canned Allegro report)
     
    Everyone have a real good Halloween! :)
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • pcbgeorge
    pcbgeorge over 16 years ago
    Here's another one:
     
    (prog
      (
        symDefs       ; Symbol Definitions list
        totCount      ; total Symbol count
      )
     
      ; Get definitions from database
      (setq symDefs (axlDBGetDesign)->symdefs )
      (setq totCount 0)
      (setq BOM (axlDMOpenFile "ALLEGRO_TEXT" "bom_test" "w"))
     
      ; Go through them and print the info
      (fprintf BOM "+--------------------------------------------------+\n")
      (fprintf BOM "|             Silly little BOM Report              |\n")
      (fprintf BOM "+--------------------------+---------------+-------+\n")
      (fprintf BOM "| NAME                     | TYPE          | COUNT |\n")
      (fprintf BOM "+--------------------------+---------------+-------+\n")
      (foreach device symDefs
        (when (or (equal device->type "MECHANICAL" )
                  (equal device->type "PACKAGE"))
          (fprintf BOM "| %24s | %13s | %5d |\n"
                   device->name device->type (length device->instances))
          (fprintf BOM "+--------------------------+---------------+-------+\n")
          (setq totCount (plus totCount (length device->instances)))
        );  end-when
      );  end-foreach
      (fprintf BOM "| %40s | %5d |\n" "TOTAL" totCount )
      (fprintf BOM "+------------------------------------------+-------+\n")
      (axlDMClose BOM)
    );  end-prog
     
    This prints to a text file:
    +--------------------------------------------------+
    |             Silly little BOM Report              |
    +--------------------------+---------------+-------+
    | NAME                     | TYPE          | COUNT |
    +--------------------------+---------------+-------+
    |                  LOTCODE |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                   GOV_ID |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                  ULTAG_A |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                   JC008B |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                MH250C131 |       PACKAGE |     5 |
    +--------------------------+---------------+-------+
    |                   S0603E |       PACKAGE |    65 |
    +--------------------------+---------------+-------+
    |                  STCD542 |       PACKAGE |     5 |
    +--------------------------+---------------+-------+
    |                  SCT3528 |       PACKAGE |    10 |
    +--------------------------+---------------+-------+
    |                   S1812A |       PACKAGE |     9 |
    +--------------------------+---------------+-------+
    |                    S0402 |       PACKAGE |    28 |
    +--------------------------+---------------+-------+
    |                   S1206B |       PACKAGE |     7 |
    +--------------------------+---------------+-------+
    |        SMLF64_050_281NWA |       PACKAGE |     2 |
    +--------------------------+---------------+-------+
    |              SFL_9KCB70C |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                  SLDLW31 |       PACKAGE |    20 |
    +--------------------------+---------------+-------+
    |                   SOT89B |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                  SCT3216 |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                SCT501700 |       PACKAGE |     4 |
    +--------------------------+---------------+-------+
    |                   SL1108 |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |             LABELID_SILK |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |             LABELPN_SILK |       PACKAGE |     1 |
    +--------------------------+---------------+-------+
    |                 S1208_NL |       PACKAGE |     2 |
    +--------------------------+---------------+-------+
    |             GLRFID40RING |       PACKAGE |     3 |
    +--------------------------+---------------+-------+
    |               LAYNO_SM_4 |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |                FILMBLK_4 |    MECHANICAL |     1 |
    +--------------------------+---------------+-------+
    |             SO08TSPWRPAD |       PACKAGE |     4 |
    +--------------------------+---------------+-------+
    |                    SL505 |       PACKAGE |     4 |
    +--------------------------+---------------+-------+
    |                                    TOTAL |   180 |
    +------------------------------------------+----+
     
    We have a property attached to all symbols, if I wanted to I get the property instead of the Package name and give a REAL bom (something that can't be done in the canned Allegro report)
     
    Everyone have a real good Halloween! :)
    • 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