使用 Python 将 CAD 数据导入地理数据库

此 Python 示例演示如何使用“合并”工具将同一文件夹中多个工程图文件中的 CAD 数据导入到单个要素类中。

# Name: ImportCADandMerge.py # Description: Imports and merges polylines from one workspace into a single feature class # Author: ESRI  # 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") 

相关主题


7/10/2012