diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py index 59c4e16d1..56f311433 100644 --- a/src/Mod/Draft/Draft.py +++ b/src/Mod/Draft/Draft.py @@ -293,7 +293,7 @@ def formatObject(target,origin=None): else: matchrep = origin.ViewObject for p in matchrep.PropertiesList: - if not p in ["DisplayMode","BoundingBox","Proxy","RootNode"]: + if not p in ["DisplayMode","BoundingBox","Proxy","RootNode","Visibility"]: if p in obrep.PropertiesList: val = getattr(matchrep,p) setattr(obrep,p,val) @@ -747,15 +747,29 @@ def fuse(object1,object2): coplanar, a special Draft Wire is used, otherwise we use a standard Part fuse.''' from draftlibs import fcgeo - if fcgeo.isCoplanar(object1.Shape.fuse(object2.Shape).Faces): + import Part + # testing if we have holes: + holes = False + fshape = object1.Shape.fuse(object2.Shape) + for f in fshape.Faces: + if len(f.Wires) > 1: + holes = True + if fcgeo.isCoplanar(object1.Shape.fuse(object2.Shape).Faces) and not holes: obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Fusion") _Wire(obj) if gui: _ViewProviderWire(obj.ViewObject) + obj.Base = object1 + obj.Tool = object2 + elif holes: + # temporary hack, since Part::Fuse objects don't remove splitters + fshape = fshape.removeSplitter() + obj = FreeCAD.ActiveDocument.addObject("Part::Feature","Fusion") + obj.Shape = fshape else: obj = FreeCAD.ActiveDocument.addObject("Part::Fuse","Fusion") - obj.Base = object1 - obj.Tool = object2 + obj.Base = object1 + obj.Tool = object2 if gui: object1.ViewObject.Visibility = False object2.ViewObject.Visibility = False