CadQuery / CadQuery/cadquery

DXF export issue

Open
#1,767 10 comments 0 reactions 0 assignees View on GitHub
dxf
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

> My use-case has a far smaller work scope: I only need 3D-to-2D projections. Dimensions & annotation are not required. Kind of similar to #1685 except in DXF:
>
> Here is my reduced workflow:
> 1. On-demand 3rd angle projections of the same part to three separate DXF files (e.g. `top.dxf`, `left.dxf`, `front.dxf`)
> 2. Write a simple (Python/bash) script to embed the DXF files into a ISO titleblock template, e.g. [this file](https://github.com/FreeCAD/FreeCAD/blob/main/src/Mod/Drawing/Templates/A3_Landscape_ISO7200.dxf)
>
> 3. Open the output DXF in the [LibreCAD](https://librecad.org/) GUI.
> 4. Manually draw dimensions on the titleblock with command prompt or with the mouse.
>
> I managed to simulate #1685 with the following code:
> ```python
> def exportDXF3rdAngleProjection(my_part, prefix: str) -> None:
> viewpoint = {
> 'top': (0, 0, 1),
> 'left': (1, 0, 0),
> 'front': (0, 1, 0),
> }
> for name, direction in viewpoint.items():
> cq.exporters.exportDXF(
> mounting_rail.rotateAboutCenter(direction, 90),
> f"{prefix}{name}.dxf",
>
> # Note: exportDXF is missing the following parameter.
> #opt={
> # "projectionDir": direction,
> #},
> doc_units=6,
> )
> ```
>
> but the issue is `cq.exporters.exportDXF` messed up the countersunk holes:
>
> ![Image](https://github.com/user-attachments/assets/99d1aa03-4ae4-4e0a-b6b0-7db9217636b8)
>
> Question: is it a known issue in cadquery? Is there a bug report on Github that I can keep track of?

_Originally posted by @antonysigma in [#122](https://github.com/CadQuery/cadquery/issues/122#issuecomment-2657388218)_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reduced workflow with cq.exporters.exportDXF and the shown exportDXF3rdAngleProjection example. Compare the generated top, left, and front DXF files with the source part, focusing on the countersunk holes and the missing projectionDir option. Done means the projections export without the countersunk holes being distorted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.