From eacf3a6b989f2b5b305cc8909ffabef0476148d4 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 20 Oct 2020 13:13:54 +0200 Subject: [PATCH] Arch: Enabled ellipse-based walls - fixes #3859 --- src/Mod/Arch/ArchWall.py | 2 +- src/Mod/Draft/draftgeoutils/offsets.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index ef6fbce67f..f63eb347f0 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -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) diff --git a/src/Mod/Draft/draftgeoutils/offsets.py b/src/Mod/Draft/draftgeoutils/offsets.py index e931e33b9f..a7ba52ff1c 100644 --- a/src/Mod/Draft/draftgeoutils/offsets.py +++ b/src/Mod/Draft/draftgeoutils/offsets.py @@ -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)