 # LinearDimension absolute/relative references

Hi,
I try to get “Rhino.Geometry.LinearDimension” working.
I’m migrating my python code to Rhino 6.
I know annotations changed a lot but I wonder why the parameters have changed from
(plane, absoluteExt1, absoluteExt2, absoluteLinePt)
to
(plane, absoluteStartPos, relativeEndPos, relativeLinePos).
In that case shouldn’t be better to use vector for relatives values ?
Practically and conceptually, isn’t it odd to know the length of a measure before the measurement ?
(Even the python example is a bit twisted (an absolute position named “offset” ???)

Can I know goal of that change ?

Regards.

That’s fixed by https://mcneel.myjetbrains.com/youtrack/issue/RH-45282 in SR4

I made a sample code based on Cormier’s example.
I tried to clarified the mindset to adopt to understand the function based on my perspective which is in absolute coordinates.
Maybe it could help.

``````import Rhino.Geometry as g
from scriptcontext import doc
import rhinoscriptsyntax as rs
import math

#Closest point in a plane (2d result)
def cp(pl, pt):
b, u, v = pl.ClosestParameter(pt)
return g.Point2d(u, v)

#Absolute World Coord points
if aligned:
cplane = rs.ViewCPlane() #Stays in same plane
xDir = g.Vector3d(e2-e1) #Calc x and y vectors of the new aligned plane
yDir = g.Vector3d(xDir)
yDir.Rotate(math.pi/2, cplane.Normal)
ldPlane = g.Plane(e1, xDir, yDir) #1st point = origin
else:
ldPlane = rs.ViewCPlane()
ldPlane.Origin = e1 #1st point = origin

#  cp(ldPlane, e1) == g.Point2d(0,0) == origin
ld = g.LinearDimension(ldPlane, cp(ldPlane, e1), cp(ldPlane, e2), cp(ldPlane, pt))

ld.TextHeight = 35;
ld.ArrowSize = 30;