From c522fa003ebd7b455171602ad5202b5994c31891 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 10 Sep 2020 12:52:07 -0300 Subject: [PATCH] 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. --- kibot/out_step.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kibot/out_step.py b/kibot/out_step.py index 301d9b9a..fb618a11 100644 --- a/kibot/out_step.py +++ b/kibot/out_step.py @@ -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))