DiaCraft

Guides4 of 5

Convert drawings from the command line

Use diacraft-cli convert to write an editable drawing, or diacraft-cli export to make a picture of one page. Both work without opening a window.

Make an editable copy

With diacraft-cli on your path, open a terminal in the directory containing your drawing. These examples use a file named review.vsdx. The destination extension selects the format, and the output path must differ from the input.

Terminal
$ diacraft-cli convert review.vsdx --out review.diacraft
$ diacraft-cli convert review.diacraft --out handoff.odg

The first command makes a native working copy. The second reads that copy and writes an OpenDocument drawing. Check the result after each command. A drawing conversion uses the same format rules as Save As in the window.

Export a page for sharing

Terminal
$ diacraft-cli export review.diacraft --out review.png --dpi 144
{"bytes":63748,"format":"png","height":1224,"out":"review.png","page":{"id":1,"name":"Page-1"},"skipped":[],"width":1584}
$ diacraft-cli export review.diacraft --out review.svg --page 1
{"bytes":16595,"format":"svg","height":816,"out":"review.svg","page":{"id":1,"name":"Page-1"},"skipped":[],"width":1056}

Page numbers start at 1, and the first page is the default. Use --dpi to control the size of a PNG. Choose an output name ending in .svg or .pdf for vector output.

Read the result

A successful command prints a JSON object. For a conversion, check warning_count and warnings. For an export, skipped lists features that were omitted or approximated. This is what the two conversions above printed for the drawing on the home page.

Terminal
$ diacraft-cli convert review.vsdx --out review.diacraft
{"bytes":21777,"carried":{"classes":[],"document_level":false,"macros":false,"objects":false,"signatures_stale":0},"checked":{"as_values":false,"classes":[],"done":true,"reason":null},"copied":0,"format":"diacraft","in":"vsdx","macros_dropped":0,"out":"review.diacraft","parts":null,"variant":"diacraft","warning_count":0,"warnings":[]}
$ diacraft-cli convert review.diacraft --out handoff.odg
{"bytes":13125,"carried":{"classes":["window settings","unknown parts","page data","document data"],"document_level":true,"macros":false,"objects":false,"signatures_stale":0},"checked":{"as_values":true,"classes":[{"class":"fonts","count":1,"words":"1 font is missing"},{"class":"line-ends","count":6,"words":"6 line ends differ"},{"class":"style-content","count":21,"words":"21 items differ"}],"done":true,"reason":null},"copied":null,"format":"odg","in":"diacraft","macros_dropped":0,"out":"handoff.odg","parts":null,"variant":"odg","warning_count":5,"warnings":["other","other","other","other","other"]}

Exit status 1 means the operation failed. Status 2 means the command line needs correcting. Read standard error for the reason.

StatusWhat it meansStandard error, for example
0The command did what was asked and printed its JSON object.Nothing
1The operation failed.cannot read the drawing: there is no such file
2The command line needs correcting. Nothing ran.--out must end in .png, .svg or .pdf: that says what to write

Get DiaCraft.

Linux · Windows · macOS · Browser

An engraved octopus holds a process rectangle and a decision diamond, joined by a connector.