From 885343c435a883dee7bf39022c1f47cc54c2c413 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 cf053fc4c7..2637a99dd1 100644 --- a/src/Mod/Draft/importDXF.py +++ b/src/Mod/Draft/importDXF.py @@ -993,21 +993,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 @@ -1044,16 +1045,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