The drawing here, plan.dxf, is one AutoCAD saved as R2018. Among its entities are three ellipses, a ray, an xline and the viewport of its first layout.
C++
const auto plan = DxfIO::LoadFile("plan.dxf");if (!plan){ std::println("line {}: {}", plan.error().Line, plan.error().What); return 1;}const DxfIO::Document &drawing = plan->Document;
SaveFile writes the file and returns the issues of the save: what the release could not hold, and how it was kept or left out. An issue names the handle of the record it concerns, or none when it concerns no one record.
C++
const auto told = [](const std::vector<DxfIO::Issue> &issues){ for (const DxfIO::Issue &issue : issues) { if (issue.Record) { std::println(" {}: {}", DxfIO::Hex(issue.Record), issue.What); } else { std::println(" {}", issue.What); } }};
Options::Release picks the release. R2000 holds every entity of this drawing, but not its visual styles, whose layout changes at R2010 and again at R2013: they are left out, and what names them is cleared.
For R12 an ellipse becomes a 3D POLYLINE along its curve, and a ray or an xline a LINE cut at the drawing’s extents. The paper space viewport is left out, where AutoCAD would keep it with its settings in ACAD MVIEW extended data. R12 also keeps no objects and no layout but the one drawn in *Paper_Space, and neither loss is among the issues. Releases lists what each release lacks.
R12: 2F0: ELLIPSE drawn as POLYLINE for R12 2F1: ELLIPSE drawn as POLYLINE for R12 2F2: ELLIPSE drawn as POLYLINE for R12 2F3: RAY drawn as LINE for R12 2F4: XLINE drawn as LINE for R12 2E5: VIEWPORT left out, R12 has no such entity
Save returns the file in Saved::Bytes with its issues, instead of writing it; another overload writes to any std::ostream. Binary writes binary DXF, which AutoCAD reads as it reads ASCII.
Before R2007 a file’s text is in a code page: the drawing’s own, $DWGCODEPAGE, unless Codepage names another. A character the page lacks is written as a \U+ escape: Ø is not in ANSI 1251, the Cyrillic page. Release is R2018 unless set, whatever the drawing’s own, and R2018 writes UTF-8, so name the release too.