This little script works fine in Rhino 5 from Grasshopper Python, to create a linear dimension, but it fails in Rhino 6 WIP which creates an invisible dimension that an be selected with Select All but has exactly zero size and cannot be zoomed in to with Zoom Selected. I can copy and paste the dimension created in Rhino 5 just fine into Rhino 6 WIP, or copy and paste the invisible dimension over to Rhino 5 and it's still not visible.
import Rhino
dimension = Rhino.Geometry.LinearDimension.FromPoints(StartPoint, EndPoint, OffsetPoint)
Rhino.RhinoDoc.ActiveDoc.Objects.AddLinearDimension(dimension)
This is a drag since Grasshopper style dimensions can't be baked and the various Grasshopper plugins for dimensions spit out error messages in Rhino 6 WIP. For now I've just stopped using Rhino 6 WIP for a big project.
Is an annotation default not triggering, I wonder? I can do without a Grasshopper preview and in fact like to avoid plugins at all costs in favor of Python so I can much more easily offer a Grasshopper script to a client but Grasshopper and then Python themselves are plugins for Rhino 5, whereas they are included in Rhino 6 WIP.
I don't want to rely on Rhinoscript either.
Nik Willmore
So even in Rhino 5 there is a caveat that two point dimensions only come out horizontal and I tried to modify the .Plane property of it before creating it, but that gave odd result.
So I switched, in Rhino 5, to the deeper LinearDimension command with a 45 degree rotated plane, and it ALSO LOCKS TO THE HORIZONTAL DIMENSION first, and then only rotates that. Well so much for a useful command!
Aug 11, 2017
Nik Willmore
Even in Rhino 5 with Rhinocommon scripting, dimensions DO NOT ACT LIKE YOU WANT. They seem to first (in undocumented fashion) only create an initial HORIZONTAL dimension then merely rotate it if you alter it's defining plane, but that's complex math to ever again get the extended dimension line ends back where they belong. It's as if you are required to move your geometry into horizontal position to get a measurement and then rotate the dimension back to the original rotation.
This may explain why Grasshopper's dimensions are divorced completely from Rhino ones. You can't even bake them and obtain Rhino dimensions for a layout. Architects cannot be amused by this!
Even defining a plane and then using two points that form a 45 degree angle in the Rhino XY World Plane FAILS to create the right distance, the linear distance, instead of horizontal distance, between the points!
Aug 11, 2017
Nik Willmore
The problem in general is industry wide. APIs and SDKs fail to provide enough examples with graphics. So nobody knows what buttons to push. This is dirt simple. A dimension form point A to B. But the reference guide says NOTHING about actual command structure, from a pushing buttons on a keyboard perspective, and certainly nothing at all about workflow.
HOW DO I USE PYTHON TO MAKE A LINEAR DIMENSION BETWEEN TWO POINTS THAT ARE NOT HORIZONTALLY ALIGNED?
Is it even possible to make a vertical dimension that spans two points spaced out vertically?
WHEN I TRY, I GET A ZERO WIDTH DIMENSION THAT IS HORIZONTAL.
Aug 11, 2017