I am trying to figure out how to write python code to get the user current extent from the map view. so far I have this
aprx = arcpy.mp.ArcGISProject('Current')
mp = aprx.listMaps()[0]
view = mp.defaultCamera
print(view.getExtent())
however, I have to manually hit save for the getExtent to work. is there a way to get the current extent from the Map view?
Save the script? or the project?
I have found that I could manually go to Project > Save and run the code which will give me the updated extent. However, I am trying to avoid making users do this. I know desktop I can get the user current extent from dataframes, but i can't figure it out with pro. Also, the save() method doesn't work well in the python console. it'll save the project but will not update the extent.