data driven pages - check if true - arcpy

519
3
Jump to solution
09-01-2013 11:40 PM
PeterMacKenzie1
New Contributor II
is there any code to check if an mxd has data driven pages activated?

e.g.

if datadrivenpages = true
   then xx
else
yy
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor
Hi Peter,

In fact there is (at least in 10.1 and 10.2, I didn't check older versions). The arcpy.mapping.MapDocument has a property "isDDPEnabled":

    import arcpy     myMXD = r'C:\Project\_LearnPython\DDPwelaan.mxd'     mxd = arcpy.mapping.MapDocument(myMXD)     if mxd.isDDPEnabled:         # do something with Data Driven Pages         pass     else:         # do something else here         pass



Links:
http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000000n000000
http://resources.arcgis.com/en/help/main/10.2/index.html#//00s30000000n000000
http://resources.arcgis.com/en/help/main/10.2/index.html#/DataDrivenPages/00s300000030000000/

View solution in original post

0 Kudos
3 Replies
XanderBakker
Esri Esteemed Contributor
Hi Peter,

In fact there is (at least in 10.1 and 10.2, I didn't check older versions). The arcpy.mapping.MapDocument has a property "isDDPEnabled":

    import arcpy     myMXD = r'C:\Project\_LearnPython\DDPwelaan.mxd'     mxd = arcpy.mapping.MapDocument(myMXD)     if mxd.isDDPEnabled:         # do something with Data Driven Pages         pass     else:         # do something else here         pass



Links:
http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000000n000000
http://resources.arcgis.com/en/help/main/10.2/index.html#//00s30000000n000000
http://resources.arcgis.com/en/help/main/10.2/index.html#/DataDrivenPages/00s300000030000000/
0 Kudos
PeterMacKenzie1
New Contributor II
Great, that worked. Thankyou!
0 Kudos
XanderBakker
Esri Esteemed Contributor
Hi Peter,

I'm glad that worked out for you. Could you click on the green check mark? See also the note below:

Did you post and someone replied with a good answer? Help the community  to find these great posts with answers by clicking the green check mark  to indicate that it has been answered for you.

Kind regards,

Xander
0 Kudos