From a8c5acbeaa3f57b8b22cc14f008b579fd3ed9783 Mon Sep 17 00:00:00 2001 From: paullee0 Date: Thu, 20 Jun 2019 07:04:52 +0800 Subject: [PATCH] Fix offsetWire() to treat wire with 1 edge (circle e.g) correctly (no need to connect()) --- src/Mod/Draft/DraftGeomUtils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Draft/DraftGeomUtils.py b/src/Mod/Draft/DraftGeomUtils.py index c41f210421..9a1ba5ddc7 100644 --- a/src/Mod/Draft/DraftGeomUtils.py +++ b/src/Mod/Draft/DraftGeomUtils.py @@ -1178,6 +1178,7 @@ def offsetWire(wire,dvec,bind=False,occ=False): the wire. If bind is True (and the shape is open), the original wire and the offsetted one are bound by 2 edges, forming a face. ''' + edges = wire.Edges # Seems has repeatedly sortEdges, remark out here - edges = Part.__sortEdges__(wire.Edges) norm = getNormal(wire) closed = isReallyClosed(wire) @@ -1218,7 +1219,12 @@ def offsetWire(wire,dvec,bind=False,occ=False): if not nedge: return None nedges.append(nedge) - nedges = connect(nedges,closed) + + if len(edges) >1: + nedges = connect(nedges,closed) + else: + nedges = Part.Wire(nedges[0]) + if bind and not closed: e1 = Part.LineSegment(edges[0].Vertexes[0].Point,nedges[0].Vertexes[0].Point).toShape() e2 = Part.LineSegment(edges[-1].Vertexes[-1].Point,nedges[-1].Vertexes[-1].Point).toShape()