(root)/
libredwg-0.13/
examples/
dwgadd.5
DWGADD(5) User Commands DWGADD(5)

NAME
dwgadd.5 - Format of the LibreDWG dwgadd example input-file

DESCRIPTION
The dwgadd program accepts this input format to add entities and objects to a DWG file.

COMMANDS
commands start at each new line and must begin with a keyword and has optional arguments.

comments start with # and are ignored.

entities are created with the arguments as in the VBA object model AddEntity or AddObject methods.

entities are added to the model space by default, objects to the DWG or to parents objects, as e.g. with
"xrecord dictionary".

readdwg "file.dwg"
This must be the very first command. Otherwise a new, empty DWG Document is created.

readdxf "file.dxf"
This must be the very first command. Otherwise a new, empty DWG Document is created.

readjson "file.json"
This must be the very first command. Otherwise a new, empty DWG Document is created.

imperial
By default a new DWG is created as metric. There must be maximal one imperial line.

version number
Writes the output file in this version. It accepts numbers only "[0-9.]+", prefixes it with an "r", and
converts this string via "dwg_version_as("r"version)" to a "Dwg_Version_Type". It accepts only valid DWG
versions. There must be maximal one version line.

pspace
Add further entities to the paper space.

mspace
Add further entities to the model space again. This is only needed when a previous "pspace" command was used.
mspace is the default.

HEADER.field = value
Assign "VALUES" to a HEADER field. See the full documentation of valid HEADER fields.

point (3dpoint)
line (3dpoint) (3dpoint)
Create a line variable and entity. You may set all other fields via the "line.field = value" syntax. E.g.
"line.layer = "0""

ray (3dpoint) (3dpoint)
xline (3dpoint) (3dpoint)
text "text_value" (ins_pt) height
mtext (ins_pt) height "text_value"
leader num_points ((points)...) mtext type
mtext must be the immediate previous command.

attribute 8 0 "prompt" (0.0 1.0 0.0) "tag" "text"
attdef 8 0 "prompt" (0.0 1.0 0.0) "tag" "default_text"
block "name"
Starts a new block.

endblk
Ends the current block.

insert (ins_pt) "name" xscale yscale zscale rotation
minsert (ins_pt) "name" xscale yscale zscale rotation numrows numcols rowspacing colspacing
polyline_2d numpts ((2dpoints) ...)
lwpolyline numpts ((2dpoints) ...)
polyline_3d numpts ((3dpoints) ...)
arc (center) radius startangle endangle
circle (center) radius
polyline_pface 5 3 ((3dpoints)...) ((faces_4ints)...)
polyline_mesh num_m_verts num_n_verts ((3dpoints)...)
dimension_aligned (xline1_pt) (xline2_pt) (text_midpt)
dimension_ang2ln (center_pt) (xline1end_pt) (xline2end_pt) (text_midpt)
dimension_ang3pt (center_pt) (xline1_pt) (xline2_pt) (text_midpt)
dimension_diameter (chord_pt) (far_chord_pt) leader_len
dimension_ordinate (feature_location_pt) (leader_endpt) number
dimension_radius (center_pt) (chord_pt) leader_len
dimension_linear (xline1_pt) (xline2_pt) (def_pt) angle
3dface (pt1) (pt2) (pt3) [(pt4)]
solid (pt1) (pt2-2d) (pt3-2d) (pt4-2d)
trace (pt1) (pt2-2d) (pt3-2d) (pt4-2d)
shape "name" (3dpoint) scale angle
viewport "name"
ellipse (center_pt) major_axis axis_ratio
spline num_fitpts ((fitpts)...) (begin_tan_vector) (end_tan_vector)
dictionary "name" "key" handle_ref
xrecord dictionary "name"
tolerance "testtekst" (0 0 0) (0 0 1)
mlinestyle "name"
mline num_points ((points)...)
layout viewport "name" "canonical_media_name"
torus (center_pt) (normal) major_radius minor_radius
sphere (center_pt) (normal) radius
cylinder (center_pt) (normal) height major_radius minor_radius x_radius
cone (center_pt) (normal) height major_radius minor_radius x_radius
wedge (center_pt) (normal) length width height
box (center_pt) (normal) length width height
pyramid (center_pt) (normal) height sides radius topradius
layer "name"
style "name"
ltype "name"
vport "name"
view "name"
vport "name"
layout "name"
group "name"
entity.field = value
Every field of the just created entity or object can be set. See "VALUES" and the full documentation of the
available entity fields.

VALUES
Acceptable values must be formatted as:

integer
negative integers are allowed. "0xXXX" hex numbers are not accepted.

float
floats may omit the dot.

angle as float in degrees, not radians.
string in double-quotes
E.g "string" or "" for the empty string.

point as (float, float, [float])
esp. (float float) for 2dpoint

(float float float) for 3dpoint. (0 0 0) is a valid 3dpoint.

handle as "D.D.XXX"
<C[0-12]> as type "." decimal digits as size "." hexadecimal absolute ref. For relative handle codes, like
6,8,10,12 do not take the 3rd handle part asis, but use the absolute ref.

E.g. 5.1.15 for HEADER.LTYPE_BYLAYER.

0.13.0 2022-08-15 DWGADD(5)