Export Current View as DXF includes shown sketches (#3708) (#3780)

* claim: #3708

* Export Current View as DXF includes shown sketches (#3708)

The view export refused a design with only a sketch and left shown
sketches out when bodies were present. It now draws the sketches the
viewport shows (profile curves only: no construction geometry, points,
dimensions or constraints) on a SKETCH layer, one entity per curve.
Finished sketches are hidden behind bodies through the body-edge
occlusion; the active sketch is drawn on top, as in the viewport.
Sketch points use the same projection, budgets and cancellation.

The export is refused only when there is neither a visible body nor a
shown sketch curve; the dialog and the command share that check
(cmd::view_dxf_exportable).

---------

Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
raykholo
2026-10-21 23:09:57 +00:00
committed by GitHub
parent b289dc2421
commit ba4f7864ff
34 changed files with 313 additions and 62 deletions
+13 -4
View File
@@ -21,10 +21,19 @@ that atomic write starts, it finishes; a late Cancel reports the completed save.
The drawing uses the camera when Export is pressed, including roll, the world's up axis
and perspective. Only shown bodies are exported, at their current component/occurrence
placements. Hidden bodies neither draw nor hide other bodies. The complete projected
geometry is exported, including geometry beyond the viewport's edges. Grid, sketches,
dimensions, selection highlights and other overlays are excluded. Turn off section analysis
geometry is exported, including geometry beyond the viewport's edges. Grid, dimensions,
constraints, selection highlights and other overlays are excluded. Turn off section analysis
before exporting.
Sketches the viewport shows are exported too, so a design with only a sketch can be
exported. Only profile curves are included: drawn curves, text outlines and drawn 3D-sketch
curves; construction geometry, centerlines, projected references and points are not. Sketch
curves go on their own `SKETCH` layer, each curve as one `LINE` or `LWPOLYLINE` (arcs,
circles and splines as straight segments at the curve tolerance). Finished sketches are
hidden behind bodies like body edges (dashed on `HIDDEN` when hidden edges are exported); the
sketch being edited is drawn on top, as in the viewport. The export is refused only when
there is neither a shown body nor a shown sketch curve.
Coordinates are 2D, Z=0, in millimetres. Orthographic views retain 1:1 dimensions in the
view plane. Perspective views retain foreshortening, projected onto the plane through the
camera target; they are intended for illustrations rather than dimensioned fabrication.
@@ -33,8 +42,8 @@ model-space chord tolerance of 0.01 mm. The setting accepts 0.0001–1 mm; small
produce finer curves and generally need more time and memory. This is not an exact analytic
curve export or a tolerance guarantee for the original imported surfaces.
The AutoCAD 2000 ASCII DXF contains `VISIBLE` (continuous) and, when requested, `HIDDEN`
(2 mm dashes / 1 mm gaps) layers. Hidden curves use connected `LWPOLYLINE` entities with
The AutoCAD 2000 ASCII DXF contains `VISIBLE` (continuous), `SKETCH` (when a sketch is
shown) and, when requested, `HIDDEN` (2 mm dashes / 1 mm gaps) layers. Hidden curves use connected `LWPOLYLINE` entities with
continuous linetype generation so the pattern does not restart on each chord. The pattern
is embedded in the file. The polyline flags follow the
[Autodesk DXF reference](https://help.autodesk.com/cloudhelp/2017/ENU/AutoCAD-DXF/files/GUID-748FC305-F3F2-4F74-825A-61F04D757A50.htm).