Expand description
Bills of materials exported by CAD programs: CSV/TSV and spreadsheets
(Excel .xlsx/.xlsm/.xlsb/.xls, OpenDocument .ods).
Typical sources are the BOM editor of Autodesk Inventor (“Export Bill of Materials”, structured, all levels), SolidWorks BOM tables (“Save as” CSV or Excel), parts lists of Solid Edge, Fusion, Creo and NX, SAP-style BOM explosions and hand-made lists. The reader
- finds the header row among the first 30 rows (English and German column
names, e.g.
Item,Part Number,Description,QTYorPos.,Teilenummer,Benennung,Menge), - takes the structure from a level column (
Level,Ebene, also.1,..2) or from indented position numbers (1,1.1,1.1.2); without either, every row is a direct child. A single first row on level 0 is the assembly itself, - skips repeated header rows and components whose BOM structure is
Reference(Inventor), together with everything below them, - understands German number formats (
2,5), units in values (125 g,4 Stk,2.5 m,0.28 lbmass) and Windows-1252 encoded CSV files.
The column names are a heuristic built from the documented export layouts; they were not tested with files of every CAD program. Columns can always be renamed in the spreadsheet before the import.
Libraries: csv (MIT/Unlicense), calamine (MIT), encoding_rs
(MIT/Apache-2.0).
Structs§
- BomRow
- One component row of the table.
- BomTable
- The rows of a table and how its columns were understood.
- Column
- A column of the file that is used, and for what.
Constants§
- MAX_
ROWS - At most this many rows are read.
Functions§
- field_
label - English label of a field (preview pages).
- normalize_
unit - Units as TeamCraft writes them:
Stk,Stück,pcs,EA→each,Satz→set; anything else in lower case (at most 16 characters). - parse_
number - The number at the start of a cell (
4,5 m→ 4.5). - read
- Reads a BOM table.
- supported
- Whether TeamCraft reads BOMs from files with this name.