Following up with the Scripting In Rhino Python series of articles, here is a useful snippet of code that automates switching units on a Rhino document.
This script basically switches the units of the current document between meters and millimeters. The important function is rs.UnitSystem(), which returns the current unit measure — or sets it if we give parameters to the function.
import rhinoscriptsyntax as rs
if rs.UnitSystem() == 2:
# Current unit is mm, Switch to m
rs.UnitSystem(4, False, True)
else:
# Current unit is m, switch to mm
rs.UnitSystem(2, False, True)
This article is part of a series of posts about efficient architectural methods, workflows and tools, titled Getting Architecture Done.
If you want to be notified when any other articles of the same series are posted, go ahead an subscribe here.