You are here: FME Readers and Writers > Autodesk AutoCAD DWG/DXF Reader/Writer > Mapping File Directives > ACAD Writer Directives

ACAD Writer Directives

DATASET

The dataset into which feature data is to be written.

Required/Optional

Required

Workbench Parameter

Destination Autodesk AutoCAD DWG/DXF File

VERSION

The version of AutoCAD file to be produced. The value corresponds with the release number of the AutoCAD file that is produced.

Required/Optional

Required

Values:

Default value: Release2010

Workbench Parameter

AutoCAD Version

Example:

The example statement below instructs the AutoCAD writer to produce a release 12 AutoCAD file:

ACAD_VERSION Release12

TEMPLATEFILE

This statement specifies the name of the existing AutoCAD DXF or DWG file that contains linetype, layer, shape header, block definitions and a codepage to be copied to the destination AutoCAD file. Some AutoCAD users also refer to this as a prototype file. This is an optional parameter. If the parameter is not defined, then the output file uses the linetype defined in the mapping file along with the predefined type of CONTINUOUS which is always present in an AutoCAD drawing.

Tip:
- LINETYPE definitions found in the mapping file override any linetype definitions found in the template file.
- The template file can also be used to set the codepage of the resulting AutoCAD file.

The example below specifies that the file called c:\tmp\test.dwg contains the block, layer, shape header definitions, and linetype definitions for the output data set.

ACAD_TEMPLATEFILE c:/tmp/test.dwg

Tip: Many AutoCAD users refer to the template files as prototype files.

Required/Optional

Optional

Workbench Parameter

Template File

AUTO_CREATE_LAYERS

This statement tells the writer to create layers as needed. Normally, all layers must either be defined by _DEF lines or by the template file before they can be used. If AUTO_CREATE_LAYERS is specified as YES, then when a feature is sent to the writer with a feature type that has not previously been defined as a layer, a new layer will be created with the properties of the last _DEF line found in the mapping file.

This example sets the writer into a mode where it creates layers as needed. Each created layer has a color of 10 and a linetype of CONTINUOUS.

ACAD_AUTO_CREATE_LAYERS yes
ACAD_DEF DEFAULT									\
autocad_color	 10								\
autocad_linetype CONTINUOUS

Values: YES | NO

Default value: NO

Required/Optional

Optional

OUTPUT_DEFINED_ATTRS_ONLY

When this directive is set to YES, only those attributes defined as part of the layer definition will be stored (see the DEF directive for more details).

If this directive is set to NO, most feature attributes (except those that start with autocad) are stored.

Required/Optional

Optional

Values

YES (default) | NO

Workbench Parameter

Output Defined Attributes Only

USE_ATTRDEFS_FOR_INSERTS

Specifies whether the writer should use the attribute definitions that are found within blocks when placing inserts. If NO, then all the attributes on a feature that is passed to the writer are written as insert attributes. If YES, then only the attributes defined within the block being placed are stored as insert attributes.

Values

YES (default) | NO

Required/Optional

Optional

TRIP_HEADER_TO_SECTION

This directive is only valid when going out to DXF and tells the FME to remove the header up to the start of the specified SECTION. The name of the SECTION can be any valid autocad section. If not specified then the file is output as before.

Required/Optional

Optional

NEW_HEADER_CONTENT_FILE

DEPRECATED: Please use the TEMPLATEFILE directive instead.

This directive is only valid with the STRIP_HEADER_TO_SECTION directive above and is the name of the file that contains the new header information. The contents of this file are placed at the start of the output file replacing the contents removed by STRIP_HEADER_TO_SECTION.

Required/Optional

Optional

DEFAULT_ATTR_STORAGE

This directive specifies the default manner in which attribute data will be stored. If not specified, then the default value is external_attributes. This directive changes the default value for the autocad_attributes feature based directive. If all attributes are to be stored in a single manner, then this directive is the easiest manner in which to do this.

Note: If the string values of feature attributes to be written as insert attributes contain embedded line feed characters, then multi-line attributes will be written.

Required/Optional

Optional

Values

Workbench Parameter

Attribute Output

SUPPRESS_FONT_WARNINGS

Specifies whether to suppress warnings about unknown font metrics being encountered.

Required/Optional

Optional

Values

YES | NO (default)

Default value: NO

FONT_DIRECTORY

