Import Cad Annotation - unable to get an ArcGIS 9.2 script to function with ArcGIS 10

945
2
02-21-2013 10:49 AM
BrentEdwards
New Contributor III
Here is a snippet from the functioning ArcGIS 9.2 script :

for item in lst_dxf_o_files:

                gp.MakeFeatureLayer_management(item + os.sep + 'Annotation', 'tmp_3rayon_lyr', "UPPER(layer) LIKE 'OFF_LO_RAY' AND UPPER(txtmemo) LIKE 'R: %,%'")
                print unicode(gp.GetMessages()).encode("iso-8859-2", "replace") + "\n"
                lst_anno_lyrs.append('tmp_3rayon_lyr')

                gp.MakeFeatureLayer_management(item + os.sep + 'Annotation', 'tmp_4pc_lyr', "UPPER(layer) = 'GRA_NM_PLA_COM' AND UPPER(txtmemo) LIKE 'PC%'")
                print unicode(gp.GetMessages()).encode("iso-8859-2", "replace") + "\n"
                lst_anno_lyrs.append('tmp_4pc_lyr')

# Process: ImportCADAnnotation
gp.ImportCADAnnotation(';'.join(lst_anno_lyrs), tmp_an, 1000, "ONE_CLASS_ONLY", "NO_MATCH", "NO_SYMBOL_REQUIRED", "STANDARD", "", "NO_AUTO_CREATE", "NO_AUTO_UPDATE")
print unicode(gp.GetMessages()).encode("iso-8859-2", "replace") + "\n"



And here is the non-functioning ArcGIS 10 version:

for item in lst_dxf_o_files:

                arcpy.MakeFeatureLayer_management(item + os.sep + 'Annotation', 'tmp_3rayon_lyr', "UPPER(layer) LIKE 'OFF_LO_RAY' AND UPPER(txtmemo) LIKE 'R: %,%'")
                print unicode(arcpy.GetMessages()).encode("iso-8859-2", "replace") + "\n"
                lst_anno_lyrs.append('tmp_3rayon_lyr')

                arcpy.MakeFeatureLayer_management(item + os.sep + 'Annotation', 'tmp_4pc_lyr', "UPPER(layer) = 'GRA_NM_PLA_COM' AND UPPER(txtmemo) LIKE 'PC%'")
                print unicode(arcpy.GetMessages()).encode("iso-8859-2", "replace") + "\n"
                lst_anno_lyrs.append('tmp_4pc_lyr')

# Process: ImportCADAnnotation
arcpy.ImportCADAnnotation_conversion(';'.join(lst_anno_lyrs), tmp_an, 1000, "ONE_CLASS_ONLY", "NO_MATCH", "NO_SYMBOL_REQUIRED", "STANDARD", "", "NO_AUTO_CREATE", "NO_AUTO_UPDATE")
print unicode(arcpy.GetMessages()).encode("iso-8859-2", "replace") + "\n"


And here are the errror messages:

GP ERRORS:
ERROR 000021: Failed to create the output annotation feature class
Failed to execute (ImportCADAnnotation).


PYTHON ERRORS:
Traceback Info:
  File "D:\workspace\Scripts\cadastre\_pour_v_\_Outils_\Scripts\Copie de 01_urb_cad_projete_chargement.py", line 78, in <module>
    arcpy.ImportCADAnnotation_conversion(';'.join(lst_anno_lyrs), tmp_an, 1000, "ONE_CLASS_ONLY", "NO_MATCH", "NO_SYMBOL_REQUIRED", "STANDARD", "", "NO_AUTO_CREATE", "NO_AUTO_UPDATE")

Error Info:
    <class 'arcgisscripting.ExecuteError'>: ERROR 000021: Failed to create the output annotation feature class
Failed to execute (ImportCADAnnotation).


I noticed that the Make Feature Layer (Data Management) documentation at both versions mentions the following limitation regarding the <in_features> parameter:

"Complex feature classes, such as annotation and dimensions, are not valid inputs to this tool."

I have also experimented with using the python list directly for the input_features parameter, but I still get the same error. The output workspace is a PGDB for the relavant version (9.2 vs. 10).

Cheers for any insight!
0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Brent,

Try replacing:

arcpy.ImportCADAnnotation(';'.join(lst_anno_lyrs), tmp_an, 1000, "ONE_CLASS_ONLY", "NO_MATCH", "NO_SYMBOL_REQUIRED", "STANDARD", "", "NO_AUTO_CREATE", "NO_AUTO_UPDATE")


with:

arcpy.ImportCADAnnotation_conversion(';'.join(lst_anno_lyrs), tmp_an, 1000, "ONE_CLASS_ONLY", "NO_MATCH", "NO_SYMBOL_REQUIRED", "STANDARD", "", "NO_AUTO_CREATE", "NO_AUTO_UPDATE")
0 Kudos
BrentEdwards
New Contributor III
Hi Brent,

Try replacing:

arcpy.ImportCADAnnotation(';'.join(lst_anno_lyrs), tmp_an, 1000, "ONE_CLASS_ONLY", "NO_MATCH", "NO_SYMBOL_REQUIRED", "STANDARD", "", "NO_AUTO_CREATE", "NO_AUTO_UPDATE")


with:

arcpy.ImportCADAnnotation_conversion(';'.join(lst_anno_lyrs), tmp_an, 1000, "ONE_CLASS_ONLY", "NO_MATCH", "NO_SYMBOL_REQUIRED", "STANDARD", "", "NO_AUTO_CREATE", "NO_AUTO_UPDATE")


Good eye. The "_conversion" is present in the actual script and it still does not work. I have corrected the post according.
0 Kudos