Class TLcdDWGModelDecoder

java.lang.Object
com.luciad.format.dwg.TLcdDWGModelDecoder
All Implemented Interfaces:
ILcdDWGModelDecoder, ILcdInputStreamFactoryCapable, ILcdModelDecoder

This model decoder decodes vector data in AutoCAD's drawing format. The current implementation supports DWG/DXF versions up to R2018.

Input files

File Required Entry point Description
*.dwg/*.dxf x x Drawing file containing vector data

Supported file transfer protocols

  • This model decoder supports all transfer protocols that are supported by the inputStreamFactory of this decoder.

Model structure

  • This model decoder creates a model per DWG file.
  • All models returned by this model decoder implement ILcd2DBoundsIndexedModel.
  • The models are expose any DWG extented entries through its data model. See further for more details.

Model descriptor

  • All models returned by this model decoder have a TLcdDWGModelDescriptor. Among other information, the descriptor contains the list of DWG layers and line styles.
  • The type name of the model descriptor is the display name of this decoder.
  • The model descriptor returned by this model decoder is a TLcdDataModelDescriptor. Its data model exposes the DWG extended entities in a uniform way.

Model reference

The model reference is obtained from an ILcdModelReferenceDecoder. The default reference decoder set on this model decoder is based on all model reference decoders annotated with the LcdService annotation, and can handle If this fails, the decoder's default model reference is returned. Unless set by the user, the default model reference is null.

Model elements

  • Decoded models contain elements that all implement ILcdDWGShape.
  • All elements are ILcdDataObjects. If the element has any extended data associated with it, the data object is an "ExtendedEntitiesList" that has a property "entities" that is the list of entries.
The following DWG elements are currently supported:
DWG element typeDWG element nameDecoded object
1TEXT TLcdDWGText
2ATTRIB TLcdDWGText
4BLOCK
5ENDBLK
6SEQEND
7INSERT TLcdDWGBlock
8MINSERT TLcdDWGBlock
10VERTEX_2D ILcd2DEditablePoint
11VERTEX_3D ILcd3DEditablePoint
15POLYLINE_2D TLcdDWGPolyline2D
16POLYLINE_3D TLcdDWGPolyline2D
17ARC TLcdDWGArc
18CIRCLE TLcdDWGCircle
19LINE TLcdDWGLine
27POINT TLcdDWGPoint
28FACE_3D TLcdDWGFace3D
31SOLID TLcdDWGCompositeRing, TLcdDWGCompositeCurve, or TLcdDWGSolid
35ELLIPSE TLcdDWGEllipse
36SPLINE TLcdDWGPolyline2D
44MTEXT TLcdDWGText
45LEADER TLcdDWGPolyline2D
47MLINE TLcdDWGLine
48BLOCK_CONTROL
49BLOCK_HEADER
50LAYER_CONTROL
51LAYER TLcdDWGLayer
57LTYPE TLcdDWGLineType
77/variesLWPLINETLcdDWGPolyline2D
78/variesHATCH TLcdDWGSolid or TLcdDWGBlock
  • Hatched objects are only outlined, not filled. If a HATCH object contains a single closed path (polygon) the returned object will be a TLcdDWGSolid. If it contains more paths, the decoder will return a TLcdDWGBlock containing one TLcdDWGSolid for each path.
  • In compatibility mode, the same types of objects are created as in pre-10.1 versions and no additional extended entity data are decoded. If backward compatibility mode is off (the default), TLcdDWGCompositeRing and TLcdDWGCompositeCurve objects are created for solids, polylines and hatches containing bulges. Also, the extended entity info item types are correctly filled in and layer reference and registered application name items are decoded. You can enable backwards compatibility mode using the system property dwg.decoder.compatibility=true.

Useful settings

Sample code


 ILcdModelDecoder decoder =
   new TLcdDWGModelDecoder(new TLcdEPSGModelReferenceDecoder(),
                           new TLcdGeodeticReference(new TLcdGeodeticDatum()));

 ILcdModel model = decoder.decode("vectordata.dwg");
 

Performance tips

  • Invisible or frozen objects or layers are not decoded by default, potentially saving some memory and some processing time.

Thread safety

  • The decoding of models is not thread-safe.
  • The decoded models are thread-safe for read access.

Supported versions and specifications

  • DWG and DXF
  • Up to 2018 (including R13C3, R14, R2000, R2004, R2007, R2010, R2013 and R2018)

Known limitations

  • The current implementation does not support hatching.