Check if integer comprises a flag value (bits?)

Discussion in 'AutoCAD' started by steveing, Apr 5, 2004.

  1. steveing

    steveing Guest

    Not quite sure If I nailed the description so let me give an example:

    Lets suppose that I do a getvar on "OSMODE" and it returns "151". Based upon this returned value I want to check if center osnap is turned on (which would be a value of 4).

    Is this what is referred to when it speaks of "logical biwise"?

    Thanks,

    Steve
     
    steveing, Apr 5, 2004
    #1
  2. steveing

    Jeff Mishler Guest

    Yes, sortof. "logical bitwise" is more correct ;-)

    A simple way of looking at this is:

    (if (= (logand (getvar "osmode") 4) 4)
    (alert "Center Osnap is On")
    (alert "Center Osnap is Off")
    )

    and this really also needs to check for bit code of 16384 to see if Osnaps
    have been disabled on the status bar.

    Jeff

    upon this returned value I want to check if center osnap is turned on (which
    would be a value of 4).
     
    Jeff Mishler, Apr 5, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.