Arch: Enabled ellipse-based walls - fixes #3859

This commit is contained in:
Yorik van Havre
2020-10-20 13:13:54 +02:00
parent eee68a314b
commit 87eae7c58c
2 changed files with 11 additions and 3 deletions

View File

@@ -1330,7 +1330,7 @@ class _Wall(ArchComponent.Component):
# normal of the face/sketch and the direction the
# wire was drawn in. IE: along the width direction
# of the wall.
if isinstance(e.Curve,Part.Circle):
if isinstance(e.Curve,(Part.Circle,Part.Ellipse)):
dvec = e.Vertexes[0].Point.sub(e.Curve.Center)
else:
dvec = DraftGeomUtils.vec(e).cross(normal)

View File

@@ -153,8 +153,16 @@ def offset(edge, vector, trim=False):
return Part.ArcOfCircle(curve,
edge.FirstParameter,
edge.LastParameter).toShape()
elif geomType(edge) == "Ellipse":
rad = edge.Vertexes[0].Point.sub(edge.Curve.Center)
curve = edge.Curve.copy()
if vector.getAngle(rad) < 1:
curve.MajorRadius = curve.MajorRadius+vector.Length
curve.MinorRadius = curve.MinorRadius+vector.Length
else:
return curve.toShape()
curve.MajorRadius = curve.MajorRadius-vector.Length
curve.MinorRadius = curve.MinorRadius-vector.Length
return curve.toShape()
else:
return None
@@ -280,7 +288,7 @@ def offsetWire(wire, dvec, bind=False, occ=False,
# ('legacy/backward-compatible' mode)
if not firstDir:
# need to test against Part.Circle, not Part.ArcOfCircle
if isinstance(e.Curve, Part.Circle):
if isinstance(e.Curve, (Part.Circle,Part.Ellipse)):
v0 = e.tangentAt(e.FirstParameter).cross(norm)
else:
v0 = vec(e).cross(norm)