ImageGear for C and C++ on Windows v19.1 - Updated
DWG
User Guide > File Formats and Compressions > File Formats > File Formats Reference > DWG
Full Name DWG (AutoDesk AutoCAD)
Format ID IG_FORMAT_DWG = 69
File Extension(s) *.dwg
Data Type Vector/CAD image
Data Encoding Binary
Color Profile Support No
Multi-Page Support No
Alpha Channel Support No
ImageGear 3D Image Support Yes
ImageGear Raster to Vector Format Conversion Support No
ImageGear Unicode Text Display Support Yes
ImageGear Platforms Support Win32, Win64, .NET, .NET64
To support the DWG format, attach the ImageGear CAD/Vector DWG, DXF Component to Core ImageGear. See Attaching Components.

ImageGear Supported Versions:

ImageGear Supported Features:

ImageGear Read Support:

ImageGear Write Support:

ImageGear Filter Control Parameters:

Filter Control Parameter Type Default Value Available Values Description
BACKCOLOR UINT 0 Any positive value This parameter sets view background color for image reading. If 0, black background color is set, otherwise white background color is set.
FONTPATH LP | CHAR "" Any string up to 262 characters Defines a path to the vector font files. Format - <Path1>;< Path2>;... .
LINEWIDTHDEF DOUBLE 0 Any positive value This parameter has been deprecated and will be removed from the public API in a future release.
PASSWORD LP | CHAR "" Any string up to 262 characters Sets password for reading encrypted files.
SHOWHIDDEN AT_BOOL FALSE TRUE, FALSE If TRUE, hidden layers are shown by default.
TRUETYPE AT_BOOL FALSE TRUE, FALSE This parameter has been deprecated and will be removed from the public API in a future release.
TTFWIDTH DOUBLE 0 Any positive value This parameter has been deprecated and will be removed from the public API in a future release.
VERSION LP | CHAR ACAD2004 ACAD12, ACAD13, ACAD14, ACAD2000, ACAD2004, ACAD2007 Used to specify version to save the file as.
WIDTH INT 512 Any positive value Defines the width of the empty DIB associated with the image after loading. DIB height is calculated using the file's scale factors. See Working with Vector Images.

Comments:

DWG, short for "DraWinG", is a CAD file format which serves as the native file format for drawings created in AutoCAD.

DWG/DXF Elements Supported for Reading

CAD Element

Supported Attributes

Imported into ImageGear as:

VIEWPORT

Center point

Width

Height

View target

View direction

Frozen layers

Non-rectangle clipping

IG_VECT_ENT_VIEWPORT entity.

LINE

Start point

End point

Draw color

Line type

Line weight

IG_VECT_ENT_EASYLINE entity.

2D Simple polyline

Vertices

Draw color

Line type

Start width

IG_VECT_ENT_POLYLINE entity.

2D Quadratic spline

Vertices

Draw color

Line type

Start width

IG_VECT_ENT_BEZIER_CURVE entity, interpolated as Bezier with degree=2.

2D Cubic spline

Vertices

Draw color

Line type

Start width

IG_VECT_ENT_BEZIER_CURVE entity, interpolated as Bezier with degree=3.

2D Fit polyline

Vertices

Draw color

Line type

Start width

IG_VECT_ENT_BEZIER_CURVE entity, interpolated as cubic B-spline.

3D Simple polyline

Vertices

Draw color

Line type

Line weight

IG_VECT_ENT_POLYLINE entity.

3D Quadratic spline

Vertices

Draw color

Line type

Line weight

IG_VECT_ENT_BEZIER_CURVE entity, interpolated as Bezier with degree=2.

3D Cubic spline

Vertices

Draw color

Line type

Line weight

IG_VECT_ENT_BEZIER_CURVE entity, interpolated as Bezier with degree=3.

Polyface mesh (if contains faces)

Draw color

Line type

Fill color

Fill type

IG_VECT_ENT_SHELL entity.

The entity contains the result of breaking the polyface into simple objects such as vertices, edges, faces, etc.

Polyface mesh (if does not contain faces)

Draw color

Line type

Line weight

Hidden vertices

IG_VECT_ENT_POLYLINE entity.

Block reference

Scale

Position

Orientation

Draw color

Fill color

Line type

Fill type

IG_VECT_ENT_INSERTION entity.

Spline

Knots

Vertices (weights are supported)

Draw color

Line type

IG_VECT_ENT_NURBS_CURVE entity.

Ellipse

Orientation

Major axe

Ratio

Start angle

End angle

Center

Draw color

Line type

Line weight

IG_VECT_ENT_ARC entity.

Solid

Points [0…3]

Draw color

Line type

Fill color

Fill type

Thickness

IG_VECT_ENT_SOLID entity.

Trace

Points [0…3]

Draw color

Line type

Fill color

Fill type

Thickness

IG_VECT_ENT_SOLID entity.

3D solid

Draw color

Line type

Fill color

Fill type

IG_VECT_ENT_SHELL entity.

The entity contains the result of breaking the polyface into simple objects such as vertices, edges, faces, etc.

Polyline (don’t confuse with 2D polyline and 3D polyline)

Vertices (Bulge attribute is supported)

Draw color

Line type

Constant width

IG_VECT_ENT_POLYLINE entity.

Hatch

Draw color

Line type

Fill color

Fill type

Gradient filling

Hatch lines

IG_VECT_ENT_FIGURE entity.

