Skip to content

Commit 48be2fa

Browse files
authored
Merge pull request johnbeard#5 from INTI-CMNB/variants
Added Variants and Filters
2 parents df013b5 + 15cf407 commit 48be2fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2166
-642
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77

88
## [Unreleased]
9+
### Added
10+
- Now variants are separated entities.
11+
- Only the internal BoM currently supports it.
12+
- In the future IBoM will also support it, contact me if you think this is
13+
high priority.
14+
- New filters entities. They implement all the functionality in KiBoM and IBoM.
15+
- Implemented the IBoM variants style.
16+
- The internal BoM format supports filters for:
17+
- Excluding components from processing
18+
- Marking components as "Do Not Fit"
19+
- Marking components as "Do Not Change"
20+
- The internal BoM format supports KiBoM and IBoM style variants
921

1022
## [0.6.2] - 2020-08-25
1123
### Changed

README.md

+28-60
Large diffs are not rendered by default.

docs/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ all: ../README.md samples/generic_plot.kibot.yaml
77

88
samples/generic_plot.kibot.yaml: ../kibot/out_*.py ../kibot/pre_*.py ../kibot/config_reader.py
99
rm -f example.kibot.yaml
10-
../src/kibot --example
10+
../src/kibot -v --example
1111
mv example.kibot.yaml $@

docs/samples/generic_plot.kibot.yaml

