In V5 SR12, the UI’s selection filter setting can affect whether objects can be selected by rs.SelectObjects.
In V6.0.17031.12411, 1/31/2017, this is not true.
For example, in both V5 & V6,
- Create a curve and a point in an empty model.
- In the Selection Filter window, enable Points and disable Curves.
- Run the following:
import rhinoscriptsyntax as rs
def main():
rs.UnselectAllObjects()
idAllObjs = rs.AllObjects()
print "{} objects found by rs.AllObjects.".format(len(idAllObjs))
print "{} objects reported by rs.SelectObjects.".format(rs.SelectObjects(idAllObjs))
print "{} objects reported by rs.SelectedObjects.".format(len(rs.SelectedObjects()))
if __name__ == '__main__': main()
In V5,
Only the point is selected.
2 objects found by rs.AllObjects.
2 objects reported by rs.SelectObjects. Should be 1.
1 objects reported by rs.SelectedObjects.
In V6,
Both the point and curve are selected.
2 objects found by rs.AllObjects.
2 objects reported by rs.SelectObjects. Should be 1.
2 objects reported by rs.SelectedObjects. Should be 1.
I see the pros and cons of V5 vs. V6 behaviors. Without using rs.Command, is there a way for V6 scripts to honor the UI’s selection filter setting?
Thank you,
Steve