Next: , Previous: , Up: Top   [Contents][Index]


1 Overview

LibreDWG is a free C library to read and write DWG files. The DWG file format was created in the 1970s for the then-emerging CAD applications.

This library is part of the GNU project, released under the aegis of GNU. It is made available under GPLv3+, i.e., under the terms of the GNU General Public License version 3, or (at your option) any later version.

It came out of code from the QCad Community Edition product from Ribbonsoft.

1.1 API/ABI version

LibreDWG 0.11 provides the API/ABI version 1. We hope that this doesn’t need to change much in the future.

See include/dwg.h for LIBREDWG_VERSION_MAJOR, LIBREDWG_VERSION_MINOR and LIBREDWG_SO_VERSION.

1.2 Coverage

Because the DWG file format is not open, its specification had to be reverse-engineered. The specification is almost complete. The LibreDWG implementation of the specification is an ongoing process; as of version 0.11, coverage is approximately 99%.

It can read the formats R13, R14, R2000, R2004, R2007, R2010, R2013 and R2018 for 99%. R11 and earlier cannot be read yet, only partially. Reading R11 and earlier is only enabled with the development git checkout, not the released tarball.

Here is a list of features that are still missing.

Reading pre-R13 DWG

Reading DWG formats for pre-R13 and some R2010+ non-graphical objects is an ongoing effort, some minor parts are missing. Most DWG’s can be read, some undocumented classes are skipped.

Writing pre-R13 and R2004+ DWG

Writing DWG formats for R2004 and later: R2007, R2010, R2013, R2018 is an ongoing effort and not yet implemented. We write as default in the R2000 format only.

Reading binary DXF

DXF support is now mostly implemented. ASCII DXF’s are generated fully, with much more elements and fields and other free libraries, but AutoCAD fails to import some of them. See the TODO file for a detailed coverage report.

Reading binary DXF is still under construction, done about 80%.

Enabled entities and objects, but unstable, undertested. Field names may change:

For a detailed overview see the file src/classes.inc or src/classes.c.

ACSH_BREP_CLASS ACSH_CHAMFER_CLASS ACSH_CONE_CLASS ACSH_PYRAMID_CLASS ACSH_TORUS_CLASS ARC_DIMENSION ASSOCACTION ASSOCBLENDSURFACEACTIONBODY ASSOCEXTENDSURFACEACTIONBODY ASSOCEXTRUDEDSURFACEACTIONBODY ASSOCFILLETSURFACEACTIONBODY ASSOCGEOMDEPENDENCY ASSOCLOFTEDSURFACEACTIONBODY ASSOCNETWORK ASSOCDEPENDENCY ASSOCVALUEDEPENDENCY ASSOCNETWORKSURFACEACTIONBODY ASSOCOFFSETSURFACEACTIONBODY ASSOCPATCHSURFACEACTIONBODY ASSOCPLANESURFACEACTIONBODY ASSOCREVOLVEDSURFACEACTIONBODY ASSOCTRIMSURFACEACTIONBODY BACKGROUND BLOCKLINEARPARAMETER BLOCKROTATIONPARAMETER BLOCKXYPARAMETER BLOCKVISIBILITYGRIP BLOCKVISIBILITYPARAMETER HELIX LARGE_RADIAL_DIMENSION LIGHTLIST MATERIAL MENTALRAYRENDERSETTINGS OBJECT_PTR RAPIDRTRENDERSETTINGS RENDERSETTINGS SECTION_SETTINGS SPATIAL_INDEX SUN TABLESTYLE (works only pre-2010)

Unhandled (fields spec’ed, but broken/undertested):

ACMECOMMANDHISTORY ACMESCOPE ACMESTATEMGR ACSH_EXTRUSION_CLASS ACSH_HISTORY_CLASS ACSH_LOFT_CLASS ACSH_REVOLVE_CLASS ACSH_SWEEP_CLASS ALDIMOBJECTCONTEXTDATA ANNOTSCALEOBJECTCONTEXTDATA ASSOC2DCONSTRAINTGROUP ASSOCACTION ASSOCALIGNEDDIMACTIONBODY ASSOCEXTRUDEDSURFACEACTIONBODY ASSOCGEOMDEPENDENCY ASSOCLOFTEDSURFACEACTIONBODY ASSOCNETWORK ASSOCOSNAPPOINTREFACTIONPARAM ASSOCOSNAPPOINTREFACTIONPARAM ASSOCPERSSUBENTMANAGER ASSOCREVOLVEDSURFACEACTIONBODY ASSOCVERTEXACTIONPARAM ATEXT BLKREFOBJECTCONTEXTDATA CONTEXTDATAMANAGER CSACDOCUMENTOPTIONS CURVEPATH DATALINK DATATABLE DIMASSOC DYNAMICBLOCKPROXYNODE EVALUATION_GRAPH EXTRUDEDSURFACE FCFOBJECTCONTEXTDATA GEOMAPIMAGE GEOPOSITIONMARKER LAYOUTPRINTCONFIG LEADEROBJECTCONTEXTDATA LOFTEDSURFACE MLEADEROBJECTCONTEXTDATA MOTIONPATH MTEXTATTRIBUTEOBJECTCONTEXTDATA MTEXTOBJECTCONTEXTDATA NAVISWORKSMODEL NAVISWORKSMODELDEF NURBSURFACE PERSUBENTMGR PLANESURFACE POINTPATH RENDERENVIRONMENT RENDERENTRY RENDERGLOBAL REVOLVEDSURFACE RTEXT SUNSTUDY SWEPTSURFACE TABLE (works only pre-2010) TABLECONTENT TEXTOBJECTCONTEXTDATA TVDEVICEPROPERTIES

