Thank you Xander for taking the time to look at this issue. Just also want to clarify: the original arcpy cursors, e.g. arcpy.UpdateCursor(), work just fine with annotation. FYI, they are not as fast as the new Data Access cursors, but are quite a bit faster than using the tool arcpy.CalculateField_management(). I've had the pleasure of timing all the above :rolleyes:Best regards,Adam
import arcpy fc = r'C:\Project\_Forums\anno\anno.gdb\linesAnno' fields = ('FontSize') with arcpy.da.UpdateCursor(fc, fields) as cursor: for row in cursor: row[0] = 20 cursor.updateRow(row) del row
import arcpy fc = r'C:\Project\_Forums\anno\anno.gdb\linesAnno' fldFontSize = 'FontSize' arcpy.CalculateField_management(fc,fldFontSize,"30","PYTHON_9.3")
import arcpy fc = arcpy.GetParameterAsText(0) fields = ('FontSize') with arcpy.da.UpdateCursor(fc, fields) as cursor: for row in cursor: row[0] = 24
Could you explain to me what you mean with "CVD"?
arcpy.AddField_management(TaxMapAnno,"VertAlign2","SHORT","","","","","","","VerticalAlignment") arcpy.AddField_management(TaxMapAnno,"HorzAlign2","SHORT","","","","","","","HorizontalAlignment") rows = arcpy.UpdateCursor(TaxMapAnno) for row in rows: row.VERTALIGN2 = row.VERTICALALIGNMENT row.HORZALIGN2 = row.HORIZONTALALIGNMENT rows.updateRow(row) # Delete row and rows to remove lock on data del row del rows
Basically my code is the same as yours except that I usedcursor = arcpy.da.UpdateCursor(fc, fields)instead ofwith arcpy.da.UpdateCursor(fc, fields) as cursor:Would that make a difference?
Also, I should point out that the field I am working with is a CVD.
fields = ["HorizontalAlignment", "VerticalAlignment", "HorzAlign2", "VertAlign2"] with arcpy.da.UpdateCursor(fc, fields) as cursor: for row in cursor: row[0]= row[2] row[1] = row[3] cursor.updateRow(row) del row
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.