draw any single face surface in rhino and run this with python:
import rhinoscriptsyntax as rs
rs.GetObjects(“Select objects”, 16)
The selection filter is set to
16 which refers to Polysurfaces. Why is it still possible to select a single face surface?
Looking at __FiterHelper in selection.py it’s obvious that 16 will filter Breps thus not excluding Surfaces
If you use 2097152 as filter, it works as expected.
geometry_filter = Rhino.DocObjects.ObjectType.None
if filter & 1:
geometry_filter |= Rhino.DocObjects.ObjectType.Point
if filter & 16384:
geometry_filter |= Rhino.DocObjects.ObjectType.Grip
if filter & 2:
geometry_filter |= Rhino.DocObjects.ObjectType.PointSet
if filter & 4:
geometry_filter |= Rhino.DocObjects.ObjectType.Curve
if filter & 8:
geometry_filter |= Rhino.DocObjects.ObjectType.Surface
if filter & 16:
geometry_filter |= Rhino.DocObjects.ObjectType.Brep
if filter & 32:
geometry_filter |= Rhino.DocObjects.ObjectType.Mesh
if filter & 512:
geometry_filter |= Rhino.DocObjects.ObjectType.Annotation
if filter & 256:
geometry_filter |= Rhino.DocObjects.ObjectType.Light
if filter & 4096:
geometry_filter |= Rhino.DocObjects.ObjectType.InstanceReference
if filter & 134217728:
geometry_filter |= Rhino.DocObjects.ObjectType.Cage
if filter & 65536:
geometry_filter |= Rhino.DocObjects.ObjectType.Hatch
if filter & 131072:
geometry_filter |= Rhino.DocObjects.ObjectType.MorphControl
if filter & 2097152:
geometry_filter |= Rhino.DocObjects.ObjectType.PolysrfFilter
if filter & 268435456:
geometry_filter |= Rhino.DocObjects.ObjectType.Phantom
if filter & 8192:
geometry_filter |= Rhino.DocObjects.ObjectType.TextDot
if filter & 32768:
geometry_filter |= Rhino.DocObjects.ObjectType.Detail
if filter & 536870912:
geometry_filter |= Rhino.DocObjects.ObjectType.ClipPlane
if filter & 1073741824:
geometry_filter |= Rhino.DocObjects.ObjectType.Extrusion
Hi Willem, thanks for helping out. Could you explain how you found out? Where do I find this __Filterhelper or selection.py?
On my phone so no screenshots but:
On the line where rs.Get… is written, Click in the left margin of the textfield editor. You’ll see a red dot appear. That’s a breakpoint. If you now run the script it will halt at that line. In the upper bar arrow icon buttons appear that let you step skip etc… Through the code.
If you “step in” it will open the scriptfile rs.GetObject() is in. In the method a call to __FilerHelper() is made and if you keep stepping in the code you’ll get there .
Does this makes sense?
EDIT:. Found older post with images:
Have a look at these screenshots from the editor.
You can click at the position of the red dot to insert a breakpoint.
This will halt the script at that point and you can inspect the content of the current variables:
More to find on rhinocommon:
search for plane for example:
A good way to explore working with rhino common in python is to insert breakpoints before a rhino…
Now that’s useful info. Thanks a lot, Willem!
@pascal is this supposed to be like that or is it a bug?
Hi Siemen - the actual 16 filter is for a brep which does include single surface breps- as far as I know all of this is as expected, though I understand the possible confusion. Similarly 16 allows extrusion objects to be selected - you can also filter those explicitly - this was a more deliberate decision though, I believe, in not, where possible, differentiating breps from extrusions.
Then I suggest changing the info on the page I linked to above from
“16 Polysurface or multiple-face”