Draft: minor fix in Offset

This commit is contained in:
Yorik van Havre 2014-03-03 13:47:29 -03:00
parent 92023533b5
commit 80f2a3a8a4
2 changed files with 11 additions and 4 deletions

View File

@ -1434,6 +1434,7 @@ def offset(obj,delta,copy=False,bind=False,sym=False,occ=False):
else:
newobj = Part.Face(obj.Shape.Wires[0])
elif copy:
newobj = None
if sym: return None
if getType(obj) == "Wire":
newobj = makeWire(p)
@ -1453,13 +1454,18 @@ def offset(obj,delta,copy=False,bind=False,sym=False,occ=False):
newobj.Radius = getRadius(obj,delta)
newobj.DrawMode = obj.DrawMode
newobj.Placement = pl
elif getType(obj) == "Part":
newobj = makeWire(p)
newobj.Closed = obj.Shape.isClosed()
elif getType(obj) == "BSpline":
newobj = makeBSpline(delta)
newobj.Closed = obj.Closed
formatObject(newobj,obj)
else:
# try to offset anyway
try:
newobj = makeWire(p)
newobj.Closed = obj.Shape.isClosed()
except:
pass
if newobj:
formatObject(newobj,obj)
else:
if sym: return None
if getType(obj) == "Wire":

View File

@ -3945,6 +3945,7 @@ class Draft2Sketch(Modifier):
if (len(obj.Shape.Wires) == 1) or (len(obj.Shape.Edges) == 1):
Draft.makeSketch(obj,autoconstraints=False)
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
self.finish()