Bug in custom_filter with extrusion objects

If I am using a custom filter for a solid object, accepting extrusion objects must be explicitly programmed. Open a new file and make a box or other extrusion object. Do not preselect the object at first. Then run:

import rhinoscriptsyntax as rs
def solid_filt(rhino_object, geometry, component_index):
    return geometry.IsSolid
    
msg="Select a solid object"
obj=rs.GetObject(msg, 8+16, preselect=True, custom_filter=solid_filt)
if obj: print "Object selected"
else: print "Nothing selected"

You will not be able to post-select the extrusion based box. If you convert it to a polysurface, you can. Also, paradoxically, if you preselect the extrusion, it passes!

Now, if you add the extrusion object explicitly to the main selection filter, it works.

import rhinoscriptsyntax as rs
def solid_filt(rhino_object, geometry, component_index):
    return geometry.IsSolid
    
msg="Select a solid object"
obj=rs.GetObject(msg, 8+16+1073741824, preselect=True, custom_filter=solid_filt)
if obj: print "Object selected"
else: print "Nothing selected"

Pre- or post- selecting an extrusion object with just the basic surface+polysurface filter (8+16) also works if there is no custom_filter…

–Mitch

Your first sample does seem a little goofy and doesn’t work like I would expect. I’ll put it on someone’s list to evalate.

If I were doing this - selecting solids - I’d do something like this:

from Rhino import *
from Rhino.Commands import *
from Rhino.Geometry import *
from Rhino.DocObjects import *
from Rhino.Input.Custom import *

def test():
    go = GetObject()
    go.SetCommandPrompt("Select solids")
    go.GeometryFilter = ObjectType.Surface | ObjectType.PolysrfFilter
    go.GeometryAttributeFilter = GeometryAttributeFilter.ClosedSurface | GeometryAttributeFilter.ClosedPolysrf
    go.GetMultiple(1, 0)
    if go.CommandResult() == Result.Success:
        print "Objects selected"