I have several CAD files (DWG) that I want converted to Feature Classes within a file GDB. Each feature class will be based on a polyline attribute "LAYER" value, so I have a query filter applied before they get loaded into the GDB.
I think my script (Python 2.7) has a problem with there being no values being written to the ValueTable. Here's the script, followed by the error message - can anyone please help?
=================================
# Description: Imports and merges polylines from one CAD workspace into a single feature class
import arcpy
from arcpy import env
env.workspace = "X:/GEMS_vector_data/DWG_files_sites_floors/0011-test"
CADgdb = "X:/GEMS_vector_data/DWG_files_sites_floors/0011-test/CADToFeatures.gdb"
# 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 + "_level"
# Select only the Polyine features for external walls
arcpy.MakeFeatureLayer_management(fd + "/Polyline", CADgdb + LayerName, "\"Layer\" = 'AR_WALL_EXT'")
vTab.addRow(LayerName)
# Merge the CAD features into one feature class
MergedFloorPlans = "X:/GEMS_vector_data/DWG_files_sites_floors/0011-test/CADToFeatures.gdb/Floors01"
arcpy.Merge_management(vTab, MergedFloorPlans)
================================
Error msg
Traceback (most recent call last): File "X:\GEMS_vector_data\DWG_files_sites_floors0011円-test\import_CAD_to_FBDB_01.py", line 26, in arcpy.Merge_management(vTab, MergedFloorPlans) File "D:\Program Files\ArcGIS\Server\arcpy\arcpy\management.py", line 3762, in Merge raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Input Datasets: Value is required Failed to execute (Merge).
1 Answer 1
I had the same problem today.It turns out that ESRI sample that you used is wrong. they used
for fd in arcpy.ListDatasets("*", "CAD"):
but "CAD" is wrong, is not a valid feature type for this tool - remove it and the script will work, or use "*.dwg".