# bomcheck help

- Introduction
- Basics you need to know
- How to run bomcheck
- Interpreting results
- Units of Measure
- Import a CSV file into Excel
- ERP BOM vs ERP BOM howto
- bomcheck.cfg
- Troubleshooting

## Introduction

The purpose of of this program is to compare Bills of Materials (BOMs) derived from a CAD program (like SolidWorks) and compare them to BOMs stored in an ERP database program (like that of SyteLine). The CAD and ERP programs must be able to export to excel files because that is where this program gathers BOMs from for comparison.

## Basics you need to know

The file names for BOMs that come from the CAD program should be the part no. of the BOM followed by _sw.xlsx. That is, names like 0300-2010-005_sw.xlsx, 093352_sw.xlsx, and 35K2445_sw.xlsx are all legitimate file names. The names of the files from the ERP database will end with _sl.xlsx. Thus the names will look like 0300-2010-005_sl.xlsx, 093352_sl.xlsx, and 35K2445_sl.xlsx. The program will match the 0300-2010-005_sw.xlsx file to the 0300-2010-005_sl.xlsx file, and so forth.

A file can contain a mulilevel BOM. For a BOM from the ERP program to be recognized as a multilevel BOM, a column named "Level" must exist (can be altered with bomcheck.cfg) that gives the relative level of a subassembly to the main assembly. The Level column starts out with "0" for the top level assembly, "1" for parts/subassemblies under the main assembly, "2" for a parts/subassembly under a Level "1" subassembly, and so forth. From the CAD program, it is similar, but instead item nos. indicate the Level, e.g. item nos. like 1, 2, 3, 3.1, 3.2, 3.2.1, 3.2.2, 3.3, 4, etc., where item 3 is a subassembly with parts under it.

Tip #1: If two underscore characters exist within a file name, like 094433_testBOM_sw.xlsx, the characters between the two underscore characters will be ignored. In this case testBOM.

Tip #2: If the SyteLine BOM is a multilevel BOM (i.e. has a column named "Level"), then any characters proceeding the "_sl.xlsx" characters will be ignored. Instead the part number is obtained from within the Excel file where the part no. for Level 0 is shown.

## How to run bomcheck

To run the program from the command line, run like this (assuming you did the pip install bomcheck method do install bomcheck.py to your system):

- `C:\> bomcheck`

(Use bomcheckgui to run from a Graphical User Interface.) When the above command is run, help info will be shown about required command line arguments.

If you obtain the file named bomcheck.py, which is the source code for bomcheck, you can run bomcheck from within a python shell. Within bomcheck.py there is a function named bomcheck(). Excecute this function to run bomcheck from within the shell. Execute it like this:

- `>>> import bomcheck as bc`
- `>>> bc.bomcheck(arg1, arg2, ..., argN)`

(Note: requirements for running from a shell are pandas>=1.2, toml>=0.10, openpyxl>=3.0, and python>=3.11) To see information about arguments used in bomcheck():

- `>>> help(bc.bomcheck)`

Note that if an error occurs when checking your BOMs, or if bomcheck is confused about some data that was entered, a message will be shown that describes the problem. Otherwise look for something you may have done wrong like failing to attach the _sl.xlsx or _sw.xlsx characters to the file name.

## Interpreting results

Shown below is an example of a few lines of what a bom check looks like:

assy | Item | IQDU | Q_sw | Q_sl | Description_sw | Description_sl | U_sw | U_sl
--- | --- | --- | --- | --- | --- | --- | --- | ---
730322 | 130031 | XXXX |  | 1 |  | HOUSING |  | EA
| 130039 | XXXX | 1 |  | HOUSING |  | EA |
| 220978 | ‒‒‒‒ | 1 | 1 | SPUR GEAR | SPUR GEAR | EA | EA
| 275000 | ‒‒‒‒ | 0.35 | 0.35 | TUBE | TUBE | FT | FT
| 380000 | ‒‒‒‒ | 2 | 2 | BEARING | BEARING | EA | EA
| 441530 | ‒‒‒‒ | 1 | 1 | SHIFT ASSY | SHIFT ASSY | EA | EA
| 799944 | ‒‒X‒ | 1 | 1 | SHAFT | AXLE | EA | EA
| 877325 | ‒XX‒ | 3 | 1 | PLUG | SQ. HEAD PLUG | EA | EA
| 900000 | ‒‒‒‒ | 0.75 | 0.75 | OIL | OIL | GAL | GAL
441530 | 433255 | ‒‒‒‒ | 1 | 1 | ROD | ROD | EA | EA
| 500000 | ‒‒‒‒ | 1 | 1 | SHIFT FORK | SHIFT FORK | EA | EA
| K34452 | ‒‒‒‒ | 1 | 1 | SPRING PIN | SPRING PIN | EA | EA

