element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Support (English) Saving BOM
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 5 replies
  • Subscribers 177 subscribers
  • Views 1771 views
  • Users 0 members are here
Related

Saving BOM

Former Member
Former Member over 10 years ago

Hello,

 

I'm using bom-ex.ulp to generate a BOM for my schematic I created.  When I select the radio button 'Values' under 'View By', the display is exactly what I want the file to be saved as.  However, when I click the Preview button, or the Save BOM button, the sort order changes on me.  I would like to save the BOM as displayed; sorted by Parts.  It seems to re-sort the list by Values.

 

I've been digging around the ULP code in bom-ex.ulp but I can't seem to make it do what I want.  I really just want the file I save to be sorted by Parts and not Values.  I've attached some screenshots showing my problem.  The first image shows how I want it, and the second image shows what happens when I click Preview.

 

Is there anyway to save the BOM so it comes out sorted by Parts and not Values?

 

Thanks,

Matt

Attachments:
image
image
  • Sign in to reply
  • Cancel

Top Replies

  • autodeskguest
    autodeskguest over 10 years ago +1
    On 30/04/15 23:03, Matt Taschner wrote: I'm using bom-ex.ulp to generate a BOM for my schematic I created. When I select the radio button 'Values' under 'View By', the display is exactly what I want the…
  • Former Member
    Former Member over 10 years ago in reply to autodeskguest +1
    Thanks for getting back to me. I've checked the bom4.ulp, but this does not do what I would like. It is still sorting the list by value and not part name. Most fab houses that I've had experience with…
  • autodeskguest
    autodeskguest over 10 years ago in reply to Former Member +1
    On 01/05/15 17:16, Matt Taschner wrote: Thanks for getting back to me. I've checked the bom4.ulp, but this does not do what I would like. It is still sorting the list by value and not part name. Most fab…
