diff --git a/src/Mod/Draft/draftgeoutils/wires.py b/src/Mod/Draft/draftgeoutils/wires.py index b2296add13..45dec6d4bc 100644 --- a/src/Mod/Draft/draftgeoutils/wires.py +++ b/src/Mod/Draft/draftgeoutils/wires.py @@ -246,58 +246,9 @@ def superWire(edgeslist, closed=False): def isReallyClosed(wire): - """Check if a wire is really closed.""" - # TODO yet to find out why not use wire.isClosed() direct, - # in isReallyClosed(wire) - - # Remark out below - Found not true if a vertex is used again - # in a wire in sketch (e.g. wire with shape like 'd', 'b', 'g', ...) - # if len(wire.Edges) == len(wire.Vertexes): return True - - # Found cases where Wire[-1] are not 'last' vertexes - # e.g. Part.Wire( Part.__sortEdges__(.toShape())) - # aboveWire.isClosed() == True, but Wire[-1] are the 3rd vertex - # for the rectangle - use Edges[i].Vertexes[0/1] instead - length = len(wire.Edges) - - # Test if it is full circle / ellipse first - if length == 1: - if len(wire.Edges[0].Vertexes) == 1: - return True # This is a closed wire - full circle/ellipse - else: - # TODO Should be False if 1 edge but not single vertex, correct? - # No need to test further below. - return False - - # If more than 1 edge, further test below - e1 = wire.Edges[0] - e2 = wire.Edges[length-1] - - if DraftVecUtils.equals(e1.Vertexes[0].Point, e2.Vertexes[1].Point): - if length == 2: - return DraftVecUtils.equals(e1.Vertexes[1].Point, e2.Vertexes[0].Point) - else: - return True - - if DraftVecUtils.equals(e1.Vertexes[1].Point, e2.Vertexes[0].Point): - if length == 2: - return DraftVecUtils.equals(e1.Vertexes[0].Point, e2.Vertexes[1].Point) - else: - return True - - if DraftVecUtils.equals(e1.Vertexes[0].Point, e2.Vertexes[0].Point): - if length == 2: - return DraftVecUtils.equals(e1.Vertexes[1].Point, e2.Vertexes[1].Point) - else: - return True - - if DraftVecUtils.equals(e1.Vertexes[1].Point, e2.Vertexes[1].Point): - if length == 2: - return DraftVecUtils.equals(e1.Vertexes[0].Point, e2.Vertexes[0].Point) - else: - return True - - return False + if isinstance(wire, (Part.Wire, Part.Edge)): + return wire.isClosed() + return isinstance(wire, Part.Face) def curvetowire(obj, steps):