FreeCAD BOM Generator: Difference between revisions

From Open Source Ecology
Jump to navigation Jump to search
(Added a Category to the Page)
 
(18 intermediate revisions by one other user not shown)
Line 1: Line 1:
=Work Doc=
=Work Doc=
{{Hint|Document has 24 pages total}}


<html> <iframe src="https://docs.google.com/presentation/d/e/2PACX-1vSj2QRIcmJDnAz3DvoOg3AILdrfiDrgY6ywEvZcEY55Wvn1bgaei1obAcIrDFdsJf2MMAW7e371glr0/embed?start=false&loop=false&delayms=3000" frameborder="0" width="480" height="389" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe> </html>
<html> <iframe src="https://docs.google.com/presentation/d/e/2PACX-1vSj2QRIcmJDnAz3DvoOg3AILdrfiDrgY6ywEvZcEY55Wvn1bgaei1obAcIrDFdsJf2MMAW7e371glr0/embed?start=false&loop=false&delayms=3000#17" frameborder="0" width="480" height="389" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe> </html>


[https://docs.google.com/presentation/d/1wWbj03CQgsJpq1TQaR3Ak9wdGK6av9ExfFlc8O-ER7I/edit#slide=id.gb328b2d645_0_0 edit]
[https://docs.google.com/presentation/d/1wWbj03CQgsJpq1TQaR3Ak9wdGK6av9ExfFlc8O-ER7I/edit#slide=id.gb328b2d645_0_16 edit]


=Structured Way=
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 - [https://www.browserling.com/tools/phrase-frequency]. '''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:


[[File:partcopies.png|100px]]
=Structured Way - Naming Convention=


*The count appears readily by observing the last number.
We started with [[Phrase Counting Method]]. Too complicated - just use single words. The naming convention becomes:
*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:


[[File:part+url.png|350px]]
#3 letter code for what part of system item belongs in. Helps in organization.
*'''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.
##Ele - electrical
*FreeCAD allows CSV export of part spreadsheets - so further processing into finished BOMs can happen readily.
##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.


==Summary of Parn Naming Convention for Phrase Counter Method==
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.
*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'


===Other Notes===
==Notes==
*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.
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 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
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=
=Step 1: Extracting Parts Spreadsheet in FreeCAD=
Line 33: Line 38:
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.
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 [https://forum.freecadweb.org/viewtopic.php?t=12415]:
There is a macro from FreeCAD forum [https://forum.freecadweb.org/viewtopic.php?t=12415]. Click on edit mode to see actual code and copy it exactly with spacing as given. It should look like this:
 
[[File:BOMcode.png|400px]]


obj = FreeCADGui.Selection.getSelection()
<nowiki>
bom = App.activeDocument().addObject('Spreadsheet::Sheet','BOM')
obj = FreeCADGui.Selection.getSelection()
cell = 0
 
for x in obj:
bom = App.activeDocument().addObject('Spreadsheet::Sheet','BOM')
cell = 0
for x in obj:
     cell = cell + 1
     cell = cell + 1
     bom.set("A" + str(cell), x.Label)
     bom.set("A" + str(cell), x.Label)
App.ActiveDocument.recompute()


You can execute this macro in Macros or in the Python console. Select the parts in the tree view, and you will generate a spreadsheet with all the parts.Then these parts can be counted.
App.ActiveDocument.recompute()
</nowiki>
 
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
*This generates a spreadsheet, from selected parts in part tree
Line 86: Line 99:
=Applications=
=Applications=
*[[Extreme_Enterprise_House_Cost_Detail#Automated_BOM_Generator_in_FreeCAD]]
*[[Extreme_Enterprise_House_Cost_Detail#Automated_BOM_Generator_in_FreeCAD]]
[[Category: FreeCAD]] [[Category: FreeCAD Macros]] [[Category: Ergonomics and Productivity]]

Latest revision as of 17:44, 16 July 2022

Work Doc

HintLightbulb.png Hint: Document has 24 pages total

edit

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:

  1. 3 letter code for what part of system item belongs in. Helps in organization.
    1. Ele - electrical
    2. Plu - plumbing
    3. Str - structure
    4. Uti - utilities, apppliances, support systems
    5. Car - car port
    6. Lan - landscaping
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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:

BOMcode.png

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.


HintLightbulb.png 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:

Group.png

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:

  1. [46] wall panels
  2. [42] sheets of exterior textured plywood
  3. [8] window panels
  4. [4] small windows
  5. [3] door panels
  6. [120] 2x6 lumber - 8'
  7. [310] 2x6 lumber - 9' precut
  8. [215] 2x6 lumber - 14" long
  9. 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

Links

Applications