Circle

Orientation

Center

Radius

Draw color

Line type

Line weight

IG_VECT_ENT_ELLIPSE entity.

Region

Draw color

Line type

Fill color

Fill type

IG_VECT_ENT_SHELL entity.

The entity contains the result of breaking the polyface into simple objects such as vertices, edges, faces, etc.

 

 

MText

Orientation

Text color

Location

Font

Font height

Font width factor

Underlined flag

IG_VECT_ENT_BLOCK entitywith several IG_VECT_ENT_TEXT entities and IG_VECT_ENT_INSERT that references this block.

Text

Orientation

Font

Italic

Weight

Font height

Font width factor

Text color

Underlined flag

Alignment

Position

Alignment point

IG_VECT_ENT_TEXT entity.

Attribute

Orientation

Font

Italic

Weight

Font height

Font width factor

Text color

Underlined flag

Alignment

Position

Alignment point

IG_VECT_ENT_TEXT entity.

Attribute definition

Orientation

Font

Italic

Weight

Font height

Font width factor

Text color

Underlined flag

Alignment

Position

Alignment point

IG_VECT_ENT_TEXT entity.

Raster image

Units

File name

Image size

Image scale

Clip boundary

IG_VECT_ENT_RASTER entity.

Face

Vertices

Draw color

Line type

IG_VECT_ENT_POLYLINE entity.

Arc

Orientation

Center

Start angle

End angle

Radius

Draw color

Line type

Thickness

IG_VECT_ENT_ARC entity.

Dimension

Block position

Draw color

Line type

Fill color

Fill type

IG_VECT_ENT_INSERTION entity that references the existing block.

Leader

Arrow head

Vertices

Scale

Arrow head size

Reference box

Fill color

Fill type

Draw color

Line type

IG_VECT_ENT_INSERTION and IG_VECT_ENT_BLOCK with IG_VECT_ENT_POLYLINE and IG_VECT_ENT_SOLID entities inside it.

Tolerance

Location

Text

Size of the text

Draw color

Line type

Fill color

Different shape attributes of included entities

IG_VECT_ENT_INSERTION and IG_VECT_ENT_BLOCK with several entities inside it, such as IG_VECT_ENT_TEXT, IG_VECT_ENT_ELLIPSE, and so on.

Block table record

Draw color

Line type

Fill color

Fill type

IG_VECT_ENT_BLOCK entity.

Viewport table record (don’t confuse with VIEWPORT entity)

View name

View content as a block

Direction

Target point

Twist (angle)

Clip distance

Background color

HIG_VECT_VIEW object.

ImageGear Vector Entities Supported for Writing to DWG and DXF Formats

ImageGear Entity or Object

Saved as DWG/DXF Element

IG_VECT_ENT_BLOCK

Block table record.

IG_VECT_ENT_INSERTION

Block reference.

IG_VECT_ENT_EASYLINE

Line.

IG_VECT_ENT_POLYLINE

Depending on fill type and vertex count:

  • Polyline
  • Face
  • 3D Polyline
  • Hatch

    Hatch is created if non-zero fill type object is attached to the polyline and its type is one of the following:

    • IG_VECT_FP_SOLID
    • IG_VECT_FP_HATCH_BDIAGONAL
    • IG_VECT_FP_HATCH_CROSS
    • IG_VECT_FP_HATCH_DIAGCROSS
    • IG_VECT_FP_HATCH_FDIAGONAL
    • IG_VECT_FP_HATCH_HORIZONTAL
    • IG_VECT_FP_HATCH_VERTICAL
    • IG_VECT_FP_GRADIENT

IG_VECT_ENT_POLYLINEEX

3D polyline for every contour. If non-zero fill type object is attached to the polyline, then a Hatch is created as well.

IG_VECT_ENT_ELLIPSE

  • If the entity contains a draw color attribute, then Ellipse object is created.
  • If the entity references a fill type, then Hatch object is created.

IG_VECT_ENT_ARC

  • If draw color is attached to the entity, then Ellipse object is created.
  • If non-zero fill type object is attached to the entity, then Hatch object is created.

IG_VECT_ENT_TEXT

Several Text objects.

IG_VECT_ENT_BEZIER_CURVE

  • If curve flag is set to IG_VECT_NURBS_MFIT, then 2D Fit polyline;
  • If Bezier degree is 2,  then 3D Quadratic spline;
  • If Bezier degree is 3, then 3D Cubic spline.

IG_VECT_ENT_NURBS_CURVE

Spline.

IG_VECT_ENT_EASY_SURFACE

Polygon mesh.

IG_VECT_ENT_FIGURE

  • If the entity references a fill type, then hatch object is created.
  • If the entity references a line type, then internal entities are saved as Polyline objects using entity data cache.

IG_VECT_ENT_RASTER

Raster image (saved to a separate raster file and referenced from the DWG/DXF file). Filename must be specified for the raster entity. See IG_vect_raster_set_filename.

IG_VECT_ENT_VIEWPORT

Viewport (don’t confuse with Viewport table record).

IG_VECT_ENT_SHELL

If the entity contains only triangles and quadrilaterals then it is saved as polyface mesh. Otherwise, the entity is saved as line segments or region. 

IG_VECT_ENT_SOLID

Solid.

IG_VECT_ENT_GEOMETRY

If Fill type exists, then region; otherwise line segments.

HIG_VECT_VIEW

Viewport table record.