DWG was read only: Export As listed it grayed out, document.export
answered with a hint to export DXF, and a script's
AutoCADExportFileFormat.DWG, the default, threw an error.
- document.export {format: dwg}, a .dwg path, and document.exportDxf
with format: dwg write the drawing the DXF export writes, with the
same options, converted by craft-dwg in the --dwg-worker copy of the
app. Versions are 2000, 2004, 2007, 2010, 2013 and 2018; R12, R13
and R14 are refused with an error that names them. Records the DWG
writer can't write in that version are left out with a warning that
counts them by type.
- Export As lists DWG and opens DWG Options: DXF Options with the DWG
versions. A version remembered from DXF Options that DWG isn't
written as starts on 2018.
- Scripts: AutoCADExportFileFormat.DWG writes a .dwg file;
AutoCADRelease13 and 14 with DWG throw an error.
Docs: docs/mcp.md, docs/control-protocol.md, docs/file-format-parity.md,
docs/target-app-parity.md, docs/roadmap.md.
Co-authored-by: Alex-BB44 <[email protected]>
The scripting reference gives unitScaleRatio as the ratio, as a
percentage, by which the output is scaled, from 0 to 1000. exportFile
passed it to the DXF writer as drawing units per unit, so 100 wrote
the drawing 100 times too large and 1 wrote it at full size.
- The value is divided by 100 before it reaches the DXF writer, and a
value left out still writes at full size (100).
- A value below 0.0001, which the writer's smallest scale cannot
represent, throws a range error at the script instead of an error
about the DXF scale from the writer.
- docs/mcp.md describes the percentage and the default of 100.
The option was added in #9266.
dxf_widest and dxf_leftmost folded from f64::MIN and f64::MAX, so a DXF
that kept its header but lost every vertex gave an infinite product and
the unitScaleRatio and pica assertions still passed. Both now reduce the
coordinates and fail when there are none.
docs/mcp.md: a relative save or open path is resolved against the
working folder of the process that wrote or read the file.
folder() in tests/script_save_open.rs returned a PathBuf, and each test
removed its folder only on its last line, so a failed assertion or a
panicking script left the folder in the system's temporary folder. It now
returns a Workspace guard, as tests/script_print.rs does, which removes
the folder when it is dropped and clears read-only flags first when the
first removal fails (Windows does not delete a read-only file).
a_script_gate_does_not_write_over_a_read_only_file in file_access.rs made
its file writable again and removed its folder only after its last
assertion; a guard now does both when the test ends.
A new IllustratorSaveOptions left compatibility unset, so a script that
read it before setting it got undefined. It now starts at
Compatibility.ILLUSTRATOR19, the documented default, which saveAs already
accepts without changing what it writes.
When an export's linked image path was a link to the primary file that did
not exist yet, the destination check compared the link as written. The
primary was written first, the link then led to it, and the image replaced
it. The check now compares such a link by the file it leads to.
A native save keeps every artboard in its main file and reads `range` only
for the separate files of `separateArtboards`. The close check treated a
native document last saved with `range` and without `separateArtboards` as
a save of some artboards, and refused to close it although the save writes
every artboard.