I have an old script tool that I'm migrating to ArcGIS Pro. The tool only has two parameters (Subbasin: string, Directory: folder) and it is supposed export a PDF mapbook of the features for the subbasin number entered.
I wrote the code and tested it in the Python console window in Pro. It works fine. I have exported >20 mapbooks.
I configured it as a script tool and two things happen:
- Whatever subbasin is entered, the resulting section set for mapsheets is always the selection set that was desired on the previous run of the tool—seriously weird!
- The PDF export file is never created. The exportToPDF function seems to run, but no file is generated and no exception is thrown.
The logic is as follows:
- Check the map for the required layers
- Apply the definition query for the desired subbasin
- Perform selections to get the desired mapsheet grid
- Select inspection results for the desired subbasin
- Select mapsheets for previously selected inspection results
- Apply definition query to based on mapsheet selection
- Get selection set for mapsheet
- Use selection set to make query string for definition query.
- Apply definition query to Inspection Mapsheets layer
- Change Layout text elements
- Refresh map series
- Export map series as PDF
I added the mapbook derived output the last time i tried to get it to work.
