Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import arcpy
- from arcpy import env
- #
- # Set the workspace
- env.workspace = arcpy.GetParameterAsText(0)
- dir = env.workspace
- #
- #
- # Local Variables
- input = arcpy.GetParameterAsText(1)
- expression = arcpy.GetParameterAsText(2)
- #
- #
- # Make a layer from the input feature class
- arcpy.MakeFeatureLayer_management(r'Database Connectionsgis_sql3.sdegis_parcels.MP.Districtsgis_parcels.MP.Library', "lib_lyr")
- #
- #
- # Within selected features, further select based on a SQL query within the script tool
- arcpy.SelectLayerByAttribute_management("lib_lyr", "SUBSET_SELECTION", expression)
- #
- #
- #
- mxd = arcpy.mapping.MapDocument (r"M:CCAO_GIS_ProjectsLibrary_DistrictsMXDLib_Test_new.mxd")
- mxd.dataDrivenPages.getPageIDFromName("LIBRARY")
- # As of now this prints only the first page
- mxd.dataDrivenPages.pageNameField.name = targetPageName
- mxd.dataDrivenPages.printPages(r"HP Color LaserJet 2600n (Copy 1)", page_range_type = "CURRENT")
- mxd.dataDrivenPages.refresh()
- del mxd
- pageName = "page1"
- mxd = arcpy.mapping.MapDocument (r"M:CCAO_GIS_ProjectsLibrary_DistrictsMXDLib_Test_new.mxd")
- pageIndex = mxd.DataDrivenPages.getPageIDFromName (pageName)
- mxd.DataDrivenPages.printPages ("HP Color LaserJet 2600n (Copy 1)", "RANGE", pageIndex)
- targetPageName = arcpy.GetParameterAsText(3)
- mxd = arcpy.mapping.MapDocument(r"M:CCAO_GIS_ProjectsLibrary_DistrictsMXDLib_Test_new.mxd")
- mxd.dataDrivenPages.getPageIDFromName(targetPageName)
- mxd.dataDrivenPages.currentPageID = targetPageID
- mxd.dataDrivenPages.printPages(r"HP Color LaserJet 2600n (Copy 1)", page_range_type = "CURRENT")
- mxd.dataDrivenPages.refresh()
- del mxd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement