The script that I'm writing repositions two data frames and sets their extents.
When doing this, it redraws the entire Active View 4 times, slowing the script substantially.
Pressing F9 or clicking the 'Pause Drawing' button before running the script disables the drawing and makes the script run much faster, but I want the script to do this automatically.
I want to disable ArcMap 10 drawing at the beginning of the script, and enable it at the end.
How do I do this?
Answer
I didn't see anything native in ArcPy. The easiest thing to do is probably send the F9 keystroke to the ArcMap window using the SendKeys module.
I tested with this syntax and it worked fine:
import SendKeys
# Send the keystroke for F9
SendKeys.SendKeys("{F9}")
The only caveat is that you may need to uncheck "Always run in foreground" on the General tab of the script properties. Otherwise the keystroke may get caught by the script progress window.
No comments:
Post a Comment