app.Optimization
The performance switch. Turning off screen redraw makes batch output several times faster. Turn it back on afterwards or you'll think CorelDRAW has hung.
Signature
app.Optimization
Notes
The performance switch. Turning off screen redraw makes batch output several times faster. Turn it back on afterwards or you'll think CorelDRAW has hung.
Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
import time
print("Optimisation was: ", app.Optimization)
app.Optimization = True # disable redraw to go fast
t0 = time.time()
shapes = app.ActiveSelectionRange
for i in range(1, shapes.Count + 1):
shapes.Item(i).Fill.ApplyUniformFill(app.CreateRGBColor(0, 133, 205))
app.Optimization = False # re-enable redraw
print("Processed ", shapes.Count, " object(s) in ", round(time.time() - t0, 2), "s")
About this section: View & Performance
View & Performance — display and performance switches.
- This section has 6 entries; this is one of them.
- See the full section index: View & Performance
Other entries in this section
- app.Refresh()Forces a redraw. With Optimization suppressing redraws, call this when
- doc.UnitDocument unit. Every coordinate and dimension follows it: set millimet
- doc.DirtyWhether the file has unsaved changes. This is what decides whether you
- doc.CreateView() / doc.ViewsOpens a new view window on the document. Useful for watching the whole
- doc.Rulers / doc.GridRulers and the grid object. Reading the grid settings in a script prev