import arcpy rows = arcpy.UpdateCursor(targetLayer) trm = textToRemove trp = textToReplace for row in rows: if row.TextString is not None: if "tr" in row.TextString: row.setValue('TextString',row.TextString.replace(trm, trp)) rows.updateRow(row) del row, rows
I'm having the same question today. I love the idea of find/replace for text elements in an MXD, but it appears that those annotations that are apart of a dataframe annotation group are not exposed to python. Can anyone at ESRI confirm this? I have about a 100 "4"s that need to be "7"s right now...I think we would like something like...for elm in arcpy.mapping.ListDataframeElements(mxd, "TEXT_ELEMENT"): if "Y4" in elm.text: print elm.text
for elm in arcpy.mapping.ListDataframeElements(mxd, "TEXT_ELEMENT"): if "Y4" in elm.text: print elm.text
that's exactly what I tried doing. Very disappointing, now I need to sort out how to make text elements on the fly and populate them with the data from several fields. ArcObjects it is then.. pain in my ass, oh well.. Thank you for confirming my frustrations. Cheers!
Looking like a 'no' to me. I added an element name to a piece of annotation, but I still wasn't able to access it. I tried adding a normal text element into the map and wasn't able to access that either, so at least part of it might be that they're embedded in the dataframe space instead of the layout space.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.