Start

save

#include "dxfio/save.hpp"

In DxfIO

Functions

auto Save(const Document &drawing, const Options &with = {}) -> std::expected<Saved, Failure>

Writes a drawing as the bytes of a DXF file.

auto Save(const Document &drawing, std::ostream &to, const Options &with = {}) -> std::expected<std::vector<Issue>, Failure>

Writes a drawing to a stream.

auto SaveFile(const Document &drawing, const std::filesystem::path &file, const Options &with = {}) -> std::expected<std::vector<Issue>, Failure>

Writes a drawing to a file, replacing it.

struct Options

How a drawing is written.

FieldType and defaultMeaning
ReleaseVersion{Version::R2018}The release to write. A drawing of a newer release is narrowed to it, and what it cannot hold is noted.
Codepagestd::stringThe code page for text before R2007, such as "ANSI_1252"; empty keeps the drawing's $DWGCODEPAGE. A name no code page has makes Save fail.
BinaryboolWrites binary DXF instead of ASCII.

struct Saved

A drawing written as DXF, with what the writer had to note about it.

FieldTypeMeaning
Bytesstd::stringThe bytes of the file.
Issuesstd::vector<Issue>What the release asked for could not hold, and how it was kept or left out.