From a0868b45d890f9f695bd9133d4cccc2c9c6ec27b Mon Sep 17 00:00:00 2001 From: Antony Chan Date: Sun, 22 Feb 2026 15:20:22 -0800 Subject: [PATCH] DXF export does not support 3D/tilted circles Measure the angle between the 3D circle's normal axis `dz` and the plane representing the 2D DXF drawing. If `angle % 180 != 0`, print the user warning to the console. --- cadquery/occ_impl/exporters/dxf.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cadquery/occ_impl/exporters/dxf.py b/cadquery/occ_impl/exporters/dxf.py index 41ae15224..b806df9b2 100644 --- a/cadquery/occ_impl/exporters/dxf.py +++ b/cadquery/occ_impl/exporters/dxf.py @@ -1,5 +1,6 @@ """DXF export utilities.""" +import warnings from typing import ( Any, Dict, @@ -244,6 +245,13 @@ def _dxf_circle(edge: Edge) -> DxfEntityAttributes: direction_y = circ.YAxis().Direction() direction_z = circ.Axis().Direction() + # DXF circle does not support tilted 3D circles. + dz = gp_Dir(0, 0, 1) + if abs(RAD2DEG * direction_z.Angle(dz)) % 180 > 1e-6: + warnings.warn( + "Circle not coplanar. This will fail in the future.", + ) + dy = gp_Dir(0, 1, 0) phi = direction_y.AngleWithRef(dy, direction_z)