From 10accfa4ff2b236a3b48ff0b7e1a93de21f0d004 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Tue, 27 Dec 2022 12:48:44 -0300 Subject: [PATCH] [sub-PCBs][Fixed] Problems when we don't have components --- kibot/out_base.py | 1 + kibot/var_base.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/kibot/out_base.py b/kibot/out_base.py index f93ea9bb..cfbc6755 100644 --- a/kibot/out_base.py +++ b/kibot/out_base.py @@ -806,6 +806,7 @@ class VariantOptions(BaseOptions): """ Change the module/footprint data according to the filtered fields. iBoM can parse it. """ self.sch_fields_to_pcb_bkp = {} + has_GetFPIDAsString = False first = True for m in GS.get_modules_board(board): if first: diff --git a/kibot/var_base.py b/kibot/var_base.py index 31650c18..4b90d3c8 100644 --- a/kibot/var_base.py +++ b/kibot/var_base.py @@ -118,7 +118,7 @@ class SubPCBOptions(PanelOptions): if with_width: m.SetWidth(width) - def _remove_modules(self, iter): + def _remove_modules(self, iter, comps_hash): """ Remove modules outside the rectangle. Footprints are added to the list of references to exclude. We also check their position, not their BBox. """ @@ -126,11 +126,12 @@ class SubPCBOptions(PanelOptions): if not self.board_rect.Contains(m.GetPosition()): GS.board.Remove(m) self._removed.append(m) - self._excl_by_sub_pcb.add(m.GetReference()) + if comps_hash: + self._excl_by_sub_pcb.add(m.GetReference()) - def remove_outside(self): + def remove_outside(self, comps_hash): self._removed = [] - self._remove_modules(GS.get_modules()) + self._remove_modules(GS.get_modules(), comps_hash) self._remove_items(GS.board.GetDrawings()) self._remove_items(GS.board.GetTracks()) self._remove_items(list(GS.board.Zones())) @@ -138,10 +139,11 @@ class SubPCBOptions(PanelOptions): def apply(self, comps_hash): self._excl_by_sub_pcb = set() if self.reference: + logger.error(self.reference) self.separate_board(comps_hash) else: # Using a rectangle - self.remove_outside() + self.remove_outside(comps_hash) def unload_board(self, comps_hash): # Undo the sub-PCB: just reload the PCB