From 1fa9e61ce4dfc0c52a70b15058bb9ac9e259fb0f Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Sat, 1 Dec 2018 12:12:22 -0200 Subject: [PATCH] Draft: Better fix to buggy Move/rotate of Arch BuilfingParts --- src/Mod/Draft/Draft.py | 18 +++++++++++++++--- src/Mod/Draft/DraftTools.py | 13 ++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 4bb7e7728b..8d044d9d83 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -359,7 +359,7 @@ def shapify(obj): FreeCAD.ActiveDocument.recompute() return newobj -def getGroupContents(objectslist,walls=False,addgroups=False,spaces=False): +def getGroupContents(objectslist,walls=False,addgroups=False,spaces=False,noarchchild=False): '''getGroupContents(objectlist,[walls,addgroups]): if any object of the given list is a group, its content is appened to the list, which is returned. If walls is True, walls and structures are also scanned for included windows or rebars. If addgroups @@ -387,7 +387,7 @@ def getGroupContents(objectslist,walls=False,addgroups=False,spaces=False): objectslist = [objectslist] for obj in objectslist: if obj: - if obj.isDerivedFrom("App::DocumentObjectGroup") or ((getType(obj) in ["BuildingPart","Space","Site"]) and hasattr(obj,"Group")): + if obj.isDerivedFrom("App::DocumentObjectGroup") or ((getType(obj) in ["Building","BuildingPart","Space","Site"]) and hasattr(obj,"Group")): if getType(obj) == "Site": if obj.Shape: newlist.append(obj) @@ -397,7 +397,10 @@ def getGroupContents(objectslist,walls=False,addgroups=False,spaces=False): else: if addgroups or (spaces and (getType(obj) == "Space")): newlist.append(obj) - newlist.extend(getGroupContents(obj.Group,walls,addgroups)) + if noarchchild and (getType(obj) in ["Building","BuildingPart"]): + pass + else: + newlist.extend(getGroupContents(obj.Group,walls,addgroups)) else: #print("adding ",obj.Name) newlist.append(obj) @@ -1432,6 +1435,15 @@ def move(objectslist,vector,copy=False): else: newobj = obj newobj.Position = obj.Position.add(vector) + elif getType(obj) == "DraftText": + if copy: + newobj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",getRealName(obj.Name)) + newobj.Text = obj.Text + if gui: + formatObject(newobj,obj) + else: + newobj = obj + newobj.Position = obj.Position.add(vector) elif getType(obj) == "Dimension": if copy: newobj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",getRealName(obj.Name)) diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 33c47172ff..9898621cff 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -376,6 +376,8 @@ class SelectPlane(DraftTool): if o.Visibility != (v == "True"): FreeCADGui.doCommand("FreeCADGui.ActiveDocument.getObject(\""+k+"\").Visibility = "+v) self.display(plane.axis) + self.ui.wplabel.setText(sel.Object.Label) + self.ui.wplabel.setToolTip(translate("draft", "Current working plane:",utf8_decode=True)+self.ui.wplabel.text()) self.finish() return elif sel.HasSubObjects: @@ -2363,14 +2365,7 @@ class Move(Modifier): def proceed(self): if self.call: self.view.removeEventCallback("SoEvent",self.call) self.sel = FreeCADGui.Selection.getSelection() - # testing for special case: only Arch groups in selection - onlyarchgroups = True - for o in self.sel: - if not(Draft.getType(o) in ["Floor","BuildingPart","Building","Site"]): - onlyarchgroups = False - if not onlyarchgroups: - # arch groups can be moved, no need to add their children - self.sel = Draft.getGroupContents(self.sel,addgroups=True,spaces=True) + self.sel = Draft.getGroupContents(self.sel,addgroups=True,spaces=True,noarchchild=True) self.ui.pointUi(self.name) self.ui.modUi() if self.copymode: @@ -2527,7 +2522,7 @@ class Rotate(Modifier): def proceed(self): if self.call: self.view.removeEventCallback("SoEvent",self.call) self.sel = FreeCADGui.Selection.getSelection() - self.sel = Draft.getGroupContents(self.sel,addgroups=True,spaces=True) + self.sel = Draft.getGroupContents(self.sel,addgroups=True,spaces=True,noarchchild=True) self.step = 0 self.center = None self.ui.arcUi()