doc.Unit
Document unit. Every coordinate and dimension follows it: set millimetres and 100 means 100 mm; set inches and 100 means 100 inches. Set it once at the top of the sc
Signature
doc.Unit
Notes
Document unit. Every coordinate and dimension follows it: set millimetres and 100 means 100 mm; set inches and 100 means 100 inches. Set it once at the top of the script.
Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
print("Unit code: ", doc.Unit) # usual codes: 0=inch 4=mm
# switch to mm (code 4) so coordinates need no mental maths
try:
doc.Unit = 4
print("Set to mm; page width is now: ", doc.ActivePage.SizeWidth, "mm")
except Exception as e:
print("Setting the unit failed: ", e)
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.OptimizationThe performance switch. Turning off screen redraw makes batch output s
- app.Refresh()Forces a redraw. With Optimization suppressing redraws, call this when
- 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