I actually just answered a similar question in this post.Essentially my solution is to take the extent of the layer you want to test, convert it's extent box to a Polygon geometry object, and use the "overlaps" method of the Extent arcpy object to test if that geometry is in your dataframe extent (visible).Code Example:# Get your Feature Layer extent
layer = arcpy.mapping.Layer("Your Feature Layer")
extent = arcpy.Describe(layer).extent
# Create a Polygon object from that extent
extentArray = arcpy.Array(i for i in (extent.lowerLeft,
extent.lowerRight,
extent.upperRight,
extent.upperLeft,
extent.lowerLeft))
extentPolygon = arcpy.Polygon(extentArray, arcpy.SpatialReference(4326))
del extentArray
Now you have a Polygon Geometry object that represents the extent around the feature you want to test for visibility.All that's left now is to use the "overlaps" method of the Extent object to see if your feature layer is visible in your dataframe.# Get reference to your dataframe
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
# Whenever appropriate, test if the layerframe overlaps the extent geometry of your feature layer
if df.extent.overlaps(extentPolygon) == False:
layer.visible = False
arcpy.RefreshActiveView()
Depending how you want to implement this, you may want to use List Layers to do this with all your layers. You may also need some logic to detect whether your layers are already visible or not, but this should give you the general idea.Hope it helps!