ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Using Python to load CAD data

You can use Python scripts to load CAD data into a geodatabase. This Python sample demonstrates how to load polylines from multiple CAD drawings into a single feature class using the Merge tool.

# Name: ImportCADandMerge.py
# Description: Imports and merges polylines from one workspace into a single feature class

# Import system modules
import arcpy 
from arcpy import env

env.workspace = "c:/data/columbia"

# Create a value table that will hold the input feature classes for Merge
vTab = arcpy.ValueTable()

# Step through each dataset in the list
for fd in arcpy.ListDatasets("*", "CAD"):
    layername = fd + "_Layer"
    # Select only the Polyine features on the drawing layer b-railroad
    arcpy.MakeFeatureLayer_management(fd + "/Polyline", layername, "\"Layer\" = 'B-RAILROAD'")
    vTab.addRow(layername)

# Merge the CAD features into one feature class
arcpy.Merge_management(vTab, "c:/data/columbia/Columbia.gdb/Railroads")

Related Topics

  • Using the Merge tool
  • Essential Python vocabulary
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal