rs.GetObject bug

Hi there,

i’ve discovered a strange buglet when using below to prompt for a mesh object:

import rhinoscriptsyntax as rs
rh_obj = rs.GetObject("Select a mesh", 32, True, False)

it seems to allow to select (decal) mapping widget objects. It rejects the selection though but imho should not allow to select mapping widgets at all.

_
c.

rs.GetObject accepts a predicate function in custom_filter for more refined filtering:

rs.GetObject("select circle with radius of 10", rs.filter.curve, False, False, circleWithRadiusOf10GeometryFilter):

https://developer.rhino3d.com/api/RhinoScriptSyntax/#selection-GetObject

Thanks @James_Parrott, but imho this could work better.

If a user wants an explicit selection of a single object type and sets the filter for it, he should not be forced to setup a custom geometry filter to filter for the same object type. Decal widgets seem to be connected to the filter with number 268435456 which stands for Phantom objects, at least i can use rs.GetObject with this number and it allows only to select the decal widget.

Decal widgets deserve a more meaningful depiction and handling in RhinoScriptSyntax. If a user interates through all objects and a decal widget is found, query the Object type like this:

import rhinoscriptsyntax as rs
def DoSomething():
    obj_id = rs.GetObject("Select widget", 268435456, True, False)
    if obj_id: 
        print rs.ObjectType(obj_id)
DoSomething()

This prints 0 which stands for “Unknown Object” according to the help.

_
c.

Hi @clement,

Can you post a simple file that exhibits this behavior (so I can repeat here)?

Thanks,

– Dale

Hi @dale, sure. Please use below file and open it:

GetObject_MeshNotDecalWidget.3dm (148.7 KB)

To repeat what i see, please select the mesh plane and go to Properties > Decals, then click the little icon to “Show Decal Widget”, then run below script:

import rhinoscriptsyntax as rs

def DoSomething():
    obj_id = rs.GetObject("Select mesh", 32, False, False)
    if not obj_id: return
    
DoSomething()

rs.GetObject prompts for a mesh, but the decal widget can be selected.

_
c.

Hi @clement,

Thanks for this. I’ve logged the issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-70988

– Dale

1 Like