parsonz

Export to CAD

Discussion created by parsonz on Jul 11, 2011
Latest reply on Jul 11, 2011 by parsonz
I'm fairly new to programming in python so please bear with me.  I'm trying to create a script that loops through all the layers in my TOC and exports them to a CAd file. As first I tried ListFeatureClasses but this lists the whole feature class name e.g. shape.shp, which produces an error  as it tries to export shape.shpdxf

So I then tried ListLayers but get an error 000840 the value is not a CAD drawing dataset. Any Ideas?

from arcpy import env
import os
#Set the workspace
env.workspace = "C:\data"
mxd = arcpy.mapping.MapDocument("CURRENT")
layers = arcpy.mapping.ListLayers(mxd)
for lyr in layers:
  print(lyr)
  arcpy.ExportCAD_conversion(lyr,"DWG_R2007",lyr,"Ignore_Filenames_in_Tables","Overwrite_Existing_Files")

thanks
Claire

Outcomes