From 7318a1d443c34c29b16aa44c89b371123ffc6f9f Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 11 Sep 2014 19:27:33 -0300 Subject: [PATCH] Arch: minor improvements in panel --- src/Mod/Arch/ArchComponent.py | 5 +++-- src/Mod/Arch/ArchPanel.py | 16 +++++++++++++--- src/Mod/Draft/Draft.py | 6 ++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 0e62d9d6f..0f2bf822c 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -312,7 +312,7 @@ class Component: pass def getSiblings(self,obj): - "returns a list of objects with the same base as this object" + "returns a list of objects with the same type and same base as this object" if not hasattr(obj,"Base"): return [] if not obj.Base: @@ -323,7 +323,8 @@ class Component: if o.Base: if o.Base.Name == obj.Base.Name: if o.Name != obj.Name: - siblings.append(o) + if Draft.getType(o) == Draft.getType(obj): + siblings.append(o) return siblings def getAxis(self,obj): diff --git a/src/Mod/Arch/ArchPanel.py b/src/Mod/Arch/ArchPanel.py index 1c548a799..bae69a948 100644 --- a/src/Mod/Arch/ArchPanel.py +++ b/src/Mod/Arch/ArchPanel.py @@ -258,6 +258,7 @@ class _Panel(ArchComponent.Component): obj.addProperty("App::PropertyLength","Width","Arch",translate("Arch","The width of this element, if not based on a profile")) obj.addProperty("App::PropertyLength","Thickness","Arch",translate("Arch","The thickness or extrusion depth of this element")) obj.addProperty("App::PropertyInteger","Sheets","Arch",translate("Arch","The number of sheets to use")) + obj.addProperty("App::PropertyLength","Offset","Arch",translate("Arch","The offset between this panel and its baseline")) obj.Sheets = 1 self.Type = "Panel" @@ -307,9 +308,13 @@ class _Panel(ArchComponent.Component): self.BaseProfile = base self.ExtrusionVector = normal base = base.extrude(normal) - elif (len(base.Wires) == 1): - if base.Wires[0].isClosed(): - base = Part.Face(base.Wires[0]) + elif base.Wires: + closed = True + for w in base.Wires: + if not w.isClosed(): + closed = False + if closed: + base = ArchCommands.makeFace(base.Wires) self.BaseProfile = base self.ExtrusionVector = normal base = base.extrude(normal) @@ -341,6 +346,11 @@ class _Panel(ArchComponent.Component): b.translate(n) bases.append(b) base = Part.makeCompound(bases) + + if base and normal and hasattr(obj,"Offset"): + if obj.Offset.Value: + v = DraftVecUtils.scaleTo(normal,obj.Offset.Value) + base.translate(v) # process subshapes base = self.processSubShapes(obj,base,pl) diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 3f676608b..16f32e712 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -968,6 +968,12 @@ def makeCopy(obj,force=None,reparent=False): ArchWindow._Window(newobj) if gui: ArchWindow._ViewProviderWindow(newobj.ViewObject) + elif (getType(obj) == "Panel") or (force == "Panel"): + import ArchPanel + newobj = FreeCAD.ActiveDocument.addObject(obj.TypeId,getRealName(obj.Name)) + ArchPanel._Panel(newobj) + if gui: + ArchPanel._ViewProviderPanel(newobj.ViewObject) elif (getType(obj) == "Sketch") or (force == "Sketch"): newobj = FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject",getRealName(obj.Name)) for geo in obj.Geometry: