Accessing Dimension End Points in scripts

Hi,

I am writing a script to insert block instances at a distance from selected multiple dimension lines.

I need to determine where the arrowhead points are located. I do not find the method to access these points in rhino script syntax.

Can I access this information using Rhino Common? I am not very familiar with Rhino Common. Can somebody please show me how to do this? Thank you.

MHK.

Hi @MHK,

you can access these using Arrowhead1End and Arrowhead2End which are properties of LinearDimension geometries. Both can be found here. Below is an example, note that the points returned are 2d points in the dimension plane:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def dim_filter(rhino_object, geometry, component_index):
    return isinstance(geometry, Rhino.Geometry.LinearDimension)

def DoSomething():
    
    obj_id = rs.GetObject("Select Dimension", 512, False, False, dim_filter)
    if not obj_id: return
    
    dim_obj = rs.coercerhinoobject(obj_id, True, True)
    
    p1 = dim_obj.Geometry.Arrowhead1End
    p2 = dim_obj.Geometry.Arrowhead2End
    
    rs.AddTextDot("1", dim_obj.Geometry.Plane.PointAt(p1.X, p1.Y))
    rs.AddTextDot("2", dim_obj.Geometry.Plane.PointAt(p2.X, p2.Y))
    
DoSomething()

_
c.

2 Likes

Hi Clement,
Thank you for the reply. I have now incorporated it into my script and it is working perfectly.

I knew that I need to use Rhino common to access those properties, but I did not know how to cast the object into linear dimension object and how to access its properties. Both the arrowheadEnds and Plane.PointAt properties are very useful for me.

Have a nice day,
MHK.