+49-83
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,16 @@ outputs:
6363
quote_all: false
6464
# [string=','] CSV Separator. TXT and TSV always use tab as delimiter
6565
separator: ','
66-
# [list(dict)] A series of regular expressions used to exclude parts.
67-
# If a component matches ANY of these, it will be excluded.
68-
# Column names are case-insensitive.
69-
# If empty the following list is used:
70-
# - column: References
71-
# regex: '^TP[0-9]*'
72-
# - column: References
73-
# regex: '^FID'
74-
# - column: Part
75-
# regex: 'mount.*hole'
76-
# - column: Part
77-
# regex: 'solder.*bridge'
78-
# - column: Part
79-
# regex: 'solder.*jump'
80-
# - column: Part
81-
# regex: 'test.*point'
82-
# - column: Footprint
83-
# regex: 'test.*point'
84-
# - column: Footprint
85-
# regex: 'mount.*hole'
86-
# - column: Footprint
87-
# regex: 'fiducial'
88-
exclude_any:
89-
# [string=''] Name of the column to apply the regular expression
90-
column: ''
91-
# `field` is an alias for `column`
92-
# [string=''] Regular expression to match
93-
regex: ''
94-
# `regexp` is an alias for `regex`
95-
# [string='Config'] Field name used to determine if a particular part is to be fitted (also DNC and variants)
66+
# [string|list(string)='_kibom_dnc'] Name of the filter to mark components as 'Do Not Change'.
67+
# The default filter marks components with a DNC value or DNC in the Config field
68+
dnc_filter: '_kibom_dnc'
69+
# [string|list(string)='_kibom_dnf'] Name of the filter to mark components as 'Do Not Fit'.
70+
# The default filter marks components with a DNF value or DNF in the Config field
71+
dnf_filter: '_kibom_dnf'
72+
# [string|list(string)='_mechanical'] Name of the filter to exclude components from BoM processing.
73+
# The default filter excludes test points, fiducial marks, mounting holes, etc
74+
exclude_filter: '_mechanical'
75+
# [string='Config'] Field name used for internal filters
9676
fit_field: 'Config'
9777
# [string=''] [HTML,CSV,TXT,TSV,XML,XLSX] format for the BoM.
9878
# If empty defaults to CSV or a guess according to the options.
@@ -129,17 +109,6 @@ outputs:
129109
title: 'KiBot Bill of Materials'
130110
# [boolean=true] Exclude DNF (Do Not Fit) components
131111
ignore_dnf: true
132-
# [list(dict)] A series of regular expressions used to select included parts.
133-
# If there are any regex defined here, only components that match against ANY of them will be included.
134-
# Column names are case-insensitive.
135-
# If empty all the components are included
136-
include_only:
137-
# [string=''] Name of the column to apply the regular expression
138-
column: ''
139-
# `field` is an alias for `column`
140-
# [string=''] Regular expression to match
141-
regex: ''
142-
# `regexp` is an alias for `regex`
143112
# [boolean=true] Component groups with blank fields will be merged into the most compatible group, where possible
144113
merge_blank_fields: true
145114
# [boolean=false] When normalizing values use the locale decimal point
@@ -148,14 +117,11 @@ outputs:
148117
normalize_values: false
149118
# [number=1] Number of boards to build (components multiplier)
150119
number: 1
151-
# [string='%f-%i.%x'] filename for the output (%i=bom). Affected by global options
152-
output: '%f-%i.%x'
153-
# [boolean=true] Each component group will be tested against a number of regular-expressions
154-
# (see `include_only` and `exclude_any`)
155-
test_regex: true
120+
# [string='%f-%i%v.%x'] filename for the output (%i=bom). Affected by global options
121+
output: '%f-%i%v.%x'
156122
# [boolean=false] Print grouped references in the alternate compressed style eg: R1-R7,R18
157123
use_alt: false
158-
# [string|list(string)=''] Board variant(s), used to determine which components
124+
# [string=''] Board variant(s), used to determine which components
159125
# are output to the BoM.
160126
variant: ''
161127
# [dict] Options for the XLSX format
@@ -200,8 +166,8 @@ outputs:
200166
force_plot_invisible_refs_vals: false
201167
# [boolean=false] use mm instead of inches
202168
metric_units: false
203-
# [string='%f-%i.%x'] output file name, the default KiCad name if empty. Affected by global options
204-
output: '%f-%i.%x'
169+
# [string='%f-%i%v.%x'] output file name, the default KiCad name if empty. Affected by global options
170+
output: '%f-%i%v.%x'
205171
# [boolean=true] include the footprint references
206172
plot_footprint_refs: true
207173
# [boolean=true] include the footprint values
@@ -229,8 +195,8 @@ outputs:
229195
# [dict|string] [hpgl,ps,gerber,dxf,svg,pdf] format for a graphical drill map.
230196
# Not generated unless a format is specified
231197
map:
232-
# [string='%f-%i.%x'] name for the map file, KiCad defaults if empty (%i='PTH_drill_map'). Affected by global options
233-
output: '%f-%i.%x'
198+
# [string='%f-%i%v.%x'] name for the map file, KiCad defaults if empty (%i='PTH_drill_map'). Affected by global options
199+
output: '%f-%i%v.%x'
234200
# [string='pdf'] [hpgl,ps,gerber,dxf,svg,pdf] format for a graphical drill map
235201
type: 'pdf'
236202
# [boolean=true] use metric units instead of inches
@@ -239,8 +205,8 @@ outputs:
239205
minimal_header: false
240206
# [boolean=false] invert the Y axis
241207
mirror_y_axis: false
242-
# [string='%f-%i.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options
243-
output: '%f-%i.%x'
208+
# [string='%f-%i%v.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options
209+
output: '%f-%i%v.%x'
244210
# [boolean=true] generate one file for both, plated holes and non-plated holes, instead of two separated files
245211
pth_and_npth_single_file: true
246212
# [dict|string] name of the drill report. Not generated unless a name is specified
@@ -262,12 +228,12 @@ outputs:
262228
# [dict|string] [hpgl,ps,gerber,dxf,svg,pdf] format for a graphical drill map.
263229
# Not generated unless a format is specified
264230
map:
265-
# [string='%f-%i.%x'] name for the map file, KiCad defaults if empty (%i='PTH_drill_map'). Affected by global options
266-
output: '%f-%i.%x'
231+
# [string='%f-%i%v.%x'] name for the map file, KiCad defaults if empty (%i='PTH_drill_map'). Affected by global options
232+
output: '%f-%i%v.%x'
267233
# [string='pdf'] [hpgl,ps,gerber,dxf,svg,pdf] format for a graphical drill map
268234
type: 'pdf'
269-
# [string='%f-%i.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options
270-
output: '%f-%i.%x'
235+
# [string='%f-%i%v.%x'] name for the drill file, KiCad defaults if empty (%i='PTH_drill'). Affected by global options
236+
output: '%f-%i%v.%x'
271237
# [dict|string] name of the drill report. Not generated unless a name is specified
272238
report:
273239
# [string=''] name of the drill report. Not generated unless a name is specified.
@@ -298,8 +264,8 @@ outputs:
298264
gerber_precision: 4.6
299265
# [number=0.1] [0.02,2] line_width for objects without width [mm]
300266
line_width: 0.1
301-
# [string='%f-%i.%x'] output file name, the default KiCad name if empty. Affected by global options
302-
output: '%f-%i.%x'
267+
# [string='%f-%i%v.%x'] output file name, the default KiCad name if empty. Affected by global options
268+
output: '%f-%i%v.%x'
303269
# [boolean=true] include the footprint references
304270
plot_footprint_refs: true
305271
# [boolean=true] include the footprint values
@@ -337,8 +303,8 @@ outputs:
337303
force_plot_invisible_refs_vals: false
338304
# [boolean=false] plot mirrored
339305
mirror_plot: false
340-
# [string='%f-%i.%x'] output file name, the default KiCad name if empty. Affected by global options
341-
output: '%f-%i.%x'
306+
# [string='%f-%i%v.%x'] output file name, the default KiCad name if empty. Affected by global options
307+
output: '%f-%i%v.%x'
342308
# [number=1] [1,16] pen number
343309
pen_number: 1
344310
# [number=20] [1,99] pen speed
@@ -415,8 +381,8 @@ outputs:
415381
no_redraw_on_drag: false
416382
# [boolean=false] Normalize extra field name case. E.g. 'MPN' and 'mpn' will be considered the same field
417383
normalize_field_case: false
418-
# [string='%f-%i.%x'] Filename for the output, use '' to use the IBoM filename (%i=ibom, %x=html). Affected by global options
419-
output: '%f-%i.%x'
384+
# [string='%f-%i%v.%x'] Filename for the output, use '' to use the IBoM filename (%i=ibom, %x=html). Affected by global options
385+
output: '%f-%i%v.%x'
420386
# [boolean=false] Show fabrication layer by default
421387
show_fabrication: false
422388
# [string='C,R,L,D,U,Y,X,F,SW,A,~,HS,CNN,J,P,NT,MH'] Default sort order for components. Must contain '~' once
@@ -530,8 +496,8 @@ outputs:
530496
format: 'HTML'
531497
# [number=1] Number of boards to build (components multiplier)
532498
number: 1
533-
# [string='%f-%i.%x'] filename for the output (%i=bom). Affected by global options
534-
output: '%f-%i.%x'
499+
# [string='%f-%i%v.%x'] filename for the output (%i=bom). Affected by global options
500+
output: '%f-%i%v.%x'
535501
# [string=','] CSV Separator
536502
separator: ','
537503
# [string=''] Board variant(s), used to determine which components
@@ -562,8 +528,8 @@ outputs:
562528
mirror: false
563529
# [boolean=false] do not make holes transparent
564530
no_drillholes: false
565-
# [string='%f-%i.%x'] name for the generated file. Affected by global options
566-
output: '%f-%i.%x'
531+
# [string='%f-%i%v.%x'] name for the generated file. Affected by global options
532+
output: '%f-%i%v.%x'
567533
# [boolean=false] show placeholder for missing components
568534
placeholder: false
569535
# [dict|None] replacements for PCB references using components (lib:component)
@@ -620,8 +586,8 @@ outputs:
620586
mirror_plot: false
621587
# [boolean=false] invert black and white
622588
negative_plot: false
623-
# [string='%f-%i.%x'] output file name, the default KiCad name if empty. Affected by global options
624-
output: '%f-%i.%x'
589+
# [string='%f-%i%v.%x'] output file name, the default KiCad name if empty. Affected by global options
590+
output: '%f-%i%v.%x'
625591
# [boolean=true] include the footprint references
626592
plot_footprint_refs: true
627593
# [boolean=true] include the footprint values
@@ -640,8 +606,8 @@ outputs:
640606
type: 'pdf_pcb_print'
641607
dir: 'Example/pdf_pcb_print_dir'
642608
options:
643-
# [string='%f-%i.%x'] filename for the output PDF (%i=layers, %x=pdf). Affected by global options
644-
output: '%f-%i.%x'
609+
# [string='%f-%i%v.%x'] filename for the output PDF (%i=layers, %x=pdf). Affected by global options
610+
output: '%f-%i%v.%x'
645611
# `output_name` is an alias for `output`
646612
layers: all
647613

