Hi folks First time poster, trying to make python do my bidding, most grateful for any assistance. EPSG:27700 import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] # oldDFextent = df.extent # while not df.extent = oldDFextent elm = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "GridRefField")[0] elm.text = 'SK' + str(((df.extent.XMax - df.extent.XMin) / 2) + df.extent.XMin)[1:3] + str(((df.extent.YMax - df.extent.YMin) / 2) + df.extent.YMin)[1:3] arcpy.RefreshActiveView() del mxd What i am trying to achieve is a text element on the layout screen which dynamically updates with the dataframe centroid. However the built-in dynamic text... <dyn type="dataFrame" name="Layers" property="center" decimalPlaces="0"/> ...doesn't allow me to manipulate the string it returns at all. I am seeking to coerce it into Ordnance Survey map sheet format... i.e. 462,697.834 390,802.021 becomes SK6290 So, i turn to python. I now have a layout view text element called 'GridRefField', which i am pushing the values i want into using arcpy.mapping. This is working perfectly, but i am having to run the code manually whenever the dataframe extent changes, whereas i want this to just sit in the background and rerun every time the dataframe extent changes a la dynamic text. How would i go about doing this? Is it doable within python or do i need to move towards coding an AddIn? Many thanks for any assistance Charles
... View more