Rs.OsnapMode() returns incorrect values

According to the Help, rs.OsnapModes returns or sets osnaps according to the following bitmask table:

However, if I check for example just “Knot” osnap, the method returns 128 and not the 8 specified in the help above. 128 corresponds with the Osnap enumeration on the following page:

http://developer.rhino3d.com/api/RhinoCommon/html/3FA36DB8.htm

Edit: So it appears just the Help is wrong - get/set both respond correctly to the second posted table (Osnap Enumeration).

rs.OsnapModes does not use the same enumeration values as Rhino.ApplicationSettings.OsnapModes. Rather, rs.OsnapModes matches the values of RhinoScript’s OsnapModes method.

@dale There is something very odd going on here…

Just running the following with different single osnaps checked:

import rhinoscriptsyntax as rs
print rs.OsnapMode()

I get things like 128 for knot, 512 for quad, etc. However if I play with it for awhile, I can get it into a “confused” state where it reports bizarre values that do not correspond to either table if I run various combinations of setting osnaps via script and manually checking the osnap boxes…

Check it out a bit. --Mitch

Edit: Incidentally, I am just playing around with the following, which is what provoked the question…

OsnapPopupListBox.py (1.9 KB)

As a corrolary, I don’t know how the following works to make the two systems correspond - one that goes up to 2^10 with no gaps and the other that goes up to 2^27 with gaps…

–Mitch

http://mcneel.myjetbrains.com/youtrack/issue/RH-31758