diff --git a/kiplot/kiplot.py b/kiplot/kiplot.py index 418667c8..29044fee 100644 --- a/kiplot/kiplot.py +++ b/kiplot/kiplot.py @@ -625,21 +625,20 @@ class Plotter(object): if to.no_virtual: cmd.append('--no-virtual') if to.min_distance is not None: - cmd.append('--min-distance="{}{}"'.format(to.min_distance, units)) + cmd.extend(['--min-distance', "{}{}".format(to.min_distance, units)]) if to.origin == 'drill': cmd.append('--drill-origin') elif to.origin == 'grid': cmd.append('--grid-origin') else: - to.origin.replace(',', 'x') - cmd.append('--user-origin="{}{}"'.format(to.origin, units)) + cmd.extend(['--user-origin', "{}{}".format(to.origin.replace(',', 'x'), units)]) # The board cmd.append(brd_file) # Execute and inform is successful logger.debug('Executing: '+str(cmd)) try: cmd_output = check_output(cmd, stderr=STDOUT) - except CalledProcessError as e: # pragma: no cover + except CalledProcessError as e: # pragma: no cover # Current kicad2step always returns 0!!!! # This is why I'm excluding it from coverage logger.error('Failed to create Step file, error %d', e.returncode) diff --git a/tests/test_plot/test_step.py b/tests/test_plot/test_step.py index a546ad38..03e57f23 100644 --- a/tests/test_plot/test_step.py +++ b/tests/test_plot/test_step.py @@ -29,3 +29,21 @@ def test_step_1(): # Check all outputs are there ctx.expect_out_file(os.path.join(STEP_DIR, prj+'.step')) ctx.clean_up() + + +def test_step_2(): + prj = 'bom' + 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.clean_up() + + +def test_step_3(): + prj = 'bom' + ctx = context.TestContext('STEP_3', prj, 'step_simple_3', STEP_DIR) + ctx.run() + # Check all outputs are there + ctx.expect_out_file(os.path.join(STEP_DIR, prj+'.step')) + ctx.clean_up() diff --git a/tests/yaml_samples/step_simple_2.kiplot.yaml b/tests/yaml_samples/step_simple_2.kiplot.yaml new file mode 100644 index 00000000..0b110cce --- /dev/null +++ b/tests/yaml_samples/step_simple_2.kiplot.yaml @@ -0,0 +1,14 @@ +kiplot: + version: 1 + +outputs: + - name: Step + comment: "Generate 3D model (STEP)" + type: step + dir: 3D + options: + metric_units: false + origin: "3.2,-10" # "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 diff --git a/tests/yaml_samples/step_simple_3.kiplot.yaml b/tests/yaml_samples/step_simple_3.kiplot.yaml new file mode 100644 index 00000000..a3d75376 --- /dev/null +++ b/tests/yaml_samples/step_simple_3.kiplot.yaml @@ -0,0 +1,14 @@ +kiplot: + version: 1 + +outputs: + - name: Step + comment: "Generate 3D model (STEP)" + type: step + dir: 3D + options: + metric_units: false + 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