python - Automating capture of Extent from multiple mxds with multiple dataframes -
i want create single shape file multiple mxd's have multiple frame sets different extents in them. have found/started python script (code below) can't figure out how write captured x&y max/min shape file created this. see output below - attribute error generated.
i want write scale , title of frame file name of mxd in extents shape file.
would appreciate in completing script.
thanks,
george
--- code start
import arcpy, os, glob path = 'p:\\2011\\job_031_townplanning_seriesproduction\\working\\mxd\\1' os.chdir(path) mxds_list = glob.glob('*.mxd') mxd2 = glob.glob('*.shp') count_mapdocs = len(mxds_list) print 'processing ' + str(count_mapdocs) + 'map documents...' #create polygon shapefile arcpy.createfeatureclass_management(path, 'extents.shp', "polygon") arcpy.createfeatureclass_management(path, 'mxds.shp', "polygon") #start loop mxd2 in mxds_list: mapdoc = arcpy.mapping.mapdocument(mxd) dataframe = arcpy.mapping.listdataframes(mapdoc,'*')[0] frameextent = dataframe.extent #frame scale framescale = dataframe.scale #frame extent extentxmax = frameextent.xmax extentxmin = frameextent.xmin extentyxax = frameextent.ymax extentymin = frameextent.ymin point_object = mxd2.shp #write in table scale #write in table
--- end code
--- output start
processing 14map documents... traceback (most recent call last): file "p:\2011\job_031_townplanning_seriesproduction\working\extent.py", line 31, in point_object = mxd2.shp attributeerror: 'str' object has no attribute 'shp'
--- end output
first define mxd2 list of .shp files, clobber using value mxds_list loop, turns mxd2 series of string values. time point_object assigned, mxd2 string object not have "shp" attribute. want "for mxd in mxds_list" compatible mapdoc assignment line follows. don't know correct assignment point_object is, if it's supposed file form mxd2 list, need way iterate through mxd2 go through mxds_list. if there 1 .shp each .mxd file, use range of integers have common index both lists.
Comments
Post a Comment