Select / Pick Object in a detail within a layout

Hi all,

I am using following code (LayerDot) to label (tag) the objects with textdots using layernames. As the code is used mostly on layout view, i need help for select/pick object in a detail within a layout view.

Thank you in advance

import Rhino
import rhinoscriptsyntax as rs

def LayerDot():
while True:
rs.Command(“_Cplane _View”)
object = rs.GetObjectEx(“Select part to label”, 0, False )
if object is None: return
layer = rs.ObjectLayer(object[0])
if layer is None: return
colour = rs.ObjectColor(object[0])
point1 = rs.AddPoint(object[3])
if object[3]:
layerName = layer.split(“::”)[-1]
if not point2: return
if layerName:
dot = rs.AddTextDot(layerName, point2)
rs.TextDotHeight(dot, height=10)
line = rs.AddLine(point1,point2)
my_group = rs.AddGroup()
objs = [dot, point1, line]
rs.AddObjectsToGroup(objs, my_group)
rs.ObjectColor(point1, (170,5,5))
rs.ObjectLayer(point1, layer)
rs.ObjectColor(line, (170,5,5))
rs.ObjectLayer(line, layer)
rs.ObjectColor(dot, (170,5,5))
rs.ObjectLayer(dot, layer)
rs.ObjectPrintWidth(objs, 0.2)

Hi @yigit,

below is an example function which returns the Rhino object and selection point. I’ve used the attached example file for testing.

You can get all required information (layer, layername, object id) from the returned rhino object. (1.8 KB)

ExampleFile.3dm (91.7 KB)


1 Like

Hi @clement,

Your script work just fine.

The idea behind the InactiveDetailPickEnabled is to enable picking objects in inactive details while a layout view is active. The original purpose for this was to pick model geometry when creating dimensions in a layout.

Hope this helps.

– Dale


Hi @dale, thanks for testing. In my initial post, i had 2 details which where overlapping. After i’ve found out that this broke the picker, i’ve edited my post.

In case this is useful to anyone, try to avoid selecting the detail object itself, it might result in an invalid pick point from the WorldToPageTransform.


Thank you so much…It worked great !!

Hi Clement,

Thank you for your support.
Could you help me? i can select the object only by picking any edge (or visible vertex, surface isocurve etc) of the object. Most of my detail views are in shaded / rendered mode and would like also to pick any point (indicated with X) of the object. See example below;

I modified the part (DoSomething) of the code to create Leader instead of TextDot. I believe that is more effective…

And here the code; (1.7 KB)

Hi @yigit, that seems to be a limitation of InactiveDetailPickEnabled to which i don’t know a solution. Maybe @dale can tune the object getter to allow selecting also on shaded areas instead of edges and isocurves. Alternatively, you can bump up isocurve density before labeling and then turn them back when finished.

btw. you can change line 43 to see the leader line when picking:

point2 = rs.GetPoint("Text location", pick_pt)


Hi Dale,

Could you help me about my final request?


Hi @yigit, there is also a workaround if you prompt for the object using my GetObjectEx picker and then prompt for the first and second point using just rs.GetPoint. This way you can pick the object from an inactive detail view (by clicking on an edge) and ignore pick_pt


Been learning some scripting from @clement so figured I’d share an iteration of this script for those who don’t script at all yet: These give the Object Name and the Object Layer in the TextDot, respectively. (Clement, feel free to make anything cleaner/better :nerd_face:) (1.7 KB) (1.8 KB)

I’ll be making one for Leaders (diff option than the Dot), as well.

Hi @Alan_Farkas

I’ve already made one for object Names. Check it if it works for you.
Don’t actually remember who’s I based on. :flushed: (1.3 KB)

1 Like

Thanks, @Screamer it works!

1 Like

Altho - I tried my hand at tweaking it so I could draw a Leader as I normally would, with the Pickpoint at the object, one coming off at an angle, and the final termination point coming off horizontally for the Text. Not working great yet. I’m happy to research, but figured I’d share what I tweaked (Lines 31-33)

Before I paste that here, I’ll mention that I think the best scenario is to be able to just run the ol’ standard Leader annotation, where you can see the Leader lines and pickpoints as you draw them, but have it use the target object’s name as the text.

def annotation_name():

    go = Rhino.Input.Custom.GetObject()
    go.SetCommandPrompt("Select object to annotate:")
    go.InactiveDetailPickEnabled = True
    rc = go.Get()
    if rc == Rhino.Input.GetResult.Object:
        objref = go.Object(0)
       # restrict to pick selection, prevent window selection
        if objref.SelectionMethod()!= Rhino.DocObjects.SelectionMethod.MousePick:
            print "Selection should be performed by picking"
        obj = objref.Object()
        name = rs.ObjectName(obj.Id)
        name1 = "%<ObjectName(" + "'" + obj.Id.ToString() + "'" + ")>%"
        pickPt = objref.SelectionPoint()

        if not pickPt: return
        detail_sn = objref.SelectionViewDetailSerialNumber()
        if detail_sn > 0:
            detail = sc.doc.Objects.Find(detail_sn)
            if isinstance(detail, Rhino.DocObjects.DetailViewObject):
        point2 = rs.GetPoint("", pickPt)
        if not point2: return
        point3 = rs.GetPoint("Text location", pickPt)
        if not point3: return
        pts.extend([pickPt, point2, point3])
        leader = rs.AddLeader(pts, text=name1)
        # Rhino.Geometry.Leader.LeaderHasLanding(leader) = True

if __name__ == '__main__':


There is an issue by selecting objects on DetailView. The command “go.InactiveDetailPickEnabled” does not allow you to pick the object where you click just (Yellow Cross) on a shaded surface / face / polysurface etc

… See example pls…

Maybe works with Isocurves on in detail display…?