Specifies the directory in which all specified fonts are located. When specified, FME can calculate the font metrics, enabling it to place fonts more accurately. If not specified, then FME assumes that the full path is specified on the correlation lines via the attribute autocad_shape_filename. If this attribute is not set or it is not the full path of the font file, then FME will use the default font file called default.shx.

Required/Optional

Optional

Values

<font directory path>

SHAPE_DIRECTORY

Specifies the directory in which to look for shapes files(*.shp) from which information about SHAPE entities will be extracted for writing.

Required/Optional

Optional

Values

<shape file directory path>

Workbench Parameter

AutoCAD Shape File Directory

DEFAULT_APPLICATION

The application name that is used when writing extended entity data.

Required/Optional

Optional

Default value

ACAD

Workbench Parameter

Default Application Name

LINETYPE

The AutoCAD writer enables linetypes to be defined within the FME mapping file. This enables the user to control how output lines are to look in the destination data set. The linetype definition is of the following form:

<WriterKeyword>_LINETYPE <linetype name> 	\
autocad_textpict <picture>			\
[autocad_patternLength <pattern Length>	\
 <segment values>+ 			\
]

where:

The following example creates a linetype called dash-dot that appears as

“ __ . __ . __ . ” and so on when displayed on the screen.

ACAD_LINETYPE dash-dot 		\
	autocad_textpict DASHDOT 	\
	autocad_patternLength 1.0	\
	0.5 -0.25 0 -0.25

Required/Optional

Optional

CREATED_BLOCK_NAME_PREFIX

The names of blocks created by the writer during automatic block creation will use the value of this keyword as a prefix if specified. If not specified, the syntax will be:

<filename>_<writerkeyword>_FME_BLOCK_<blocknumber>

Required/Optional

Optional

Workbench Parameter

Created Block Name Prefix

DEF

The AutoCAD writer requires that every feature written to the AutoCAD file be stored within a predefined AutoCAD layer.

In AutoCAD, the layers are used to store collections of logically related entities, attributes, or symbology. In FME, the AutoCAD layer and the type of the feature are treated synonymously as there is a one-to-one correspondence between FME feature type and AutoCAD layer.

Layers can also be defined through the use of a TEMPLATEFILE, or through the specification of new feature types. The feature type parameters are used for the creation of new layers, but do not affect layers which are found to exist in the template file with the same name.

The order of properties in the layer statement is required as shown; however, additional attribute name and type pairs may be in any order. The layer statement is of the following form:

<WriterKeyword>_DEF  <layer name> 	       \
 	autocad_color <default color> 	        \
 	autocad_linetype <default linetype>	\
       [autocad_layer_frozen no]      \
     	[autocad_layer_hidden no]     \  
     	[autocad_layer_locked no]     \
     	[autocad_layer_on yes]        \
       [autocad_layer_desc <layer description>]

where:

The example below defines a layer called boundary in which entities are drawn using color 13 (unless otherwise specified) and a linetype called dash-dot (unless otherwise specified). The feature also has several attributes specified that will be written to the extended entity data of each feature within the layer.

ACAD_DEF boundary 	\
	autocad_color 13	\
	autocad_linetype dash-dot 	\
	FEATCODE        char(12)	\
	PPID            char(10) 	\
	DATECHNG        date 	\
	SURVEYDIST      number(8,2)

Required/Optional

Optional

AUDIT_AND_FIX (not supported in RealDWG writer)

This directive can be used to turn on/off internal auditing before the final drawing file is written out. By default it is set to YES, so auditing will be performed and any errors found will be fixed. It is recommended that you leave the auditing set to YES. If you set it to NO, it is possible that the output file may not be as per the AutoCAD file specification. As an example of how auditing fixes errors is that if there is a layer name with a space or any other invalid characters, then that layer name will be changed to something like $DDT_AUDIT_GENERATED_(3B). If auditing is turned off, then the layer name will not be changed and when it is audited in AutoCAD, it will return errors such as invalid layer names.

Required/Optional

Optional

Values

YES (default) | NO

Workbench Parameter

Audit and Fix Errors

COORDINATE_SYSTEM_STORAGE

This directive controls whether the writer will optionally store the coordinate system of its features. The coordinate system can be stored inside the output AutoCAD file as an Esri Well Known Text (in an ESRI_PRJ entry in an internal dictionary in the file), according to Esri specifications. It can also be stored externally in a companion Esri .prj file that shares the output AutoCAD file's base name, but has a .prj extension.

