FreeCAD BOM Generator
Contents
Work Doc
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.
Structured Way - Naming Convention
We started with Phrase Counting Method. Too complicated - just use single words. The naming convention becomes:
- 3 letter code for what part of system item belongs in. Helps in organization.
- Ele - electrical
- Plu - plumbing
- Str - structure
- Uti - utilities, apppliances, support systems
- Car - car port
- Lan - landscaping
- Unique stock material - such as -2x4precut9foot (2x4 inch precut stud lumber, 9 foot long), or halfinchply (one half inch thick plywood, 4'x8' sheet)- all of which should be clearly understandable to those versed in the art because the material is common and it comes in a common size.
- Next, describe how much of that stock is needed - such as 2 feet of an 8 foot long stud. This allows us to use the spreadsheet generated from FreeCAD to feed a Lumber Cut List Generator, so we can count the total number of pieces of stock that we need.
- Quantity of the stock material. For example, if use a 2x4- that name is 2x4. If you use 5" of it - name it 2x4-5inch.
- For any material that repeats - use a 001-999 at the end, or 0001-9999, etc. This allows the part to appear in the part tree as a unique name.
- Use Word Counter to get the number of parts.
Note that because we use a Lumber Cut List Generator - if you already know that you should use a precut stud, for example - that is a whole part - so you don't need to process it through a cut list generator. There may be times when you may want to cut a precut stud from a longer length, if the longer stock is more accessible, for reasons such as cost. Cost considerations may affect what stock you choose - which will determine your stock selection in the Lumber Cut List Generator. The generator does not consider cost.
Notes
The automated BOM generation is a 2-step process. The FreeCAD-generated spreadsheet will itemize small lumber lengths. That must be summed up. Essentially - the Lumber Cut List Generator is the utility that provides the summation - in the form of a Lumber Shopping List with the correct quantities.
FreeCAD programmers can then readily include this withing a FreeCAD as a utility. The whole BOM generation process can thus provide a formatted material list, including links to parts. The FreeCAD functionality would involve parsing the part name - such a -5inch- and sum that into a total number of whole pieces. Basic rules of logic would be automated in FreeCAD. This would be developed iteratively - at a level that is most useful for the home builder. The goal would be to degenerate the logic into its simplest form, using the most robust feedstocks. In the case of local production - this would be connected to digital fabrication tools. For example, a digital model would not provide you a cut list - it would already 3D print all the lumber pieces without having to go through the summation part that is still necessary today in the absence of digital production of open source lumber.
Imagine the possibility in the near term: a 3D CAD model is created - FreeCAD outputs a list of CAM files, and those are fed into a slicer for 3D printing such as Cura, and parts come rolling off a production line. We ship a kit to customers - or customers print their own parts in our microfactory by paying online and running print jobs remotely. We ship them the parts, or they pick the parts up.
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 [1]. 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.
Hint: Procedure: Select the parts in the tree view, and you will generate a spreadsheet with all the parts. Then these parts can be counted.
- 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:
- [46] wall panels
- [42] sheets of exterior textured plywood
- [8] window panels
- [4] small windows
- [3] door panels
- [120] 2x6 lumber - 8'
- [310] 2x6 lumber - 9' precut
- [215] 2x6 lumber - 14" long
- Etc...
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
2018 Progress
- Note comment: part organization is what makes for proper assemblies - not constraints! Exactly. [2]
- 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.
2017
https://forum.freecadweb.org/viewtopic.php?t=23592