Importing AutoCAD using python, how do I exclude frozen/off "Layers"

11-13-2014 01:46 PM
New Contributor III

I am attempting to append data from AutoCAD DWG into existing FGDB feature classes using python/arcpy.  The CAD drafter has set specific Layers to "frozen" or "off" to eliminate them from his view and I would like to keep these settings upon import.


ArcGIS reads these settings when I view the same AutoCAD file in ArcMap/ArcCatalog, however, I cannot get arcpy to respect these settings while importing the data using python.


Here is my boiled down code:

outFC = "<outGDB>\\<outFC>" inputDrawing = "<path>\\<file>.dwg" inputLayer = os.path.basename(inputDrawing) + "_layer"  arcpy.MakeFeatureLayer_management(inputDrawing,(inputLayer + _FI), desc = arcpy.Describe(inputLayer + _FI) field_info = desc.fieldInfo #this is dumb but allows me to get the field info dynamically   arcpy.MakeFeatureLayer_management(inputDrawing,inputLayer,<layer information>,"","",field_info) arcpy.SelectLayerByAttribute_management(inputLayer, "NEW_SELECTION", "NOT \"Layer\" LIKE 'S_Grid%' AND NOT \"Layer\" = '0'") # This list of exclusions is what I want to avoid  arcpy.Append_management(inputLayer, outFC, "NO_TEST") 

Has anyone done this before?

0 Kudos
0 Replies