Added support for `--subst-models` option for KiCad 6's kicad2step.

Closes #137
This commit is contained in:
Salvador E. Tropea 2022-01-13 19:51:59 -03:00
parent d32f441e51
commit 926d6eb24c
4 changed files with 9 additions and 1 deletions

View File

@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support for variants on KiCost output. (#106)
- `--cli-order` option to generate outputs in arbitrary order. (#106)
- QR codes generation and update: symbols and footprints. (#93)
- Support for `--subst-models` option for KiCad 6's kicad2step. (#137)
### Changed
- Internal BoM: now components with different Tolerance, Voltage, Current

View File

@ -1804,6 +1804,7 @@ Next time you need this list just use an alias, like this:
The drill option uses the auxiliary reference defined by the user.
You can define any other origin using the format 'X,Y', i.e. '3.2,-10'.
- `output`: [string='%f-%i%v.%x'] Name for the generated STEP file (%i='3D' %x='step'). Affected by global options.
- `subst_models`: [boolean=true] Substitute STEP or IGS models with the same name in place of VRML models.
- `variant`: [string=''] Board variant to apply.
- `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output.
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.

View File

@ -1273,6 +1273,8 @@ outputs:
origin: 'grid'
# [string='%f-%i%v.%x'] Name for the generated STEP file (%i='3D' %x='step'). Affected by global options
output: '%f-%i%v.%x'
# [boolean=true] Substitute STEP or IGS models with the same name in place of VRML models
subst_models: true
# [string=''] Board variant to apply
variant: ''

View File

@ -33,6 +33,8 @@ class STEPOptions(Base3DOptions):
""" The minimum distance between points to treat them as separate ones (-1 is KiCad default: 0.01 mm) """
self.output = GS.def_global_output
""" Name for the generated STEP file (%i='3D' %x='step') """
self.subst_models = True
""" Substitute STEP or IGS models with the same name in place of VRML models """
# Temporal dir used to store the downloaded files
self._tmp_dir = None
super().__init__()
@ -50,7 +52,7 @@ class STEPOptions(Base3DOptions):
def run(self, output):
super().run(output)
check_script(KICAD2STEP, URL_PCBNEW_RUN_DRC, '1.6.0')
check_script(KICAD2STEP, URL_PCBNEW_RUN_DRC, '1.6.1')
# Make units explicit
if self.metric_units:
units = 'mm'
@ -65,6 +67,8 @@ class STEPOptions(Base3DOptions):
# Add user options
if self.no_virtual:
cmd.append('--no-virtual')
if self.subst_models:
cmd.append('--subst-models')
if self.min_distance >= 0:
cmd.extend(['--min-distance', "{}{}".format(self.min_distance, units)])
if self.origin == 'drill':