ASSOCDIMDEPENDENCYBODY BLOCKPARAMDEPENDENCYBODY ALIGNMENTPARAMETERENTITY BASEPOINTPARAMETERENTITY FLIPPARAMETERENTITY LINEARPARAMETERENTITY POINTPARAMETERENTITY ROTATIONPARAMETERENTITY VISIBILITYPARAMETERENTITY VISIBILITYGRIPENTITY XYPARAMETERENTITY BLOCKALIGNEDCONSTRAINTPARAMETER BLOCKANGULARCONSTRAINTPARAMETER BLOCKARRAYACTION BLOCKDIAMETRICCONSTRAINTPARAMETER BLOCKHORIZONTALCONSTRAINTPARAMETER BLOCKLINEARCONSTRAINTPARAMETER BLOCKLOOKUPACTION BLOCKLOOKUPPARAMETER BLOCKPOINTPARAMETER BLOCKPOLARGRIP BLOCKPOLARPARAMETER BLOCKPOLARSTRETCHACTION BLOCKPROPERTIESTABLE BLOCKPROPERTIESTABLEGRIP BLOCKRADIALCONSTRAINTPARAMETER BLOCKREPRESENTATION BLOCKSTRETCHACTION BLOCKUSERPARAMETER BLOCKVERTICALCONSTRAINTPARAMETER BLOCKXYGRIP POINTCLOUD POINTCLOUDEX POINTCLOUDDEF POINTCLOUDDEFEX POINTCLOUDDEF_REACTOR POINTCLOUDDEF_REACTOR_EX POINTCLOUDCOLORMAP

See src/classes.inc.

Missing:

* PROXY subentities, PROXY_ENTITY

Halfway:

SUNSTUDY VBA_PROJECT ASSOCACTION ASSOCNETWORK ASSOCALIGNEDDIMACTIONBODY ASSOCOSNAPPOINTREFACTIONPARAM ASSOCPERSSUBENTMANAGER PERSUBENTMGR ASSOC2DCONSTRAINTGROUP EVALUATION_GRAPH ASSOCOSNAPPOINTREFACTIONPARAM ACSH_BOX_CLASS ACSH_EXTRUSION_CLASS ACSH_HISTORY_CLASS ACSH_SWEEP_CLASS NAVISWORKSMODEL (i.e. COORDINATION MODEL) NAVISWORKSMODELDEF DATATABLE TABLESTYLE ASSOCGEOMDEPENDENCY LAYOUTPRINTCONFIG RENDERENVIRONMENT RENDERGLOBAL LIGHTLIST SECTION_SETTINGS

Unhandled (i.e. passed through, no DXF and fields):

ACDSRECORD ACDSSCHEMA NPOCOLLECTION RAPIDRTRENDERENVIRONMENT XREFPANELOBJECT

no test coverage for entities:

I.e. we need an extended example_2018.dwg with all types, with the following missing entities:

ARCALIGNEDTEXT BODY CAMERA DIMENSION_ANG3PT DIMENSION_DIAMETER DIMENSION_RADIUS DGNUNDERLAY DWFUNDERLAY GEOPOSITIONMARKER IMAGE LEADER LONG_TRANSACTION MESH MINSERT OLE2FRAME OLEFRAME POLYLINE_2D POLYLINE_MESH PROXY_ENTITY PROXY_LWPOLYLINE SHAPE TOLERANCE VERTEX_2D VERTEX_MESH

and objects:

CSACDOCUMENTOPTIONS XREFPANELOBJECT IDBUFFER IMAGEDEF IMAGEDEF_REACTOR LAYER_INDEX LIGHTLIST NPOCOLLECTION OBJECT_PTR PLOTSETTINGS PROXY_OBJECT RASTERVARIABLES SPATIAL_INDEX UCS VBA_PROJECT

1.3 Related projects

Some projects that use DWG (and specifically LibreDWG) are:

FreeCAD

https://freecadweb.org/

GRASS GIS

http://grass.osgeo.org/

Plans are to add support for SolveSpace, OpenSCAD and PythonCAD.

Related libraries:

libdwg

The old version (documented in Esperanto) which was forked to LibreDWG in 2009. But in the meantime it got a DXF reader.

libdxfrw

Read the DWG format for all versions r13+ but with much less elements, only those needed for DXF. Written in C++, under the GPLv2 license.

libopencad

Read the R2000 DWG format. Written in C++, under the GPLv2 license.

OpenDWG

The OpenDWG’s license does not allow the usage in free software projects.

Compared to libdwg, libdxfrw and libopencad, LibreDWG can read and write much more details. Which is especially important for attached links and data from third party applications: BIM, MAP, GIS, AEC, MECH, ... and for 3D solids and dynamic parametric constraints.


Next: , Previous: , Up: Top   [Contents][Index]