mxd = arcpy.mapping.MapDocument (r"T:\1_DOUGLAS_PROJECTS\A_CLIENT_PROJECTS_ARC\1_INTERNAL_CLIENTS\A_GENERAL_FUND\2_PLANNING_CDEV\C_NOTICING\MXD\ARCGIS10_DC_NOTICING_SINGLE_PARCEL.mxd") df = arcpy.mapping.ListDataFrames (mxd, "Layers")[0] arcpy.SelectLayerByAttribute_management(layer, "NEW_SELECTION", selstring) df.zoomToSelectedFeatures() mxd.dataDrivenPages.refresh()
The "layer" in the select statement is from arc.getParameterAsText(0) with data type in properties parameters set to Layer.
lyrName = arcpy.getParameterAsText(0) mxd = arcpy.mapping.MapDocument (r"T:\1_DOUGLAS_PROJECTS\......\_SINGLE_PARCEL.mxd") df = arcpy.mapping.ListDataFrames (mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, lyrName, df)[0] arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", selstring)
df.zoomToSelectedFeatures()does not do anything and the
mxd.dataDrivenPages.refresh()still throws an error message.
Hi Chad. I was going through this exact script and wanted to have it refresh data driven pages. Coincidentally, I stumbled on this post.
This worked:
ddp = mxd.dataDrivenPages #creates the object
ddp.refrech()
(he worked where I work now and I am updating his script)