Draft/Arch: Support for Y situations in sketches - issue #3163

This commit is contained in:
Yorik van Havre
2017-10-27 16:41:31 -02:00
parent 8d3fe21116
commit e16c152da4
3 changed files with 32 additions and 3 deletions

View File

@@ -1727,7 +1727,8 @@ def draftify(objectslist,makeblock=False,delete=True):
newobjlist = []
for obj in objectslist:
if obj.isDerivedFrom('Part::Feature'):
for w in obj.Shape.Wires:
for cluster in Part.getSortedClusters(obj.Shape.Edges):
w = Part.Wire(cluster)
if DraftGeomUtils.hasCurves(w):
if (len(w.Edges) == 1) and (DraftGeomUtils.geomType(w.Edges[0]) == "Circle"):
nobj = makeCircle(w.Edges[0])

View File

@@ -2129,6 +2129,29 @@ def rebaseWire(wire,vidx):
return Part.Wire(wire.Edges[vidx-1:] + wire.Edges[:vidx-1])
def removeSplitter(shape):
"""an alternative, shared edge-based version of Part.removeSplitter. Returns a
face or None if the operation failed"""
lut = {}
for f in shape.Faces:
for e in f.Edges:
h = e.hashCode()
if h in lut:
lut[h].append(e)
else:
lut[h] = [e]
edges = [e[0] for e in lut.values() if len(e) == 1]
try:
face = Part.Face(Part.Wire(edges))
except:
# operation failed
return None
else:
if face.isValid():
return face
return None
# circle functions *********************************************************