Skip to content

Commit

Permalink
Arch: minor improvements in panel
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Sep 11, 2014
1 parent 9af4df3 commit 7318a1d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/Mod/Arch/ArchComponent.py
Expand Up @@ -312,7 +312,7 @@ def onChanged(self,obj,prop):
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:
Expand All @@ -323,7 +323,8 @@ def getSiblings(self,obj):
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):
Expand Down
16 changes: 13 additions & 3 deletions src/Mod/Arch/ArchPanel.py
Expand Up @@ -258,6 +258,7 @@ def __init__(self,obj):
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"

Expand Down Expand Up @@ -307,9 +308,13 @@ def execute(self,obj):
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)
Expand Down Expand Up @@ -341,6 +346,11 @@ def execute(self,obj):
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)
Expand Down
6 changes: 6 additions & 0 deletions src/Mod/Draft/Draft.py
Expand Up @@ -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:
Expand Down

0 comments on commit 7318a1d

Please sign in to comment.