Fixed the way options with arguments are passed to kicad2step.

This commit is contained in:
Salvador E. Tropea 2020-06-15 15:58:08 -03:00
parent 48fcb39f8d
commit 3382b4fe7b
4 changed files with 49 additions and 4 deletions

View File

@ -625,21 +625,20 @@ class Plotter(object):
if to.no_virtual: if to.no_virtual:
cmd.append('--no-virtual') cmd.append('--no-virtual')
if to.min_distance is not None: 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': if to.origin == 'drill':
cmd.append('--drill-origin') cmd.append('--drill-origin')
elif to.origin == 'grid': elif to.origin == 'grid':
cmd.append('--grid-origin') cmd.append('--grid-origin')
else: else:
to.origin.replace(',', 'x') cmd.extend(['--user-origin', "{}{}".format(to.origin.replace(',', 'x'), units)])
cmd.append('--user-origin="{}{}"'.format(to.origin, units))
# The board # The board
cmd.append(brd_file) cmd.append(brd_file)
# Execute and inform is successful # Execute and inform is successful
logger.debug('Executing: '+str(cmd)) logger.debug('Executing: '+str(cmd))
try: try:
cmd_output = check_output(cmd, stderr=STDOUT) 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!!!! # Current kicad2step always returns 0!!!!
# This is why I'm excluding it from coverage # This is why I'm excluding it from coverage
logger.error('Failed to create Step file, error %d', e.returncode) logger.error('Failed to create Step file, error %d', e.returncode)

View File

@ -29,3 +29,21 @@ def test_step_1():
# Check all outputs are there # 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+'.step'))
ctx.clean_up() 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()

View File

@ -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

View File

@ -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