Draft: more consistent offset result - fixes #2027
This commit is contained in:
parent
3414ec8af1
commit
cf1c02271f
|
@ -1441,6 +1441,7 @@ def offset(obj,delta,copy=False,bind=False,sym=False,occ=False):
|
||||||
sides, the total width being the given delta length.'''
|
sides, the total width being the given delta length.'''
|
||||||
import Part, DraftGeomUtils
|
import Part, DraftGeomUtils
|
||||||
newwire = None
|
newwire = None
|
||||||
|
delete = None
|
||||||
|
|
||||||
if getType(obj) in ["Sketch","Part"]:
|
if getType(obj) in ["Sketch","Part"]:
|
||||||
copy = True
|
copy = True
|
||||||
|
@ -1503,6 +1504,8 @@ def offset(obj,delta,copy=False,bind=False,sym=False,occ=False):
|
||||||
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Offset")
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Offset")
|
||||||
newobj.Shape = DraftGeomUtils.offsetWire(obj.Shape,delta,occ=True)
|
newobj.Shape = DraftGeomUtils.offsetWire(obj.Shape,delta,occ=True)
|
||||||
formatObject(newobj,obj)
|
formatObject(newobj,obj)
|
||||||
|
if not copy:
|
||||||
|
delete = obj.Name
|
||||||
elif bind:
|
elif bind:
|
||||||
if not DraftGeomUtils.isReallyClosed(obj.Shape):
|
if not DraftGeomUtils.isReallyClosed(obj.Shape):
|
||||||
if sym:
|
if sym:
|
||||||
|
@ -1515,9 +1518,13 @@ def offset(obj,delta,copy=False,bind=False,sym=False,occ=False):
|
||||||
w2 = s2.Edges
|
w2 = s2.Edges
|
||||||
w3 = Part.Line(s1.Vertexes[0].Point,s2.Vertexes[0].Point).toShape()
|
w3 = Part.Line(s1.Vertexes[0].Point,s2.Vertexes[0].Point).toShape()
|
||||||
w4 = Part.Line(s1.Vertexes[-1].Point,s2.Vertexes[-1].Point).toShape()
|
w4 = Part.Line(s1.Vertexes[-1].Point,s2.Vertexes[-1].Point).toShape()
|
||||||
newobj = Part.Face(Part.Wire(w1+[w3]+w2+[w4]))
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Offset")
|
||||||
|
newobj.Shape = Part.Face(Part.Wire(w1+[w3]+w2+[w4]))
|
||||||
else:
|
else:
|
||||||
newobj = Part.Face(obj.Shape.Wires[0])
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Offset")
|
||||||
|
newobj.Shape = Part.Face(obj.Shape.Wires[0])
|
||||||
|
if not copy:
|
||||||
|
delete = obj.Name
|
||||||
elif copy:
|
elif copy:
|
||||||
newobj = None
|
newobj = None
|
||||||
if sym: return None
|
if sym: return None
|
||||||
|
@ -1586,6 +1593,8 @@ def offset(obj,delta,copy=False,bind=False,sym=False,occ=False):
|
||||||
select(newobj)
|
select(newobj)
|
||||||
else:
|
else:
|
||||||
select(obj)
|
select(obj)
|
||||||
|
if delete:
|
||||||
|
FreeCAD.ActiveDocument.removeObject(delete)
|
||||||
return newobj
|
return newobj
|
||||||
|
|
||||||
def draftify(objectslist,makeblock=False,delete=True):
|
def draftify(objectslist,makeblock=False,delete=True):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user