Skip to main content
1 of 5
shade
  • 61
  • 1
  • 2

Python script to implement a batch import of CAD files into Geodatabase

Heading

Hello everyone, Please does anyone know where I can get a python script that can do a batch import of CAD files into a Geodatabase.

I have one I wrote here, but it is only able to import one CAD file at a time. It imports the CAD files and split it into feature classes and stores it in the geodatabase via the feature dataset. It works perfectly well but I need to loop the script to search through a given folder for all the cardfiles in it and import them under different feature datasets and put all the datasets into one geodatabase..

#Name: CadtoGeodatabase.py

Description: Create a feature dataset

Author: Irene

Import system modules

import arcpy from arcpy import env

Set workspace

env.workspace = "C:/data1"

Set local variables

input_cad_dataset = C:\Users\iegbulefu\Documents\info\91036c01.dwg" output_gdb_path = "c:/data/cadfile.gdb" output_dataset_name = "cadresults" reference_scale = "1500" spatial_reference = "Nad_1983_10TM"

Create a FileGDB for the fds

arcpy.CreateFileGDB_management("C:/data1", "cadfile.gdb")

Execute CreateFeaturedataset

arcpy.CreateFileGDB_management("C:/data", "cadfile.gdb") arcpy.CADToGeodatabase_conversion(input_cad_dataset, output_gdb_path, output_dataset_name, reference_scale)

shade
  • 61
  • 1
  • 2