diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index ff5dc90aa8b2..a5e871282e2d 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -81,7 +81,7 @@ def addComponents(objectsList,host): if not o in c: c.append(o) host.Group = c - elif hostType in ["Wall","Structure","Window","Roof"]: + elif hostType in ["Wall","Structure","Window","Roof","Stairs"]: import DraftGeomUtils a = host.Additions if hasattr(host,"Axes"): @@ -122,7 +122,7 @@ def removeComponents(objectsList,host=None): if not isinstance(objectsList,list): objectsList = [objectsList] if host: - if Draft.getType(host) in ["Wall","Structure"]: + if Draft.getType(host) in ["Wall","Structure","Window","Roof","Stairs"]: if hasattr(host,"Tool"): if objectsList[0] == host.Tool: host.Tool = None @@ -873,7 +873,7 @@ def Activated(self): FreeCADGui.doCommand("Arch.removeSpaceBoundaries( FreeCAD.ActiveDocument."+sel[-1].Name+", FreeCADGui.Selection.getSelection() )") else: FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Ungrouping"))) - if (Draft.getType(sel[-1]) in ["Wall","Structure"]) and (len(sel) > 1): + if (Draft.getType(sel[-1]) in ["Wall","Structure","Stairs","Roof","Window"]) and (len(sel) > 1): host = sel.pop() ss = "[" for o in sel: @@ -885,7 +885,7 @@ def Activated(self): FreeCADGui.doCommand("Arch.removeComponents("+ss+",FreeCAD.ActiveDocument."+host.Name+")") else: FreeCADGui.doCommand("import Arch") - FreeCADGui.doCommand("Arch.removeComponents(Arch.ActiveDocument."+sel[-1].Name+")") + FreeCADGui.doCommand("Arch.removeComponents(FreeCAD.ActiveDocument."+sel[-1].Name+")") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index d2f10bcc8e04..80019f0185a2 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -330,7 +330,7 @@ def hideSubobjects(self,obj,prop): def processSubShapes(self,obj,base,pl=None): "Adds additions and subtractions to a base shape" - import Draft + import Draft,Part if pl: if pl.isNull(): @@ -345,36 +345,40 @@ def processSubShapes(self,obj,base,pl=None): if base: if base.isNull(): base = None - - # special case, both walls with coinciding endpoints - import ArchWall - js = ArchWall.mergeShapes(o,obj) - if js: - add = js.cut(base) - if pl: - add.Placement = add.Placement.multiply(pl) - base = base.fuse(add) - - elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")): - f = o.Proxy.getSubVolume(o) - if f: - if base.Solids and f.Solids: - if pl: - f.Placement = f.Placement.multiply(pl) - base = base.cut(f) - - elif o.isDerivedFrom("Part::Feature"): - if o.Shape: - if not o.Shape.isNull(): - if o.Shape.Solids: - s = o.Shape.copy() + + if base: + # special case, both walls with coinciding endpoints + import ArchWall + js = ArchWall.mergeShapes(o,obj) + if js: + add = js.cut(base) + if pl: + add.Placement = add.Placement.multiply(pl) + base = base.fuse(add) + + elif (Draft.getType(o) == "Window") or (Draft.isClone(o,"Window")): + f = o.Proxy.getSubVolume(o) + if f: + if base.Solids and f.Solids: if pl: - s.Placement = s.Placement.multiply(pl) - if base: - if base.Solids: - base = base.fuse(s) - else: - base = s + f.Placement = f.Placement.multiply(pl) + base = base.cut(f) + + elif o.isDerivedFrom("Part::Feature"): + if o.Shape: + if not o.Shape.isNull(): + if o.Shape.Solids: + s = o.Shape.copy() + if pl: + s.Placement = s.Placement.multiply(pl) + if base: + if base.Solids: + try: + base = base.fuse(s) + except: + print "Arch: unable to fuse object ",obj.Name, " with ", o.Name + else: + base = s # treat subtractions for o in obj.Subtractions: @@ -407,7 +411,10 @@ def processSubShapes(self,obj,base,pl=None): s = o.Shape.copy() if pl: s.Placement = s.Placement.multiply(pl) - base = base.cut(s) + try: + base = base.cut(s) + except: + print "Arch: unable to cut object ",o.Name, " from ", obj.Name return base class ViewProviderComponent: diff --git a/src/Mod/Arch/ArchStairs.py b/src/Mod/Arch/ArchStairs.py index 49428e50a852..1dffe8f72432 100644 --- a/src/Mod/Arch/ArchStairs.py +++ b/src/Mod/Arch/ArchStairs.py @@ -90,7 +90,7 @@ def __init__(self,obj): obj.addProperty("App::PropertyLength","RiserHeight","Steps",translate("Arch","The height of the risers of these stairs")) obj.addProperty("App::PropertyLength","Nosing","Steps",translate("Arch","The size of the nosing")) obj.addProperty("App::PropertyLength","TreadThickness","Steps",translate("Arch","The thickness of the treads")) - obj.addProperty("App::PropertyLength","BlondelRatio","Steps",translate("Arch","The Blondel ratio, must be between 62 and 64cm or 24.5 and 25.5in")) + obj.addProperty("App::PropertyFloat","BlondelRatio","Steps",translate("Arch","The Blondel ratio, must be between 62 and 64cm or 24.5 and 25.5in")) # structural properties obj.addProperty("App::PropertyEnumeration","Landings","Structure",translate("Arch","The type of landings of these stairs")) @@ -116,6 +116,7 @@ def execute(self,obj): import Part self.steps = [] + self.pseudosteps = [] self.structures = [] pl = obj.Placement landings = 0 @@ -170,6 +171,12 @@ def execute(self,obj): shape = self.processSubShapes(obj,shape,pl) obj.Shape = shape obj.Placement = pl + elif self.pseudosteps: + shape = Part.makeCompound(self.pseudosteps) + obj.Shape = shape + obj.Placement = pl + else: + print "unable to calculate a stairs shape" # compute step data if obj.NumberOfSteps > 1: @@ -227,7 +234,9 @@ def makeStraightLanding(self,obj,edge,numberofsteps=None): step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1])) if obj.TreadThickness.Value: step = step.extrude(Vector(0,0,abs(obj.TreadThickness.Value))) - self.steps.append(step) + self.steps.append(step) + else: + self.pseudosteps.append(step) # structure lProfile = [] @@ -321,7 +330,7 @@ def makeStraightStairs(self,obj,edge,numberofsteps=None): vBase = edge.Vertexes[0].Point vNose = DraftVecUtils.scaleTo(vLength,-abs(obj.Nosing.Value)) a = math.atan(vHeight.Length/vLength.Length) - print "stair data:",vLength.Length,":",vHeight.Length + #print "stair data:",vLength.Length,":",vHeight.Length # steps for i in range(numberofsteps-1): @@ -334,7 +343,9 @@ def makeStraightStairs(self,obj,edge,numberofsteps=None): step = Part.Face(Part.makePolygon([p1,p2,p3,p4,p1])) if obj.TreadThickness.Value: step = step.extrude(Vector(0,0,abs(obj.TreadThickness.Value))) - self.steps.append(step) + self.steps.append(step) + else: + self.pseudosteps.append(step) # structure lProfile = [] diff --git a/src/Mod/Arch/InitGui.py b/src/Mod/Arch/InitGui.py index c674d280b649..3ba503cadeae 100644 --- a/src/Mod/Arch/InitGui.py +++ b/src/Mod/Arch/InitGui.py @@ -136,7 +136,7 @@ def Deactivated(self): Msg("Arch workbench deactivated\n") def ContextMenu(self, recipient): - self.appendContextMenu("Draft context tools",self.draftcontexttools) + self.appendContextMenu("Utilities",self.draftcontexttools) def GetClassName(self): return "Gui::PythonWorkbench" diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index ff86cce9e1f9..9fb4265e2ca9 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -2901,6 +2901,7 @@ def trimObject(self): else: self.obj.Shape = newshape self.doc.commitTransaction() + self.doc.recompute() for g in self.ghost: g.off() def finish(self,closed=False): diff --git a/src/Mod/Draft/InitGui.py b/src/Mod/Draft/InitGui.py index b67a0dd83882..ffc9afff0aeb 100644 --- a/src/Mod/Draft/InitGui.py +++ b/src/Mod/Draft/InitGui.py @@ -158,7 +158,7 @@ def ContextMenu(self, recipient): if (FreeCAD.activeDraftCommand == None): if (FreeCADGui.Selection.getSelection()): self.appendContextMenu("Draft",self.cmdList+self.modList) - self.appendContextMenu("Draft context tools",self.treecmdList) + self.appendContextMenu("Utilities",self.treecmdList) else: self.appendContextMenu("Draft",self.cmdList) else: @@ -166,7 +166,7 @@ def ContextMenu(self, recipient): self.appendContextMenu("",self.lineList) else: if (FreeCADGui.Selection.getSelection()): - self.appendContextMenu("Draft context tools",self.treecmdList) + self.appendContextMenu("Utilities",self.treecmdList) def GetClassName(self): return "Gui::PythonWorkbench"