Next: Bindings, Previous: Errors, Up: GNU LibreDWG [Contents][Index]
LibreDWG installs some binary programs to read or write DWG files.
This reads a DWG file, and optionally converts its content to some output formats: JSON, Minimal JSON, GeoJSON, DXF, DXFB (i.e. Binary DXF), SVG.
dwgread [OPTION]... DWGFILE
Options:
-v[0-9], –verbose [0-9] verbosity
-O fmt, –format fmt fmt: JSON, DXF, DXFB, minJSON, GeoJSON.
More planned formats: YAML, XML/OGR, GPX, SVG, PS.
-o outfile, –file outfile also defines the output fmt. Default: stdout
–help display this help and exit
–version output version information and exit
minJSON is minimized JSON, without whitespace.
Create a DWG from a given input file (see DXF, see Binary DXF, see JSON),
optionally via --as=rNNNN
as another version.
For now can only create r1.2-r2000 DWG files.
Create a DXF from a given input file (DWG
, see DXF, see Binary DXF, see JSON),
optionally via --as=rNNNN
as another version. Experimental.
Supports the same options as dwg2dxf
.
Converts DWG files to DXF, optionally via --as=rNNNN
as another
version, an earlier or later version, or via -m
or
--minimal
as a minimal DXF version, skipping most headers vars,
classes, tables and objects.
--binary
as a binary DXF file, with full precision, under construction.
The DXF files are created in the current directory and not overwritten, unless
the option --overwrite
or -y
is given.
Converts DXF (or Binary DXF) files to DWG, optionally via --as=rVER
as another
version, an earlier or later version.
The DWG files are created in the current directory and not overwritten, unless
the option --overwrite
or -y
is given.
This program is experimental and AutoCAD ® may fail to import it. For now can only create r1.2-r2000 DWG. The default is writing as r2000.
Read and write the DWG, optionally via --as=rNNNN
as another
version, an earlier or later version. The default is writing as r2000.
For now can only create r1.2-r2000 DWG.
Prints all layers in a DWG.
With -x
or --extnames
prints the extended displayed layer name with spaces,
not the internally stored old-style name with _
instead.
Only relevant with old r13 and r14 DWGs, after that layers are always stored in the extended format.
With -f
or --flags
also the status of frown, on/off and locked.
With --on
only the visible layers, which are on and not frozen.
You can get the same effect via this json filter:
dwgfilter '.OBJECTS[]' example.dwg | \ grep -A22 '"object": "LAYER"' | grep name
Search regex pattern in all text values in a list of DWGs. dwggrep uses PCRE.
With -i
searches case-insensitive.
With -c
prints only the count of found texts.
With -h
or --no-filename
does not print the filename.
With --type NAME
search only NAME entities or objects.
With --dxf NUM
search only in DXF group NUM fields.
With --text
searches only TEXT-like entities: TEXT, MTEXT, ATTRIB, ATTDEF.
Search and modify a single DWG file via jq
, using the powerful
JQ query expression language on a temporary json file. See man jq
.
With -i
replaces the DWG in-place. This only makes sense with an JQ expression which changes values.
Convert a DWG to a limited SVG. All paperspace or modelspace enties of type: TEXT, LINE, CIRCLE, ARC, POLYLINE_2D, LWPOLYLINE, INSERT, ELLIPSE (unrotated), SOLID, 3DFACE, RAY, XLINE.
With -m
or --mspace
all paper-space entities are
ignored, and only model-space is printed. The default is to print all
paper-space entities. But if there are none, print all model-space
entities instead.
Limitations: Many other graphical entities and some properties are still missing.
Convert a DWG to a very limited Postscript file. All paperspace and modelspace entities of type LINE, POLYLINE_2D, LWPOLYLINE, ARC and CIRCLE.
This requires installation of pslib http://pslib.sourceforge.net/doc/pslib.html.
Note that the graphical representation for PS and SVG output is severely lacking, block references (insert entities) are not yet exploded, UCS and paper space transformations per entity are not yet done.
Planned is dwgplot, via GNU Plotutils https://www.gnu.org/software/plotutils/, to replace dwg2SVG
and dwg2ps
. This supports much more bitmap and vector formats.
There are also some more examples in the source distribution:
loads a DWG and adds some entities.
converts a DWG to SVG similar to dwg2SVG, but via the dwg_api.h only. The graphical representation for PS and SVG output is severely lacking, block references (insert entities) are not yet exploded , UCS and paper space transformations per entity are not yet done.
lists the not yet reverse-engineered blobs from our examples files, and is the framework to guess the field layout for these. It is optionally using picat (http://picat-lang.org/) to solve some of the field-packing problems.
afl++ fuzzing frontend, to test and debug various fast shared-memory options for afl-clang-fast,
with the following runtime options: -indxf
, -injson
, -rw
, -dwg
, -dxf
, -dxfb
, -json
, -geojson
. All other output formats, like BMP, SVG, PS need to be fuzzed via their programs, which is the recommended way.
The now default and fastest method INMEM does not need the 2nd file argument @@
, the 2nd method STDIN neither.
See also https://github.com/LibreDWG/libredwg-fuzz for our fuzzing setup to test new fuzzing campaigns automatically and find regressions.
is the easiest way to create DWG’s (or DXF, JSON) from scratch or add entities to an existing DWG.
It accepts a very simple file with commands to create entities or objects and set its properties.
See man 1 dwgadd
and man 5 dwgadd
.
Next: Bindings, Previous: Errors, Up: GNU LibreDWG [Contents][Index]