CadQuery / cadquery

A python parametric CAD scripting framework based on OCCT
https://cadquery.readthedocs.io
Other
3.15k stars 289 forks source link

DXF export spline location #1263

Closed sethfischer closed 1 year ago

sethfischer commented 1 year ago

CadQuery: 2.2.0 Python: 3.9.5 ezdxf: 1.0.1 OS: Ubuntu 20.04.5


The DXF generated by the following has its splines offset. A bug appears to be in cadquery.occ_impl.exporters.dxf._dxf_spline.

"""Export text as DXF."""

import cadquery as cq
from cadquery import exporters

text = cq.Workplane().text("cQ", 5, 1)

exporters.dxf.exportDXF(text, "output.dxf")

output.dxf viewed in LibreCad 2.1.3:

cq-spline-offset

lorenzncode commented 1 year ago

I experimented with this and a transformation may be required perhaps something like the following in _dxf_spline: spline.Transform(plane.rG.wrapped.Trsf()*adaptor.Trsf())

and a similar transformation in the other dxf methods.

Testing with:

text = cq.Workplane("XZ").text("CQ", 5, 1)
cq.exporters.dxf.exportDXF(text.section(), "output.dxf")

image

adam-urbanczyk commented 1 year ago

Solved in #1267