@@ -653,8 +619,8 @@ outputs:
653619
type: 'pdf_sch_print'
654620
dir: 'Example/pdf_sch_print_dir'
655621
options:
656-
# [string='%f-%i.%x'] filename for the output PDF (%i=schematic %x=pdf). Affected by global options
657-
output: '%f-%i.%x'
622+
# [string='%f-%i%v.%x'] filename for the output PDF (%i=schematic %x=pdf). Affected by global options
623+
output: '%f-%i%v.%x'
658624

659625
# Pick & place:
660626
# This output is what you get from the 'File/Fabrication output/Footprint poistion (.pos) file' menu in pcbnew.
@@ -667,8 +633,8 @@ outputs:
667633
format: 'ASCII'
668634
# [boolean=true] only include the surface mount components
669635
only_smd: true
670-
# [string='%f-%i.%x'] output file name (%i='top_pos'|'bottom_pos'|'both_pos', %x='pos'|'csv'). Affected by global options
671-
output: '%f-%i.%x'
636+
# [string='%f-%i%v.%x'] output file name (%i='top_pos'|'bottom_pos'|'both_pos', %x='pos'|'csv'). Affected by global options
637+
output: '%f-%i%v.%x'
672638
# [boolean=true] generate two separated files, one for the top and another for the bottom
673639
separate_files_for_front_and_back: true
674640
# [string='millimeters'] [millimeters,inches] units used for the positions
@@ -697,8 +663,8 @@ outputs:
697663
mirror_plot: false
698664
# [boolean=false] invert black and white
699665
negative_plot: false
700-
# [string='%f-%i.%x'] output file name, the default KiCad name if empty. Affected by global options
701-
output: '%f-%i.%x'
666+
# [string='%f-%i%v.%x'] output file name, the default KiCad name if empty. Affected by global options
667+
output: '%f-%i%v.%x'
702668
# [boolean=true] include the footprint references
703669
plot_footprint_refs: true
704670
# [boolean=true] include the footprint values
@@ -738,8 +704,8 @@ outputs:
738704
# The drill option uses the auxiliar reference defined by the user.
739705
# You can define any other origin using the format 'X,Y', i.e. '3.2,-10'
740706
origin: 'grid'
741-
# [string='%f-%i.%x'] name for the generated STEP file (%i='3D' %x='step'). Affected by global options
742-
output: '%f-%i.%x'
707+
# [string='%f-%i%v.%x'] name for the generated STEP file (%i='3D' %x='step'). Affected by global options
708+
output: '%f-%i%v.%x'
743709

