From cfc3370ad8e920b2ca11fdcc9340c0047a1316c1 Mon Sep 17 00:00:00 2001 From: "Morgan 'ARR\\!' Allen" Date: Wed, 30 Apr 2025 20:25:38 -0700 Subject: [PATCH] make Syncables base class handle selection filtering and dispatching sync to sub Features --- freecad/kiconnect/commands/Syncable.py | 31 +++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/freecad/kiconnect/commands/Syncable.py b/freecad/kiconnect/commands/Syncable.py index 42f64ae..e144921 100644 --- a/freecad/kiconnect/commands/Syncable.py +++ b/freecad/kiconnect/commands/Syncable.py @@ -6,13 +6,38 @@ class Syncable: def IsActive(self): sel = Gui.Selection.getSelection() - print(len(sel)) if len(sel) == 0: return False - print(sel, self.SYNCABLES) - for obj in sel: if obj.Type not in self.SYNCABLES: return False return True + + def Activated(self): + selection = [ sel for sel in Gui.Selection.getSelection() if sel.Type in self.SYNCABLES ] + syncables = [] + + if len(selection) == 1: + syncables = selection + else: + syncables = [] + + for i in selection: + for j in selection: + print(selection) + if i == j: continue + + if i in j.OutList: + break + else: + syncables.append(i) + + for s in syncables: + if not hasattr(s, 'Proxy'): continue + + feature = s.Proxy + if hasattr(feature, self.method): + getattr(feature, self.method)() + + s.recompute()