The columns I, Q, D, and U show Xs if Item, Quantity, Description, or Unit of measure don't match between the SolidWorks BOM and the ERP BOM. Q_sw and Q_sl are quanties in SolidWorks and the ERP. Desription_sw and Description_sl are a comparison of descriptions. U_sw and U_sl are a comparison of units of measure. The 1309031 part is in the ERP but not in SolidWorks, thus the blank space in columns for the SolidWorks category. Likewise, 130039 is in SolidWorks, but not in the ERP BOM

## Units of Measure

If a unit of measure (U/M) is not given for a value in the Length column of a SolidWorks' BOM, then the U/M is assumed to be Inches (unless changed in the bomcheck.cfg file). However the U/M can be explicity specified, e.g. 336.7mm. The program will recognize the following abreviations for U/Ms:

in, inch, ”, ft, ', feet, foot, yrd, yd, yard, mm, millimeter, cm, centimeter, m, meter, mtr, sqin, sqi, sqft, sqf, sqyd, sqy, sqmm, sqcm, sqm, pint, pt, qt, quart, gal, g, gallon, ltr, l, liter.

When the program is run, values will be converted to the U/M given in the ERP database program. For example, 336.7mm will be converted to 1.10 ft, and 8 pints will be converted to 1.00 gal. Other names that can be substituted for the column name LENGTH in a SolidWorks BOM are: SIZE, Length, L, SIZE, AMT, AMOUNT, and MEAS. Names are case sensitive.

## Import a CSV file into Excel

Bomcheck can export results to a CSV file which can be imported into Microsoft Excel. To do this:

- Open Excel
- Click New, then click on Blank workbook
- Click on the Data tab
- Click Get Data From Text/CSV
- Navigate to the CSV-formatted file saved on your system, select it, then click Import
- This will open the menu asking for settings to use for import
- For File Origin choose 65001: Unicode (UTF-8)
- For Delimiter choose Tab
- For Data Type Detection, use the default. Normally is Based on first 200 rows
- Click the Load button

## ERP BOM vs ERP BOM howto

The bomcheck program has been designed specifically to compare a CAD BOM (like from SolidWorks) to an ERP BOM (like from SyteLine). However with a bit of finagaling, it can be used to compare an ERP BOM to an ERP BOM. Here's how:

1. Extract the two BOM's you wish to compare and save them to Excel files. Use multilevel BOMs. For example, let's imagine you saved them to 101304_sl.xlsx and 089432_sl.xlsx
2. Rename the first file to 101304_sw.xlsx
3. Open in Excel the 101304_sw.xlsx file and go to the line that shows level 0:

   Level | Item | Description | Qty Per | U/M
   --- | --- | --- | --- | ---
   0 | 101304 | DZS 300V TRIPLEX | 1.000 | EA

   Change the Item there from 101304 to 089432.
4. Save the Excel file and run the bomcheck program and compare the 101304_sw.xlsx and the 089432_sl.xlsx. This works because for multilevel ERP BOMs the 101304 in the filename is ignored and bomcheck instead gets the Item shown at level 0.
5. When you look at your BOM check results, you won't see number 101304 listed anywhere. Instead look for the number 089432. You'll see the comparison results there. (Subassembly BOMs will be present also.) The parts, quantities, etc. for the 101304 system will be shown in the "sw" columns where numbers from a CAD file are normally shown.

If you have BOMs that are NOT multilevel, then rename the 101304_sw.xlsx file to 089432_sw.xlsx, and then compare it to the 089422_sl.xlsx file.

## bomcheck.cfg

Download the file named bomcheck.cfg (download link) that contains settings that you can change in order to alter how the bomcheck program behaves. For example, you can change units of measure. Open bomcheck.cfg with a text editor program such as Microsoft's Wordpad. There you will see settings that can be changed.

Place bomcheck.cfg in a directory of your choosing. Then set the location of this file via an argument setting in the bomcheck function, or, if you are using bomcheckgui, go to the settings section and enter the location there.