Fixed bug in Draft upgrade

This commit is contained in:
Yorik van Havre 2012-04-05 12:59:47 -03:00
parent 55d6a85216
commit ab7c176f42

View File

@ -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