Home/ Reference/ Units & Conversion

doc.Unit = cdrMillimeter

Switch to millimetres and you can write millimetres directly instead of dividing by 25.4 everywhere. Read it back once to confirm.

Signature

doc.Unit = cdrMillimeter

Notes

Switch to millimetres and you can write millimetres directly instead of dividing by 25.4 everywhere. Read it back once to confirm.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
# switch the document to mm so you can write millimetres and skip the /25.4
doc.Unit = 6                    # 6 is the usual mm code, but read it back after setting
print("Unit code after change: ", doc.Unit)

if doc.Unit == 6:
    print("Switched to mm; from here you can write millimetres directly")
else:
    print("Wrong code; it may not be 6 in your version, adjust to what you read")

About this section: Units & Conversion

Units & Conversion — document units and conversion.

Other entries in this section