Create & export parts list
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
Create & export parts list
I found a Parts List inside the Assembly 2 WB. (I assume that is the only functional Assembly WB so far).
The Parts List tool of the Assembly 2 WB projects such a list on a drawing.
Now I need to export that list to a spreadsheet for further elaborations.
I accessed the XML codes by unzipping the FStd files, but unfortunately could not find the Parts List as a coherent block of text.
Could somebody advise me an effective procedure for this task?
Thanks
Roland
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
The Parts List tool of the Assembly 2 WB projects such a list on a drawing.
Now I need to export that list to a spreadsheet for further elaborations.
I accessed the XML codes by unzipping the FStd files, but unfortunately could not find the Parts List as a coherent block of text.
Could somebody advise me an effective procedure for this task?
Thanks
Roland
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Re: Create & export parts list
You will find the information stored in SVG files. Therefore you would need to code SVG parser/extractor of the data you are after or you could make feature request on Assembly2 module issue tracker to provide CSV BOM export capabilities.Roland wrote:I found a Parts List inside the Assembly 2 WB. (I assume that is the only functional Assembly WB so far).
The Parts List tool of the Assembly 2 WB projects such a list on a drawing.
Now I need to export that list to a spreadsheet for further elaborations.
I accessed the XML codes by unzipping the FStd files, but unfortunately could not find the Parts List as a coherent block of text.
Could somebody advise me an effective procedure for this task?
Thanks
Roland
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
For fun i made macro that reads labels of selected objects and puts them in the spreadsheet. Spreadsheet WB has CSV export capabilities.
Code: Select all
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()
Re: Create & export parts list
Dear Triplus.
Thanks for advice. Yr macro works also at my system. It could be a start, because from there I can make spreadsheet count parts and create a list.
Stupid question perhaps: You wrote: "BOM export capabilities". What is BOM? I also tried your macro using BAM in stead of BOM, and works perfect
Thanks for advice. Yr macro works also at my system. It could be a start, because from there I can make spreadsheet count parts and create a list.
Stupid question perhaps: You wrote: "BOM export capabilities". What is BOM? I also tried your macro using BAM in stead of BOM, and works perfect
Re: Create & export parts list
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
-
- Posts: 5
- Joined: Sun Nov 10, 2013 10:48 am
Re: Create & export parts list
BOM, in this case means Bill Of Materials.
Re: Create & export parts list
Yes as @J.Martinsson explained but you can give the spreadsheet any name.Roland wrote:Dear Triplus.
Thanks for advice. Yr macro works also at my system. It could be a start, because from there I can make spreadsheet count parts and create a list.
Stupid question perhaps: You wrote: "BOM export capabilities". What is BOM? I also tried your macro using BAM in stead of BOM, and works perfect
Nice macro.mario52 wrote:hi
try this macro Macro_FCInfo
Save alls info of object selected in a file in CSV format
mario
Re: Create & export parts list
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Create & export parts list
Nice macro, Mario,
Not making a parts list of an assembly though.
Never mi
Greetz
Not making a parts list of an assembly though.
Never mi
Greetz
Re: Create & export parts list
hi
no this macro works with one selected object
but you can create a Compound save the data file and delete the Compound to return to normal
mario
no this macro works with one selected object
but you can create a Compound save the data file and delete the Compound to return to normal
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Create & export parts list
Working with wood I had to export a part list (to later build a cut list), so I needed label, width, length, height, this is doable in the Python console using:
Code: Select all
print("\n".join("{}: {} × {} × {}".format(o.Label, o.Height, o.Length, o.Width) for o in App.ActiveDocument.Objects if all([hasattr(o, attr) for attr in ("Height", "Width", "Length", "Label")])))