CAD To Geodatabase (Conversion)

Summary

Reads a CAD dataset and creates feature classes of the drawing. The feature classes are written to a geodatabase feature dataset.

Usage

  • This tool creates a feature dataset in an existing geodatabase, which is added as a group layer in the map.

  • The input features must be a CAD file. The CAD file will contain all the available homogenous geometries.

  • The input parameter will accept CAD data from multiple formats (DWG, DXF, and DGN) in one operation.

  • If a DWG is used as input, it can contain additional CAD-defined feature classes that conform to the Esri Mapping Specification for CAD document. These feature classes are subsets of the original homogenous geometries with entity-linked attributes that also import to the geodatabase as feature attributes.

  • Feature class names must be unique for the entire geodatabase or the tool will fail.

  • All inputs are combined into a single output CAD dataset, which will contain the standard point, line, and polygon feature classes, in addition to any existing CAD-defined feature classes.

  • If a projection file exists for the input CAD file, it will automatically populate the Spatial Reference parameter with the projection information. If multiple CAD files are used as inputs, the Spatial Reference parameter value will be taken from the first CAD file with valid projection information.

  • If a universal projection file (esri_cad.prj) exists in the directory, its projection information will be used if a coordinate system is not defined for the first CAD file.

  • If a world file exists for the input CAD file, it will automatically perform the transformation.

  • If a universal world file (esri_cad.wld) exists in the directory, the transformation will be applied to each CAD dataset in the list that does not have a companion world file.

  • If a .dgn file has multiple models, ensure that the first model has the largest domain. This tool calculates the domain for the entire .dgn file from the first model. If this is not the case, expand the domain in the first model to be large enough so all will fit.

  • If you only need a single feature class from the CAD feature classes, use the Export Features tool.

Parameters

LabelExplanationData Type
Input CAD Datasets

The collection of CAD files that will be converted to geodatabase features.

CAD Drawing Dataset
Output Geodatabase

The geodatabase where the output feature dataset will be created. This geodatabase must already exist.

Workspace
Dataset

The name of the feature dataset that will be created.

String
Reference scale

This parameter is not needed for this tool, as CAD annotation is treated as points in ArcGIS AllSource.

Double
Spatial Reference
(Optional)

The spatial reference of the output feature dataset. To control other aspects of the spatial reference, such as the x-, y-, z-, and m-domains, resolutions, and tolerances, set the appropriate geoprocessing environments.

Spatial Reference

Derived Output

LabelExplanationData Type
Output Feature Dataset

The output geodatabase feature dataset containing the new feature classes.

Feature Dataset

arcpy.conversion.CADToGeodatabase(input_cad_datasets, out_gdb_path, out_dataset_name, reference_scale, {spatial_reference})
NameExplanationData Type
input_cad_datasets
[CAD drawing dataset,...]

The collection of CAD files that will be converted to geodatabase features.

CAD Drawing Dataset
out_gdb_path

The geodatabase where the output feature dataset will be created. This geodatabase must already exist.

Workspace
out_dataset_name

The name of the feature dataset that will be created.

String
reference_scale

This parameter is not needed for this tool, as CAD annotation is treated as points in ArcGIS AllSource.

Double
spatial_reference
(Optional)

The spatial reference of the output feature dataset. To control other aspects of the spatial reference, such as the x-, y-, z-, and m-domains, resolutions, and tolerances, set the appropriate geoprocessing environments.

Spatial Reference

Derived Output

NameExplanationData Type
out_dataset

The output geodatabase feature dataset containing the new feature classes.

Feature Dataset

Code sample

CADToGeodatabase example (stand-alone script)

The following Python script demonstrates how to use the CADToGeodatabase function in a stand-alone script.

# Name: CADtoGeodatabase.py
# Description: Create a feature dataset

# Import system modules
import arcpy

# Set workspace
arcpy.env.workspace = "C:/data"

# Set local variables
input_cad_dataset = "C:/data/City.DWG"
out_gdb_path = "C:/data/HabitatAnalysis.gdb" 
out_dataset_name = "analysisresults"
reference_scale = "1000"
spatial_reference = "NAD_1983_StatePlane_California_VI_FIPS_0406_Feet"

# Create a file geodatabase for the feature dataset
arcpy.management.CreateFileGDB("C:/data", "HabitatAnalysis.gdb")

# Run CreateFeaturedataset
arcpy.conversion.CADToGeodatabase(input_cad_dataset, out_gdb_path,
                                  out_dataset_name, reference_scale,
                                  spatial_reference)