Required/Optional

Optional

Values

NONE | EXTERNAL_PRJ | EXTERNAL_AND_INTERNAL | INTERNAL_WKT

Default: NONE, which means projection information is not stored anywhere.

AutoCAD data files written this way with projection information will be recognized by FME and the free ArcGIS for AutoCAD application, which installs on top of the AutoCAD application.

Workbench Parameter

Coordinate System Storage

Example:

ACAD_COORDINATE_SYSTEM_STORAGE EXTERNAL_PRJ

APPEND_TO_TEMPLATEFILE

Required/Optional: Optional

This directive can be used to allow the file specified by the DATASET directive to be written as the concatenation of the full contents of the file specified by the TEMPLATEFILE directive with all written data. By default it is set to NO, so only header information but no data is used from the template file if one is specified. If this directive is set to YES then the full header and data information is used from the template file.

Values: YES | NO

Default value: NO

Workbench Parameter: Append Data to Template File

USE_BLOCK_NAME_FOR_CREATION (not supported in RealDWG writer)

The names of blocks created by the writer during automatic block creation will use the value of the autocad_block_name attribute if the attribute is present and this directive is specified.

If a template file is used during writing, the block name will be used to try to match an existing block definition in the template file. This is similar to the behavior for insert entity writing. This directive does not affect the use of the block name for insert entity writing.

If the intention is that only insert entities should be used to try to match block names with block definitions, set this directive to NO.

If not specified, the syntax may be the following, but may also be modified by the usage of the CREATED_BLOCK_NAME_PREFIX directive:

<filename>_<writerkeyword>_FME_BLOCK_<blocknumber>

Required/Optional

Optional

Values

YES | NO (Default: RealDWG writer always behaves like it has a value of YES)

Workbench Parameter

Use the block name to create blocks

PURGE

This directive can be used to turn on/off purging of unused block and layer objects before the final drawing file is written out. Unused objects are those which are not referenced by other objects in the drawing. For example, for a layer to be eligible to be purged, there must be no entities on that layer.

Required/Optional

Optional

Values

 YES | NO (default)

Workbench Parameter

Purge Unused Objects

INSERTION_SCALE_UNITS

This directive can be used to set the INSUNITS variable of the destination dataset.

When this directive is not set, the INSUNITS variable is taken from a template file if specified. The INSUNITS variable specifies the drawing units used in the scaling of inserted entities such as blocks. This setting behaves like a declaration of the type of units, but it does not change the scale or coordinates of existing entities, nor does it affect any entities to be written by the AutoCAD writer.

Required/Optional

Optional

Values

UNDEFINED | INCHES | FEET | MILES | MILLIMETERS | CENTIMETERS | METERS | KILOMETERS | MICROINCHES | MILS | YARDS | ANGSTROMS | NANOMETERS | MICRONS | DECIMETERS | DEKAMETERS | HECTOMETERS | GIGAMETERS | ASTRONOMICAL | LIGHTYEARS | PARSECS

Default Value: NONE

Workbench Parameter

Insertion Scale Units

WRITE_THUMBNAIL_IMAGE

This directive can be used to create a thumbnail image of the destination drawing model space within the destination drawing file. This may then be used as a preview by enabled applications, such as Windows Explorer.

Required/Optional

Optional

Values

YES | NO (default)

Workbench Parameter

Write Thumbnail Image

PREFER_DONUTS_AS_HATCHES

This parameter can be used to change how donut geometries on features with autocad_entity attributes not set to autocad_hatch or autocad_mpolygon, are represented as AutoCAD entities.

If this parameter is set to Yes, and a donut is planar, then it will be written as a hatch entity. Donuts with three dimensions will only be written as hatches if they have a constant Z value, which can be stored as the hatch elevation.

If a donut is not oriented in the XY plane, then the feature must have autocad_extrusion_x, autocad_extrusion_y, and autocad_extrusion_z attributes set which indicate the normal vector direction, orthogonal to the plane of the object. If not, the hatch may have Z values dropped, to force it into the XY plane.If this parameter is set to No, or a donut is not planar, or if a donut is 3D with different Z values, then that donut will be handled like a multi-area geometry, and will be written as a block.

Required/Optional

Optional

Values

YES (default) | NO

Workbench Parameter

Prefer writing donuts as hatches