From c01c0a2e45dccb140f613e1e7b0010b25cf5c1e3 Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Tue, 10 Oct 2023 20:56:28 +0200 Subject: [PATCH] Draft: Use DXF OCS when importing circles and arcs to Part shapes See #10985. --- src/Mod/Draft/importDXF.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Mod/Draft/importDXF.py b/src/Mod/Draft/importDXF.py index e43496f643..3f109b019e 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -992,21 +992,22 @@ def drawArc(arc, forceShape=False): ----- Use local variables, not global variables. """ - v = vec(arc.loc) + pl = placementFromDXFOCS(arc) + rad = vec(arc.radius) firstangle = round(arc.start_angle, prec()) lastangle = round(arc.end_angle, prec()) - circle = Part.Circle() - circle.Center = v - circle.Radius = vec(arc.radius) try: if (dxfCreateDraft or dxfCreateSketch) and (not forceShape): - pl = placementFromDXFOCS(arc) - return Draft.make_circle(circle.Radius, pl, face=False, + return Draft.make_circle(rad, pl, face=False, startangle=firstangle, endangle=lastangle) else: - return circle.toShape(math.radians(firstangle), - math.radians(lastangle)) + circle = Part.Circle() + circle.Radius = rad + shape = circle.toShape(math.radians(firstangle), + math.radians(lastangle)) + shape.Placement = pl + return shape except Part.OCCError: warn(arc) return None @@ -1043,16 +1044,17 @@ def drawCircle(circle, forceShape=False): ----- Use local variables, not global variables. """ - v = vec(circle.loc) - curve = Part.Circle() - curve.Radius = vec(circle.radius) - curve.Center = v + pl = placementFromDXFOCS(circle) + rad = vec(circle.radius) try: if (dxfCreateDraft or dxfCreateSketch) and (not forceShape): - pl = placementFromDXFOCS(circle) - return Draft.make_circle(circle.radius, pl) + return Draft.make_circle(rad, pl, face=False) else: - return curve.toShape() + curve = Part.Circle() + curve.Radius = rad + shape = curve.toShape() + shape.Placement = pl + return shape except Part.OCCError: warn(circle) return None