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 <SPAN class="operator token">=</SPAN> mxd<SPAN class="punctuation token">.</SPAN>dataDrivenPages <SPAN class="comment token">#creates the object</SPAN> ddp<SPAN class="punctuation token">.</SPAN>refrech<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
(he worked where I work now and I am updating his script)
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)
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()
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.