• 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 18374
  • 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
  • oldmouldy
    oldmouldy over 16 years ago

    I am away from the reference documentation but I think, if you check the Allegro SKILL Language reference, that axlAddSelectAll will return a list, so myList=axlAddSelectAll() will contain a list of symbols the use a foreach(?) to work through the list, "something like" foreach(mySym in myList), and get the properties with "something like" myRefDes=mySym->RefDes in the loop. You could use the loop to build another list of just the required properties and then process that list later in the routine. I am sure that one of the regular SKILL "wizards" will have a more precise response! This might get you in the right direction for in the meantime.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • redwire
    redwire over 16 years ago

    Isn't it best to use the built-in BOM (condensed) report tool?  This way you don't mix parts of various values that use the same symbol.

    All the work is already done! 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kerchunk
    kerchunk over 16 years ago
    this should get you started...

    </p><p>trythis = outfile(&quot;trythis.txt&quot; &quot;w&quot;)
    foreach( comp_db axlDBGetDesign()-&gt;components
    &nbsp;&nbsp;&nbsp; if( comp_db-&gt;symbol&nbsp;&nbsp; ; component is placed
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf( trythis, &quot;%s -- %s -- %s -- %s &quot;, comp_db-&gt;package comp_db-&gt;class comp_db-&gt;deviceType comp_db-&gt;name)
    &nbsp;&nbsp;&nbsp; );end-if
    );end-foreach
    close( trythis)</p><p>

     

    HTH,

     

    Chris Walters

    local Cadence guru

    ()
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • kerchunk
    kerchunk over 16 years ago

    Well that formatting sure went haywire...trying again... 

     

    trythis = outfile("trythis.txt" "w")
    foreach( comp_db axlDBGetDesign()->components
        if( comp_db->symbol   ; component is placed
            fprintf( trythis, "%s -- %s -- %s -- %s\n", comp_db->package comp_db->class comp_db->deviceType comp_db->name)
        );end-if
    );end-foreach
    close( trythis)

     

    HTH,

    Chris Walters

    local Cadence guru

    () 

     

     

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