LinearDimension in Rhino Common bug in WIP?


I’m using Rhino WIP 6.0.17206.9241, 07/25/2017.
I found the LinearDimension in RhinoCommon doesn’t work in this version.
Which caused all the related functions in rhino python and grasshopper not working.
The same script will work in Rhino 5.

The created linear dimensions exist in the rhino document because if you do “SelDim” you can find them, but they are invisible nor do them have right properties (location, length… etc)


Hi @Yuheng_Ouyang,

Can you post the code that is not working for you in the Rhino WIP?


– Dale

Hi Dale,

This is a python code from:

import Rhino
import scriptcontext
import System.Guid

def AddLinearDimension2():
    origin = Rhino.Geometry.Point3d(1,1,0)
    offset = Rhino.Geometry.Point3d(11,1,0)
    pt = Rhino.Geometry.Point3d((offset.X-origin.X)/2.0,3,0)
    plane = Rhino.Geometry.Plane.WorldXY
    plane.Origin = origin

    rc, u, v = plane.ClosestParameter(origin)
    ext1 = Rhino.Geometry.Point2d(u,v)
    rc, u, v = plane.ClosestParameter(offset)
    ext2 = Rhino.Geometry.Point2d(u,v)
    rc, u, v = plane.ClosestParameter(pt)
    linePt = Rhino.Geometry.Point2d(u,v)

    dimension = Rhino.Geometry.LinearDimension(plane, ext1, ext2, linePt)
    if scriptcontext.doc.Objects.AddLinearDimension(dimension)!=System.Guid.Empty:
        return Rhino.Commands.Result.Success
    return Rhino.Commands.Result.Failure

if __name__=="__main__":

The generated dimension has properties below:

    Linear dimension (rotated)
      Measurement: 0.00000 millimeters
      Text: Plane: Origin: (1,1,0)  X: (1,0,0)  Y: (0,1,0)  Z: (0,0,1)
      First point: (1,1,0),   Second point: (-1.23432e+308,-1.23432e+308,0)
      Text point: (-6.17161e+307,-1.23432e+308,0) (Default)
      Text rotation: 0 degrees

Hi @Yuheng_Ouyang,

Dimensions is one of the area in Rhino that has been overhauled for V6. Thus, scripts that once worked ‘may’ not work yet as we are still in the process of tracking down issues.

If you are just calling into RhinoCommon, you can use the new, easy-to-use LinearDimension.Create function.

For example:

import Rhino
import scriptcontext as sc

style = sc.doc.DimStyles.Current;
plane = Rhino.Geometry.Plane.WorldXY
p0 = plane.Origin
p1 = Rhino.Geometry.Point3d(10.0, 0.0, 0.0)
p2 = Rhino.Geometry.Point3d(10.0, 5.0, 0.0)
dim = Rhino.Geometry.LinearDimension.Create(
    p0, p1, p2, 0.0)

I have reported your issue.

– Dale

Thank you Dale for the super fast response!

LinearDimension.Create works and does solve my problem.