1.. _vector.dwg:
2
3AutoCAD DWG
4===========
5
6.. shortname:: DWG
7
8.. build_dependencies:: Open Design Alliance Teigha library
9
10OGR supports reading most versions of AutoCAD DWG when built with the
11Open Design Alliance Teigha library. DWG is an binary working format used
12for AutoCAD drawings. A reasonable effort has been made to make the OGR
13DWG driver work similarly to the OGR DXF driver which shares a common
14data model. The entire contents of the .dwg file is represented as a
15single layer named "entities".
16
17DWG files are considered to have no georeferencing information through
18OGR. Features will all have the following generic attributes:
19
20-  Layer: The name of the DXF layer. The default layer is "0".
21-  SubClasses: Where available, a list of classes to which an element
22   belongs.
23-  ExtendedEntity: Where available, extended entity attributes all
24   appended to form a single text attribute.
25-  Linetype: Where available, the line type used for this entity.
26-  EntityHandle: The hexadecimal entity handle. A sort of feature id.
27-  Text: The text of labels.
28
29A reasonable attempt is made to preserve line color, line width, text
30size and orientation via OGR feature styling information when
31translating elements. Currently no effort is made to preserve fill
32styles or complex line style attributes.
33
34The approximation of arcs, ellipses, circles and rounded polylines as
35linestrings is done by splitting the arcs into subarcs of no more than a
36threshold angle. This angle is the OGR_ARC_STEPSIZE. This defaults to
37four degrees, but may be overridden by setting the configuration
38variable OGR_ARC_STEPSIZE.
39
40DWG_INLINE_BLOCKS
41-----------------
42
43The default behavior is for block references to be expanded with the
44geometry of the block they reference. However, if the DWG_INLINE_BLOCKS
45configuration option is set to the value FALSE, then the behavior is
46different as described here.
47
48-  A new layer will be available called blocks. It will contain one or
49   more features for each block defined in the file. In addition to the
50   usual attributes, they will also have a BlockName attribute indicate
51   what block they are part of.
52-  The entities layer will have new attributes BlockName, BlockScale,
53   and BlockAngle.
54-  block referenced will populate these new fields with the
55   corresponding information (they are null for all other entities).
56-  block references will not have block geometry inlined - instead they
57   will have a point geometry for the insertion point.
58
59The intention is that with DWG_INLINE_BLOCKS disabled, the block
60references will remain as references and the original block definitions
61will be available via the blocks layer.
62
63Building
64--------
65
66See :ref:`ODA platform support <vector.oda>` for building GDAL with ODA support.