Table of Contents

Method Write

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

Write(CadDocument, string)

Writes the drawing as a JSON document: schema, version, name, units, layouts, layers, textStyles, dimStyles, linetypes, blocks, report and entities. A drawing of one LINE from (0, 0) to (100, 0) in millimetres gives an entity {"handle":"2A","kind":"LINE","layer":"0",...,"start":[0,0],"end":[100,0]}.

public static string Write(CadDocument document, string layout)

Parameters

document CadDocument

The drawing.

layout string

The layout to write (Model for model space), or null for model space and every layout.

Returns

string

The JSON text.

Exceptions

ArgumentNullException

Thrown when the drawing is null.

ArgumentException

Thrown when the drawing has no layout of that name.

Write(CadFlatDrawing, CadDocument)

Writes a drawing already walked, as Write(CadDocument, string) does; for a caller that also builds the graph of the same walk (CadDrawingGraph) and walks once.

public static string Write(CadFlatDrawing flat, CadDocument document)

Parameters

flat CadFlatDrawing

The walk.

document CadDocument

The drawing the walk was made of.

Returns

string

The JSON text.

Exceptions

ArgumentNullException

Thrown when the drawing or the walk is null.