Parents
  • jessep
    jessep over 4 years ago

    Hi Matt,

    Not sure if you've already sorted this out yet. Thanks for opening the thread, glad other people had the same issue. I feel a little less silly spending some time figuring this out but I think I found a fix!

     

    Edit: looks like my fix below messes up the part grouping. The sort by values is needed for they way the example bom.ulp finds identical parts to group onto the same line.

    However, looks like this place has solved the issue by redoing the way the ulp finds identical parts AND sorts them by designator!

    http://www.pcserviceselectronics.co.uk/eagleulp/

     

    ---------------------------------

    1. Digging into the BOM.ULP, there's a sort( ) function line that needs to be modified so it sorts on PartName first instead of PartValue

     

    here's a snippet from my customized BOM_custom.ulp

    void GenerateValueList (void)
    {
      int NumLines = 0;
      int Index [];
      string attr[], s, s_val;
    
      if (UseAttributes) s = strjoin(AttributesList, '\t');
    
      // 2010-04-17 cwi: Included description.
      // JPL: moved "Parts" designator adjacent to Qty (column headers here)
      Lines[NumLines ++] = tr ("Qty\tParts\tValue\tDevice\tPackage\tDescription\t") + s;                 // 2011-04-08
      //sort (NumParts, Index, PartValue, PartDevice, PartPackage, PartAttributes, PartName, PartHeadline); // 2011-11-08 Partattribute jetzt nach Package alf@cadsoft.de
      sort (NumParts, Index, PartName, PartValue, PartDevice, PartPackage, PartAttributes, PartHeadline); // 2011-11-08 Partattribute jetzt nach Package alf@cadsoft.de...JPL: moved PartName after Index to sort by PartName first!
      for (int n1 = 0, n2 = 0; ++ n2 <= NumParts; )
      {
        int i1 = Index [n1];
        strsplit (attr, PartAttributes[i1], Separator);
        if (UseAttributes) s = strjoin(attr, '\t');
        s_val = attr[i1];
        if (n2 < NumParts)
        {
          int i2 = Index [n2]; // 2012-11-08
          strsplit (attr, PartAttributes[i2], Separator);
          if (PartValue[i1] == PartValue[i2] && PartDevice[i1] == PartDevice[i2] && PartAttributes[i1] == PartAttributes[i2]) // 2012-11-08 check diffent values of attributes
            continue;
        }
        string Quantity;
        sprintf (Quantity, "%d", n2 - n1);
        // JPL: moved "Parts" designator adjacent to Qty
        //Lines[NumLines] = Quantity + "\t" + PartValue[i1] + "\t" + PartDevice[i1] + "\t" + PartPackage[i1] + "\t";
        Lines[NumLines] = Quantity + "\t"; // + "\t" + PartValue[i1] + "\t" + PartDevice[i1] + "\t" + PartPackage[i1] + "\t";
        for (;;)
        {
          Lines[NumLines] += PartName[i1];
          if (++n1 < n2)
          {
            i1 = Index [n1];
            Lines[NumLines] += ", ";
          }
          else
            break;
        }
        // JPL: moved "Parts" designator adjacent to Qty, others needed shifted right (i.e. after the parts designator 'for' loop).
        Lines[NumLines] += "\t" + PartValue[i1] + "\t" + PartDevice[i1] + "\t" + PartPackage[i1];
        // cwi: add extra information from attributes
        // 2010-04-17 cwi: Included description.
        Lines[NumLines] += "\t" + PartHeadline[i1] + "\t" + s;
        NumLines ++;
      }
      Lines[NumLines] = "";
    }

    Comparing commented out line 12 with line 13: I moved PartName just after Index. If you read the documentation on sort( ), NumParts is just an integer, Index is an empty array, and the first array after Index is the first one to be sorted. However, the sort( ) documentation is pretty thin and doesn't describe the behavior of how you order the arrays within the function call.

     

    The sort( ) function was a little hard to decipher but some trial and error this looks like it works!

    Essentially the internal list generated by the ULP isn't affected at all by the dialog box, the ULP just prints to the dialog box but the internal list is separate, and when you hit Save it just takes the internal list "Lines[ ]" and dumps it into the csv.

     

    image

     

    2. I liked how some other BOMs had the PartName/Designator right next to the quantity, here is the fix for that. It's a little more involved but it seems to work. Same code spinnet as above, see line callouts

    Line 11 is only for the column headers

    Line 30: break up the list and move some column data insertions to after the for( ) loop

    Line 44: insert back in the columns from line 30, be mindful of the + "\t" so you don't accidentally have one too many. The code is all setup for tab-delimited then changes to commas at the save-to-csv.

     

    It looks like it was out of convenience that they put the PartNames after PartPackage since PartNames requires a for( ) loop to search through and find duplicates and group them together.

    To fix that, you need to break up the first group of columns, leaving only Quatity, then do the for( ) loop, then bring back in the rest of the columns.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • jessep
    jessep over 4 years ago

    Hi Matt,

    Not sure if you've already sorted this out yet. Thanks for opening the thread, glad other people had the same issue. I feel a little less silly spending some time figuring this out but I think I found a fix!

     

    Edit: looks like my fix below messes up the part grouping. The sort by values is needed for they way the example bom.ulp finds identical parts to group onto the same line.

    However, looks like this place has solved the issue by redoing the way the ulp finds identical parts AND sorts them by designator!

    http://www.pcserviceselectronics.co.uk/eagleulp/

     

    ---------------------------------

    1. Digging into the BOM.ULP, there's a sort( ) function line that needs to be modified so it sorts on PartName first instead of PartValue

     

    here's a snippet from my customized BOM_custom.ulp

    void GenerateValueList (void)
    {
      int NumLines = 0;
      int Index [];
      string attr[], s, s_val;
    
      if (UseAttributes) s = strjoin(AttributesList, '\t');
    
      // 2010-04-17 cwi: Included description.
      // JPL: moved "Parts" designator adjacent to Qty (column headers here)
      Lines[NumLines ++] = tr ("Qty\tParts\tValue\tDevice\tPackage\tDescription\t") + s;                 // 2011-04-08
      //sort (NumParts, Index, PartValue, PartDevice, PartPackage, PartAttributes, PartName, PartHeadline); // 2011-11-08 Partattribute jetzt nach Package alf@cadsoft.de
      sort (NumParts, Index, PartName, PartValue, PartDevice, PartPackage, PartAttributes, PartHeadline); // 2011-11-08 Partattribute jetzt nach Package alf@cadsoft.de...JPL: moved PartName after Index to sort by PartName first!
      for (int n1 = 0, n2 = 0; ++ n2 <= NumParts; )
      {
        int i1 = Index [n1];
        strsplit (attr, PartAttributes[i1], Separator);
        if (UseAttributes) s = strjoin(attr, '\t');
        s_val = attr[i1];
        if (n2 < NumParts)
        {
          int i2 = Index [n2]; // 2012-11-08
          strsplit (attr, PartAttributes[i2], Separator);
          if (PartValue[i1] == PartValue[i2] && PartDevice[i1] == PartDevice[i2] && PartAttributes[i1] == PartAttributes[i2]) // 2012-11-08 check diffent values of attributes
            continue;
        }
        string Quantity;
        sprintf (Quantity, "%d", n2 - n1);
        // JPL: moved "Parts" designator adjacent to Qty
        //Lines[NumLines] = Quantity + "\t" + PartValue[i1] + "\t" + PartDevice[i1] + "\t" + PartPackage[i1] + "\t";
        Lines[NumLines] = Quantity + "\t"; // + "\t" + PartValue[i1] + "\t" + PartDevice[i1] + "\t" + PartPackage[i1] + "\t";
        for (;;)
        {
          Lines[NumLines] += PartName[i1];
          if (++n1 < n2)
          {
            i1 = Index [n1];
            Lines[NumLines] += ", ";
          }
          else
            break;
        }
        // JPL: moved "Parts" designator adjacent to Qty, others needed shifted right (i.e. after the parts designator 'for' loop).
        Lines[NumLines] += "\t" + PartValue[i1] + "\t" + PartDevice[i1] + "\t" + PartPackage[i1];
        // cwi: add extra information from attributes
        // 2010-04-17 cwi: Included description.
        Lines[NumLines] += "\t" + PartHeadline[i1] + "\t" + s;
        NumLines ++;
      }
      Lines[NumLines] = "";
    }

    Comparing commented out line 12 with line 13: I moved PartName just after Index. If you read the documentation on sort( ), NumParts is just an integer, Index is an empty array, and the first array after Index is the first one to be sorted. However, the sort( ) documentation is pretty thin and doesn't describe the behavior of how you order the arrays within the function call.

     

    The sort( ) function was a little hard to decipher but some trial and error this looks like it works!

    Essentially the internal list generated by the ULP isn't affected at all by the dialog box, the ULP just prints to the dialog box but the internal list is separate, and when you hit Save it just takes the internal list "Lines[ ]" and dumps it into the csv.

     

    image

     

    2. I liked how some other BOMs had the PartName/Designator right next to the quantity, here is the fix for that. It's a little more involved but it seems to work. Same code spinnet as above, see line callouts

    Line 11 is only for the column headers

    Line 30: break up the list and move some column data insertions to after the for( ) loop

    Line 44: insert back in the columns from line 30, be mindful of the + "\t" so you don't accidentally have one too many. The code is all setup for tab-delimited then changes to commas at the save-to-csv.

     

    It looks like it was out of convenience that they put the PartNames after PartPackage since PartNames requires a for( ) loop to search through and find duplicates and group them together.

    To fix that, you need to break up the first group of columns, leaving only Quatity, then do the for( ) loop, then bring back in the rest of the columns.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube