FreeCAD BOM Generator
BOM spreadsheet in progress for Seed Home 2 - see link at Seed_Home_v2_3D_CAD#Walls. Note: about 1400 individual parts are extacted from the CAD file, and are being summed up into a BOM that can be submitted to a supplier. Partial cut lumber is summed into large pieces, such as 14" 2x4 lumber cutoff are summed into a corresponding number of full sticks of framing lumber.
- The simplest method of obtaining a complete BOM, line by line, is to export parts spreadsheet in a FreeCAD document, and simply count them. You can count phrases by using an online phrase counter - . That is your BOM Generator MVP1.0.
- For this to work, the part names must be structured in an understandable way, such as "8 mm Screw #" such that every time it is copied, it appears as: "8 mm Screw #0"
- Limitation is that you just need to treat parts as primitive parts, meaning descibe a material exactly such as 2x6x8, or 2x6x16. You can't do something like 'sill plate 2x6x8' - because it will not count it with 'wall module 2x6x8
- Check out what happens when you copy a part, if its name allows for easy counting by examinging part name:
- The count appears readily by observing the last number.
- Out of the box - you can even include a BOM link to that part with URL or shortcut, so that the exported BOM can include links out of the box:
- The above looks trivial - but if done - one has automated capacity to generate full and correct clickable BOMs in FreeCAD. For example, if a design contains a house design made of multiples of various modules - all the parts can be summed automatically - with ordering links provided. This is powerful help for automated custom design.
- FreeCAD allows CSV export of part spreadsheets - so further processing into finished BOMs can happen readily.
Summary of Parn Naming Convention for Phrase Counter Method
- Use a 2 word naming convention for parts. Follow them by a counter number such as 001. FreeCAD automatically adds part counter numbers to part names.
- For transparency, use the simplest, sufficient naming convention, and always use 2 different words so that the counter doesn't count '2x8 lumber 001' and '2x6 lumber 001' as 2 of 'lumber 001'
- Do not use additional descriptors for the basic part, such as 'floor 2x6 lumber' and 'wall 2x6 lumber'. The phrase counter counts both 'floor 2x6' and '2x6 lumber' without producing transparent results.
- FreeCAD adds numbers after parts if there is more than 1 of that part - which is fine. '2x6 lumber 001' and '2x6 lumber 002' is counted properly as two instances of 2x6 lumber.
- Make sure you have the counter such as 001 and 002 in the last point - so that
Step 1: Extracting Parts Spreadsheet in FreeCAD
The first step in automated BOM generation is the creation of a FreeCAD spreadsheet populated with all the parts. This can be scripted in the Python console so that this doesn't have to be done manually.
There is a macro from FreeCAD forum . Click on edit mode to see actual code and copy it exactly with spacing as given. It should look like this:
obj = FreeCADGui.Selection.getSelection() bom = App.activeDocument().addObject('Spreadsheet::Sheet','BOM') cell = 0 for x in obj: cell = cell + 1 bom.set("A" + str(cell), x.Label) App.ActiveDocument.recompute()
You can execute this macro in Macros or in the Python console.
- This generates a spreadsheet, from selected parts in part tree
- Export this to CSV using Spreadsheet Workbench for other spreadsheet apps.
- Spreadsheet workbench allows import of CSV as well.
Note on Groups
If you organize parts in folders (ie, Create group...) - the group name also appears in the above list:
Thus- you can count groups as well (if you name them with space and number at the end so there is a clear name). So for example, you can extract that you have 2 roof modules, 5 walls, with 50 2x12s, 100 hangers, etc. For the 1000 sf Seed Home 2, counting number of roof sections is done easily from the CAD, so it may be useful to only sum up the individual parts, and avoid counting obvious parts.
Groups allow you to keep track of subparts, so they are useful in the BOM generation protocol. Ideally, you have such an example that is pulled out automatically via this process:
-  wall panels
-  sheets of exterior textured plywood
-  window panels
-  small windows
-  door panels
-  2x6 lumber - 8'
-  2x6 lumber - 9' precut
-  2x6 lumber - 14" long
Note that this process is best effectively suited for producing cut lists. This is because the method works well for itemizing all parts as used. This means that the 'cut list' will include both off-the-shelf parts (such as 9' precut 2x6 lumber), or cut pieces, such as the 14" long pieces. For the partial pieces, these will need to be summed in the spreadsheet software after they are extracted from the CAD.
FreeCAD BOM Automation - Evolution
- Note comment: part organization is what makes for proper assemblies - not constraints! Exactly. 
- Addendum Jan 1, 2020 - By this logic, part organization is what makes for proper BOM generation - not some magical software that tries to do that for you automatically. Such magic software does not exist until strong AI (or artificial general intelligence) is created. The arrival of such capacity is as of yet unknown. See Predictions on the Arrival of Artificial General Intelligence.