0

I have an input CAD file with different layers, need to convert each layer into separate feature classes.

By the code below, I am able to convert single CAD layer to feature class at a time.

Now the UI looks like this.

enter image description here

And this is the code I have so far:

import arcpy

arcpy.env.addOutputsToMap = True

arcpy.env.overwriteOutput = True


inFC = arcpy.GetParameterAsText(0)

fieldName = arcpy.GetParameterAsText(1) 

values = arcpy.GetParameterAsText(2) 

outPath = arcpy.GetParameterAsText(3)

outName = arcpy.GetParameterAsText(4) 

ws = arcpy.GetParameterAsText(5)         

outName = arcpy.ValidateFieldName(values, ws)

whereClause = """{} = '{}'""".format(arcpy.AddFieldDelimiters(inFC, fieldName), values)

arcpy.FeatureClassToFeatureClass_conversion(inFC, outPath, outName, whereClause)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy