DXF export: an open path of one straight segment is written as a LINE

An open path with a single straight segment was written as a two-vertex
LWPOLYLINE (POLYLINE before R14). It is now a LINE entity from its start
to its end point. A stroke with a weight in R12, R13 and R14 keeps its
polyline, since a LINE has no width. Closed paths and paths with more
than one segment are unchanged.

Part of #1299.
This commit is contained in:
dotCooCoo
2026-10-31 19:43:15 +07:00
committed by bflatastic
parent 9571ae0a46
commit 06e8d711ae
6 changed files with 89 additions and 7 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ fn selected_only_exports_the_selection_in_its_layers() {
let line = s.execute("shape.line", &json!({"x1": 0, "y1": 90, "x2": 90, "y2": 90})).unwrap()["id"].as_u64().unwrap();
s.execute("select.set", &json!({"ids": [line]})).unwrap();
let dxf = text(&s.execute("document.export", &json!({"format": "dxf", "selectedOnly": true})).unwrap());
assert_eq!(entities(&dxf), ["LWPOLYLINE"]);
assert_eq!(entities(&dxf), ["LINE"]);
assert!(dxf.contains("\n 2\nTop\n") && !dxf.contains("\n 2\nLayer 1\n"), "only the selection's layer");
s.execute("select.none", &json!({})).unwrap();
let e = s.execute("document.export", &json!({"format": "dxf", "selectedOnly": true})).unwrap_err().to_string();