I have 2 mxd's.
mxdA and mxdB
They both show different data, but are both in the same coordinate system.
I want to be able to sync mxdB with mxdA, so that if I pan / zoom in mxdA, I can then, with a single button press, view the same extent in mxdB.
I know that this is possible using a Viewer window (where a 2nd data frame is used rather than a 2nd mxd), however there is a memory leak present where a Viewer window is used alongside an editing session with snapping turned on (NIM103256) which causes our session to crash after <1 hour of editing.
I know that another option could be to use production mapping views, but these seem to be limited to both mxd's having the same datasets, and once you have opened mxdB and linked it to a view, you are then unable to update the view file using mxdA because it is locked by mxdB. This is not practical for us as it would mean closing and re-opening mxdB many times every day (50+)
I'm hoping that there is a way using python where I can calculate the center point of the active dataframe in mxdA and then pan/zoom mxdB (which is already open) to the same location. I can then create a button as an ESRI Add-in.
Calculating the center point is simple enough
mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
# Calculate the centre X coordinate
x = (df.extent.XMax + df.extent.XMin)/2
#Calculate the centre Y coordinate
y = (df.extent.YMax + df.extent.YMin)/2
But I'm struggling with passing this center point information to mxdB to get it to pan. Is this even possible without using ArcObjects?
I am using ArcGIS (Advanced) 10.2.2
EDIT: I have seen this post, unfortunately it doesn't answer my question.
I have written some code that can be run in mxdB which will update mxdB based on the extent of mxdA. However, I need to be able to run the code in mxdA and for it to update the extent of mxdB (as mxdB is a fixed mxd, whereas the name of mxdA could change).
import arcpy
#define mxdA
mxd = arcpy.mapping.MapDocument(r"C:\Testing\Scratch\mxdA.mxd")
#define the dataframe from mxdA
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
#define mxdB
mxd2 = arcpy.mapping.MapDocument("Current")
#define the dataframe from mxdB
df2 = arcpy.mapping.ListDataFrames(mxd2,"Layers")[0]
#set 'newextent' to be the extent of the dataframe in mxdA
newextent = df.extent
#set the extent of the dataframe in mxdB to be the same as that of mxdA
df2.extent = newextent
#refresh the view in mxdB
arcpy.RefreshActiveView()