Fixed problems with 3D relative models in STEP output

When using a variant and one or more 3D models were stored in a
relative path the STEP file didn't contain them.
This is because we use a temporal PCB and it was stored in /tmp
Now is stored in the same directory as the real PCB.
This commit is contained in:
Salvador E. Tropea 2020-09-10 12:52:07 -03:00
parent f25fd80b65
commit c522fa003e
1 changed files with 3 additions and 3 deletions

View File

@ -44,7 +44,7 @@ class STEPOptions(VariantOptions):
raise KiPlotConfigurationError('Origin must be `grid` or `drill` or `X,Y`')
self._origin = val
def filter_components(self):
def filter_components(self, dir):
if not self._comps:
return GS.pcb_file
comps_hash = self.get_refs_hash()
@ -60,7 +60,7 @@ class STEPOptions(VariantOptions):
rem_m_models.append(models.pop())
rem_models.append(rem_m_models)
# Save the PCB to a temporal file
with NamedTemporaryFile(mode='w', suffix='.kicad_pcb', delete=False) as f:
with NamedTemporaryFile(mode='w', suffix='.kicad_pcb', delete=False, dir=dir) as f:
fname = f.name
logger.debug('Storing filtered PCB to `{}`'.format(fname))
GS.board.Save(fname)
@ -98,7 +98,7 @@ class STEPOptions(VariantOptions):
else:
cmd.extend(['--user-origin', "{}{}".format(self.origin.replace(',', 'x'), units)])
# The board
board_name = self.filter_components()
board_name = self.filter_components(GS.pcb_dir)
cmd.append(board_name)
# Execute and inform is successful
logger.debug('Executing: '+str(cmd))