I have built a simple model for a user to select a polygon, now I want have the view extent zoom to that selected feature.
I saw the above script sample and added it to the end of the model, but it would not work. After searching around the web, found another similar example that zoomed to a scaling of the selected extent, but this does not work either.
Here is the code and the error message. Any help would be greatly appreciated. Im just learning Python and am trying to figure this out on the fly.
import arcpy
mxd = ("G:\search_zoom\search_zoom.mxd")
df = (mxd, "PLSS_u1483")[0]
Layer = (mxd, "section", df)[0]
df.zoomToSelectedFeatures(layer)
df.scale = df.scale * 1.1
arcpy.RefreshActiveView()
File "G:\search_zoom\zoom2selected2.py", line 5, in <module>
df.zoomToSelectedFeatures(layer)
AttributeError: 'str' object has no attribute 'zoomToSelectedFeatures'