judyckij

ArcPy CAD Layers Iteration to GeoDataBase

Discussion created by judyckij on Aug 7, 2013
Latest reply on Aug 8, 2013 by stacyrendall
I am trying to extract an Ex-Pave layer out of a whole years worth of CAD drawings and I cannot seem to get the code to work
I was able to find the following yet have not had an success. If anyone could shed some light on the error listed below it would be greatly appreciated. Thank you

 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:\Users\jjudycki\Desktop\Vectren\130103.00 - VEDO 2014 Groups"

# 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("*.dwg", "CAD"):
    layername = fd + "_Layer"
    # Select only the Polyine features on the drawing layer EX-PAVE
    arcpy.MakeFeatureLayer_management(fd + "/Polyline", layername, "\"Layer\" = 'EX-PAVE'")
    vTab.addRow(layername)

# Merge the CAD features into one feature class
arcpy.Merge_management(vTab, "C:\Users\jjudycki\Desktop\Vectren\130103.00 - VEDO 2014 Groups\VEDO_2014_Drawings.gdb")


File "C:\Python27\ArcGIS10.1\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 322, in RunScript
    debugger.run(codeObject, __main__.__dict__, start_stepping=0)
  File "C:\Python27\ArcGIS10.1\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run
    _GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
  File "C:\Python27\ArcGIS10.1\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 655, in run
    exec cmd in globals, locals
  File "C:\Student\PythEveryone10_1\CreatingScripts\CADtoLayer.txt", line 5, in <module>
    import arcpy
TypeError: 'NoneType' object is not iterable

Outcomes