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

View File

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