Next: Usage, Previous: GNU LibreDWG, Up: GNU LibreDWG [Contents][Index]
LibreDWG is a free C library to read and write DWG files. The DWG file format is proprietary and was created in the 1970s for one then-emerging CAD application.
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.
LibreDWG 0.13.3 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
.
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.13.3, coverage is approximately 99%.
It can read all DWG formats from r1.2 to r2018 for 99%. The internally supported DWG revisions are identified as r1.1, r1.2, r1.3, r1.4, r2.0b, r2.0, r2.10, r2.21, r2.22, r2.4, r2.5, r2.6, r9, r9c1, r10, r11b1, r11b2, r11, r13b1, r13b2, r13, r13c3, r14, r2000b, r2000, r2000i, r2002, r2004a, r2004b, r2004c, r2004, r2007a, r2007b, r2007, r2010b, r2010, r2013b, r2013, r2018b and r2018.
Here is a list of features that are still missing:
Writing DWG formats for r2004 and later: r2007, r2010, r2013, r2018 is an
ongoing effort. You need to patch the code to enable writing to the r2004+ format.
See the work/2004
branch.
Writing to the specific r2007 format is not implemented.
We write as default in the r2000 or older formats only.
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 should be complete but is undertested.
Reading and writing pre-R13 DXF’s is work in progress. There is no support planned for the very old pre-R2.0 DXF format.
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 ARC_DIMENSION ASSOCACTION ASSOCBLENDSURFACEACTIONBODY ASSOCEXTENDSURFACEACTIONBODY ASSOCEXTRUDEDSURFACEACTIONBODY ASSOCFILLETSURFACEACTIONBODY ASSOCGEOMDEPENDENCY ASSOCLOFTEDSURFACEACTIONBODY ASSOCNETWORK ASSOCDEPENDENCY ASSOCVALUEDEPENDENCY ASSOCNETWORKSURFACEACTIONBODY ASSOCOFFSETSURFACEACTIONBODY ASSOCPATCHSURFACEACTIONBODY ASSOCPLANESURFACEACTIONBODY ASSOCREVOLVEDSURFACEACTIONBODY ASSOCTRIMSURFACEACTIONBODY BACKGROUND BLOCKLINEARPARAMETER BLOCKROTATIONPARAMETER BLOCKXYPARAMETER BLOCKVISIBILITYGRIP BLOCKVISIBILITYPARAMETER EVALUATION_GRAPH HELIX LARGE_RADIAL_DIMENSION LIGHTLIST MATERIAL MENTALRAYRENDERSETTINGS OBJECT_PTR RAPIDRTRENDERSETTINGS RENDERSETTINGS SECTION_SETTINGS SPATIAL_INDEX TABLESTYLE (works only pre-2010)
ACMECOMMANDHISTORY ACMESCOPE ACMESTATEMGR ACSH_EXTRUSION_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 EXTRUDEDSURFACE FCFOBJECTCONTEXTDATA GEOMAPIMAGE GEOPOSITIONMARKER LAYOUTPRINTCONFIG LEADEROBJECTCONTEXTDATA LOFTEDSURFACE MLEADEROBJECTCONTEXTDATA MOTIONPATH MTEXTATTRIBUTEOBJECTCONTEXTDATA MTEXTOBJECTCONTEXTDATA NAVISWORKSMODEL NAVISWORKSMODELDEF NURBSURFACE PERSUBENTMGR PLANESURFACE POINTPATH 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
ACDSRECORD ACDSSCHEMA NPOCOLLECTION RAPIDRTRENDERENVIRONMENT XREFPANELOBJECT
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
Some projects that use DWG (and specifically LibreDWG) are:
Plans are to add support for SolveSpace, LibreCAD, FreeCAD, OpenSCAD and PythonCAD.
Related libraries:
The old version (documented in Esperanto) which was forked to LibreDWG in 2009. But in the meantime it got a DXF reader.
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.
Read the r2000 DWG format. Written in C++, under the GPLv2 license.
Read and write the basic objects in most DWG and DXF formats. Written in C#, under the MIT license.
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 DWG versions and details. Which is especially important for attached links and data from third party applications: BIM, MAP, GIS, AEC, MECH, ..., for 3D solids and dynamic parametric constraints.
Next: Usage, Previous: GNU LibreDWG, Up: GNU LibreDWG [Contents][Index]