A quick script to fix aligned dimensions on angled planes
Is it just me, or is doing aligned dimensions on non-XYZ planes an absolute nightmare in standard Rhino?
If you are working on a weirdly angled elements or a sloped facade, standard DimAligned usually forces you to constantly flip your CPlane just to get the text orientation right. Half the time, it flips upside down or projects onto the wrong plane entirely, and you end up spending more time managing CPlanes than actually drafting.
I got tired of the clicking, so I put together this quick Python script. It lets you pick two points on any angled surface, and instantly gives you two command-line toggles:
-
Orientation: Quickly toggle between Upright (perpendicular to your points on the XY ground plane) or Flat (facing straight up along the Z-Axis).
-
Offset: Type your exact offset distance directly in the command bar without having to eyeball your mouse placement.
The script uses a sorting rule (the lambda function) to automatically rearrange your selected points so the one furthest to the left (with the smaller X value) is always treated as the starting point. By forcing the dimension to always draw from left to right, it guarantees your text is instantly readable and never upside down, regardless of the order you clicked them.
Here is the script if you want to paste it into a macro button (! _-RunPythonScript (...)):
import rhinoscriptsyntax as rs
import Rhinopts = rs.GetPoints(True, False, “Select 2 points”)
p = [Rhino.Geometry.Point3d(pt[0], pt[1], pt[2]) for pt in pts]
p = sorted(p, key=lambda pt: (pt.X, pt.Y))gp = Rhino.Input.Custom.GetPoint()
opt_s = Rhino.Input.Custom.OptionToggle(True, “Upright”, “Flat”)
opt_o = Rhino.Input.Custom.OptionDouble(100.0)
gp.AddOptionToggle(“Orientation”, opt_s)
gp.AddOptionDouble(“Offset”, opt_o)while gp.Get() == Rhino.Input.GetResult.Option: pass
v = p[1] - p[0]
v_y = Rhino.Geometry.Vector3d(-v.Y, v.X, 0) if opt_s.CurrentValue else Rhino.Geometry.Vector3d.ZAxis
f_pl = Rhino.Geometry.Plane(p[0], v, v_y)
rs.AddLinearDimension(f_pl, p[0], p[1], p[0] + f_pl.YAxis * opt_o.CurrentValue)
Have fun with this or let me know what kind of improvements this would require in future use or expansions!
