Python を使用した CAD データの読み込み

Python スクリプトを使用して、CAD データをジオデータベースに読み込めます。以下の Python サンプルは、[マージ(Merge)] ツールを使用して、複数の CAD ドローイングから単一のフィーチャクラスにポリラインを読み込む方法を示しています。

# 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")

関連トピック

5/10/2014