diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 69373ba59..421b32269 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -323,9 +323,16 @@ class Component: if Draft.getType(o) != "Window": o.ViewObject.hide() - def processSubShapes(self,obj,base): + def processSubShapes(self,obj,base,pl=None): "Adds additions and subtractions to a base shape" import Draft + + if pl: + if pl.isNull(): + pl = None + else: + pl = FreeCAD.Placement(pl) + pl = pl.inverse() # treat additions for o in obj.Additions: @@ -339,23 +346,30 @@ class Component: 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 pl: + s.Placement = s.Placement.multiply(pl) if base: if base.Solids: - base = base.fuse(o.Shape) + base = base.fuse(s) else: - base = o.Shape + base = s # treat subtractions for o in obj.Subtractions: @@ -370,13 +384,18 @@ class Component: 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 and base.Solids: - base = base.cut(o.Shape) + s = o.Shape.copy() + if pl: + s.Placement = s.Placement.multiply(pl) + base = base.cut(s) return base class ViewProviderComponent: diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index c70cf89bf..d99e915b3 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -628,7 +628,7 @@ class _Structure(ArchComponent.Component): self.BaseProfile = base base = base.extrude(self.ExtrusionVector) - base = self.processSubShapes(obj,base) + base = self.processSubShapes(obj,base,pl) if base: # applying axes @@ -659,7 +659,7 @@ class _Structure(ArchComponent.Component): return base = base.removeSplitter() obj.Shape = base - if not DraftGeomUtils.isNull(pl): + if not pl.isNull(): obj.Placement = pl def onChanged(self,obj,prop): diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index b3364b805..f1265b72c 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -468,7 +468,7 @@ class _Wall(ArchComponent.Component): FreeCAD.Console.PrintWarning(str(translate("Arch","This mesh is an invalid solid"))) obj.Base.ViewObject.show() - base = self.processSubShapes(obj,base) + base = self.processSubShapes(obj,base,pl) if base: if not base.isNull(): @@ -483,7 +483,7 @@ class _Wall(ArchComponent.Component): except: FreeCAD.Console.PrintError(str(translate("Arch","Error removing splitter from wall shape"))) obj.Shape = base - if not DraftGeomUtils.isNull(pl): + if not pl.isNull(): obj.Placement = pl def onChanged(self,obj,prop): diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index 8eae4dbe2..b0c0062e8 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -594,10 +594,15 @@ class _Window(ArchComponent.Component): elif prop in ["Width","Height"]: if obj.Preset != 0: if obj.Base: - if prop == "Height": - obj.Base.setDatum(16,obj.Height) - elif prop == "Width": - obj.Base.setDatum(17,obj.Width) + try: + if prop == "Height": + obj.Base.setDatum(16,obj.Height) + elif prop == "Width": + obj.Base.setDatum(17,obj.Width) + except: + # restoring constraints when loading a file fails + # because of load order, but it doesn't harm... + pass FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Draft/DraftSnap.py b/src/Mod/Draft/DraftSnap.py index 6710901a8..0897012c8 100644 --- a/src/Mod/Draft/DraftSnap.py +++ b/src/Mod/Draft/DraftSnap.py @@ -323,9 +323,13 @@ class Snapper: snapArray = [self.snapToVertex(self.snapInfo)] elif Draft.getType(obj) == "Dimension": - # for dimensions we snap to their 3 points - for pt in [obj.Start,obj.End,obj.Dimline]: - snaps.append([pt,'endpoint',pt]) + # for dimensions we snap to their 2 points: + if obj.ViewObject: + if hasattr(obj.ViewObject.Proxy,"p2") and hasattr(obj.ViewObject.Proxy,"p3"): + snaps.append([obj.ViewObject.Proxy.p2,'endpoint',obj.ViewObject.Proxy.p2]) + snaps.append([obj.ViewObject.Proxy.p3,'endpoint',obj.ViewObject.Proxy.p3]) + #for pt in [obj.Start,obj.End,obj.Dimline]: + # snaps.append([pt,'endpoint',pt]) elif Draft.getType(obj) == "Mesh": # for meshes we only snap to vertices