Skip to content

Commit 72a9e7d

Browse files
committed
fix(out_base): update 3D variant aspect matching logic
- Correct logic to select default 3D slot selection (added `any_matched`); - Renamed `default` to `default_slots` for clarity.
1 parent 3ec9b8d commit 72a9e7d

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

kibot/out_base.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,8 @@ def apply_3D_variant_aspect(self, board, enable=False):
724724
for m in GS.get_modules_board(board):
725725
if extra_debug:
726726
logger.debug("Processing module " + m.GetReference())
727-
default = None
728-
matched = False
727+
default_slots = None
728+
any_matched = False
729729
# Look for text objects
730730
for gi in m.GraphicalItems():
731731
if gi.GetClass() in ['MTEXT', 'PCB_TEXT']:
@@ -737,13 +737,15 @@ def apply_3D_variant_aspect(self, board, enable=False):
737737
var = match.group(1)
738738
slots = match.group(2).split(',') if match.group(2) else []
739739
# Do the match
740+
matched = False
740741
if var == '_default_':
741-
default = slots
742+
default_slots = slots
742743
if self.extra_debug:
743-
logger.debug('- Found defaults: {}'.format(slots))
744+
logger.debug('- Found defaults: {}'.format(default_slots))
744745
else:
745746
matched = var == variant_name
746747
if matched:
748+
any_matched = True
747749
self.apply_list_of_3D_models(enable, slots, m, var)
748750
break
749751
else:
@@ -752,13 +754,15 @@ def apply_3D_variant_aspect(self, board, enable=False):
752754
if match:
753755
var = match.group(1)
754756
slots = match.group(2).split(',') if match.group(2) else []
757+
755758
# Do the match
756759
matched = self.variant.matches_variant(var)
757760
if matched:
761+
any_matched = True
758762
self.apply_list_of_3D_models(enable, slots, m, var)
759763
break
760-
if not matched and default is not None:
761-
self.apply_list_of_3D_models(enable, slots, m, '_default_')
764+
if not any_matched and default_slots is not None:
765+
self.apply_list_of_3D_models(enable, default_slots, m, '_default_')
762766

763767
def create_3D_highlight_file(self):
764768
if self._highlight_3D_file:

submodules/KiCost

Submodule KiCost updated 171 files

0 commit comments

Comments
 (0)