Update README.md

This commit is contained in:
Kyle Dumont 2024-05-10 20:17:47 +00:00
parent 694b7e5ccf
commit d5a0cd0979

View File

@ -1,41 +1,41 @@
# Generate BOM for Altium Projects
Generate a BOM for an Altium project on AllSpice Hub using py-allspice.
Generate a BOM output file for an Altium project on AllSpice Hub using [AllSpice Actions](https://learn.allspice.io/docs/actions-cicd).
## Usage
Add the following steps to your actions:
```yaml
# Checkout is only needed if columns.json is committed in the repo.
# Checkout is only needed if columns.json is committed in your Altium project repo.
- name: Checkout
uses: actions/checkout@v3
- name: Generate BOM
uses: https://hub.allspice.io/Actions/generate-bom-altium@main
with:
# The path to the Altium project file in your repo.
project_path: Archimajor.PrjPcb
# A path to a JSON file mapping columns to the attributes they are from.
columns: .allspice/columns.json
# [optional] The path to the output file that will be generated.
# Default: 'bom.csv'
output_file_name: bom.csv
```
where `.allspice/columns.json` looks like:
```json
{
"part_number": ["PART", "MANUFACTURER #", "MPN"],
"manufacturer": ["Manufacturer", "MANUFACTURER", "MFG", "Mfg"],
"designator": ["Designator", "REFDES", "Refdes", "Ref"],
"part_id": ["_part_id"],
"description": ["PART DESCRIPTION", "_description"]
}
# [optional] A comma-separated list of columns to group the BOM by. If empty
# or not present, the BOM will be flat.
# Default: ''
group_by: 'Part ID'
# [optional] The variant of the project to generate the BOM for. If empty
# or not present, the BOM will be generated for the default variant.
# Default: ''
variant: ''
```
### Customizing the Attributes Extracted by the BOM Script
This script relies on a `columns.json` file. This file maps the Component
Attributes in the SchDoc files to the columns of the BOM. An example for
`columns.json` is:
`columns.json` file content is:
```json
{
@ -69,3 +69,20 @@ attributes from overriding any of your own. You can use these like:
By default, the script picks up a `columns.json` file from the working
directory. If you want to keep it in a different place, or rename it, you can
pass the `--columns` argument to the script to specify where it is.
## Variants
To generate the BOM for a variant of the project, pass the `--variant` argument
to the script. For example:
```yaml
- name: Generate BOM
uses: https://hub.allspice.io/Actions/generate-bom-altium@main
with:
project_path: Archimajor.PrjPcb
columns: .allspice/columns.json
output_file_name: bom-lite.csv
variant: 'LITE'
```
When no variant is given, the BOM is generated without considering any variants.