744710
# SVG (Scalable Vector Graphics):
745711
# Unlike bitmaps SVG drawings can be scaled without losing resolution.
@@ -763,8 +729,8 @@ outputs:
763729
mirror_plot: false
764730
# [boolean=false] invert black and white
765731
negative_plot: false
766-
# [string='%f-%i.%x'] output file name, the default KiCad name if empty. Affected by global options
767-
output: '%f-%i.%x'
732+
# [string='%f-%i%v.%x'] output file name, the default KiCad name if empty. Affected by global options
733+
output: '%f-%i%v.%x'
768734
# [boolean=true] include the footprint references
769735
plot_footprint_refs: true
770736
# [boolean=true] include the footprint values
@@ -782,6 +748,6 @@ outputs:
782748
type: 'svg_sch_print'
783749
dir: 'Example/svg_sch_print_dir'
784750
options:
785-
# [string='%f-%i.%x'] filename for the output SVG (%i=schematic %x=svg). Affected by global options
786-
output: '%f-%i.%x'
751+
# [string='%f-%i%v.%x'] filename for the output SVG (%i=schematic %x=svg). Affected by global options
752+
output: '%f-%i%v.%x'
787753

experiments/variants/IBoM/README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# IBoM variants
2+
3+
This is an analysis and test of the *variants* implementation of [IBoM](https://github.com/openscopeproject/InteractiveHtmlBom)
4+
5+
## What goes inside the SCH
6+
7+
- The field used for variants must be specified using `--variant-field`
8+
- The field can contain only one value. So you create some kind of component groups.
9+
10+
## What goes outside the SCH
11+
12+
- Two optional lists are passed to create the variant.
13+
- Components without a group are always included.
14+
- Whitelist: only the groups listed here are included.
15+
- If this list is empty all groups are included, unless listed in the blacklist.
16+
- Blacklist: groups listed here are excluded.
17+
18+
## Where is in the code?
19+
20+
In core/ibom.py function skip_component.
21+
22+
## Conclusion
23+
24+
### Advantages
25+
26+
- The `Config` field is simple.
27+
- You have "exclude from" and "include only" options.
28+
29+
### Disadvantages
30+
31+
- Critical part of the information is outside the project.
32+
33+
34+
35+

experiments/variants/KiBOM/README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# KiBOM variants
2+
3+
This is an analysis and test of the *variants* implementation of [KiBOM](https://github.com/SchrodingersGat/KiBoM)
4+
5+
## What goes inside the SCH
6+
7+
- The variants are implemented using the `Config` field (the name can be configured).
8+
- By default a component is included in all variants.
9+
- You can exclude a component from one variant adding `-VARIANT_NAME` to the `Config`.
10+
- If you want to exclude this component from more than one variant just add more `-VARIANT_NAME` entries. Comma separated.
11+
- If a component will be included **only** in one variant you can use `+VARIANT_NAME`.
12+
- Again you can add more than one `+VARIANT_NAME` entry. So the component will be included only if generating one of the selected variants.
13+
14+
## What goes outside the SCH
15+
16+
- When you generate the BoM you can select one or more variants, again comma separated.
17+
- The `-VARIANT_NAME` and `+VARIANT_NAME` is tested using a list of all the indicated variants.
18+
- By default the list of variants is ['default']. So *default* is like a special variant.
19+
20+
## Where is in the code?
21+
22+
The Component.isFitted() method implements the functionality.
23+
24+
## Conclusion
25+
26+
### Advantages
27+
28+
- Almost all the information is inside the project.
29+
- You have "exclude from" and "include only" options.
30+
31+
### Disadvantages
32+
33+
- The `Config` field could become large.
34+
35+
36+
37+

0 commit comments

Comments
 (0)