diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cd44af1..bffe9813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - drill maps: uses drill instead of drl - dril: uses drill instead of drl, used in gbr and drl. - position: no -pos in CSVs + - step: adds -3D ## [0.5.0] - 2020-07-11 ### Changed diff --git a/kiplot/out_step.py b/kiplot/out_step.py index fc805371..2ef8abd4 100644 --- a/kiplot/out_step.py +++ b/kiplot/out_step.py @@ -25,8 +25,8 @@ class STEPOptions(BaseOptions): """ used to exclude 3D models for components with 'virtual' attribute """ self.min_distance = -1 """ the minimum distance between points to treat them as separate ones (-1 is KiCad default: 0.01 mm) """ - self.output = '' - """ name for the generated STEP file (the name of the PCB if empty) """ # pragma: no cover + self.output = '%f-%i.%x' + """ name for the generated STEP file (%i='3D' %x='step') """ # pragma: no cover @property def origin(self): @@ -40,10 +40,7 @@ class STEPOptions(BaseOptions): def run(self, output_dir, board): # Output file name - output = self.output - if not output: - output = os.path.splitext(os.path.basename(GS.pcb_file))[0]+'.step' - output = os.path.abspath(os.path.join(output_dir, output)) + output = self.expand_filename(output_dir, self.output, '3D', 'step') # Make units explicit if self.metric_units: units = 'mm' diff --git a/tests/test_plot/test_step.py b/tests/test_plot/test_step.py index 03e57f23..9c192a36 100644 --- a/tests/test_plot/test_step.py +++ b/tests/test_plot/test_step.py @@ -27,7 +27,7 @@ def test_step_1(): ctx = context.TestContext('STEP_1', prj, 'step_simple', STEP_DIR) ctx.run() # Check all outputs are there - ctx.expect_out_file(os.path.join(STEP_DIR, prj+'.step')) + ctx.expect_out_file(os.path.join(STEP_DIR, prj+'-3D.step')) ctx.clean_up() @@ -36,7 +36,7 @@ def test_step_2(): ctx = context.TestContext('STEP_2', prj, 'step_simple_2', STEP_DIR) ctx.run() # Check all outputs are there - ctx.expect_out_file(os.path.join(STEP_DIR, prj+'.step')) + ctx.expect_out_file(os.path.join(STEP_DIR, prj+'-3D.step')) ctx.clean_up() diff --git a/tests/yaml_samples/step_simple_3.kiplot.yaml b/tests/yaml_samples/step_simple_3.kiplot.yaml index a3d75376..dd57b9bc 100644 --- a/tests/yaml_samples/step_simple_3.kiplot.yaml +++ b/tests/yaml_samples/step_simple_3.kiplot.yaml @@ -11,4 +11,4 @@ outputs: origin: grid # "grid" or "drill" o "X,Y" i.e. 3.2,-10 no_virtual: true # exclude 3D models for components with 'virtual' attribute min_distance: 0.0004 # Minimum distance between points to treat them as separate ones (default 0.01 mm) - #output: project.step + output: '%f.%x'