AnsweredAssumed Answered

Multiple Data Driven Frames Using Python

Question asked by jekelly on Aug 4, 2016
Latest reply on Aug 4, 2016 by jekelly

I've been trying to write a script that can do the following:

 

Example:
-Two frames on a layout, one on top and one on the bottom
-10 data driven pages
-It would display DDP's 1, 3, 5, 7, 9 top frame and DDP's 2, 4, 6, 8, 10 on the bottom frame, for a total of 5 sheets of paper.

Below is what I have come up with so far. The script runs them one at a time instead of together. Anyone know what I am missing?

import arcpy
import time

mxd = arcpy.mapping.MapDocument("CURRENT")

#Lists all dataframes within the mxd
df1 = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
df2 = arcpy.mapping.ListDataFrames(mxd,"Layer 02")[0]
lyr = arcpy.mapping.ListLayers(mxd, "", df2)[0]
rows = arcpy.SearchCursor(lyr,"CATEGORY = 'Even'",
                          fields="Shape; Id; CATEGORY; Name",
                          sort_fields="Id A")

for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1,2):  
  mxd.dataDrivenPages.currentPageID = pageNum
  for row in rows:
    df2.extent = row.Shape.extent
    df2.scale = 2400
    arcpy.RefreshActiveView()
    time.sleep(2)
    print row.getValue("Name")
del mxd



Outcomes