From 155ae0ca41dcbb9f1f81e10e375a3651ff7e90bc Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 10 Jul 2012 20:42:30 -0300 Subject: [PATCH] Arch: Minor bugfixes --- src/Mod/Arch/ArchCommands.py | 8 ++++++++ src/Mod/Arch/ArchComponent.py | 2 +- src/Mod/Arch/ArchStructure.py | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 83ceb4a96..66babfc7c 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -75,6 +75,14 @@ def removeComponents(objectsList,host=None): objectsList = [objectsList] if host: if Draft.getType(host) in ["Wall","Structure"]: + if hasattr(host,"Axes"): + a = host.Axes + print a + for o in objectsList[:]: + print o.Name + if o in a: + a.remove(o) + objectsList.remove(o) s = host.Subtractions for o in objectsList: if not o in s: diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 7b220f588..b97d022ed 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -80,7 +80,7 @@ def removeFromComponent(compobject,subobject): it is added as a subtraction.''' if compobject == subobject: return found = False - attribs = ["Additions","Subtractions","Objects","Components","Base"] + attribs = ["Additions","Subtractions","Objects","Components","Base","Axes"] for a in attribs: if hasattr(compobject,a): if a == "Base": diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index e30c14106..b87aeb198 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -110,6 +110,12 @@ class _Structure(ArchComponent.Component): pts.extend(DraftGeomUtils.findIntersection(e1,e2)) return pts + def getAxisPlacement(self,obj): + "returns an axis placement" + if obj.Axes: + return obj.Axes[0].Placement + return None + def createGeometry(self,obj): import Part, DraftGeomUtils @@ -174,22 +180,29 @@ class _Structure(ArchComponent.Component): if not hole.Shape.isNull(): base = base.cut(hole.Shape) hole.ViewObject.hide() # to be removed + + # applying axes pts = self.getAxisPoints(obj) + apl = self.getAxisPlacement(obj) if pts: fsh = [] for p in pts: sh = base.copy() + if apl: + sh.Placement.Rotation = apl.Rotation sh.translate(p) fsh.append(sh) obj.Shape = Part.makeCompound(fsh) + + # finalizing else: if base: if not base.isNull(): base = base.removeSplitter() obj.Shape = base - if not DraftGeomUtils.isNull(pl): - obj.Placement = pl - + if not DraftGeomUtils.isNull(pl): + obj.Placement = pl + class _ViewProviderStructure(ArchComponent.ViewProviderComponent): "A View Provider for the Structure object"