Author Topic: Sketch...ers  (Read 5353 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Sketch...ers
« Reply #15 on: January 16, 2007, 07:58:04 PM »
my guess, it's a 'logical' and which AND's 2 values together, if they're the same it evaluates to TRUE.

But wouldn't the current "cmdactive" 33 make it a false statement then ??
1 does equal 1, but 1 AND 33 does not equal 1.

The vl-cmdf is irrelevant.

The fix is the use of
Code: [Select]
(while (= 1 (logand (getvar "cmdactive")))
    (command pause)
)

basically the SKETCH, LINE, RECTANGLE commands you tried require additional input from the user.
The (while .. construct just tests if the COMMAND is still active and continues to PAUSE inside that command while you are providing input to it.


Ohhh, so, the LOGAND is mearly suggesting the "CMDACTIVE" is still running or active.  The (= 1 ...  1) is just fluff, right ??

And the "... vl-cmdf is irrelevant." is just the VLA of the lisp (command ". ...) line.

Regarding the possible values for CMDACTIVE refer to the help files, it is reasonably well documented.

Yeah, I was looking at that.  That's what was throwing me.  My variable was set at 33 and you had the (= 1 ... 1) in the code.

Perhaps I am still off the road a bit, but I've learned a lot tonight.  Thank you all for your comments and help.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Sketch...ers
« Reply #16 on: January 16, 2007, 08:06:48 PM »
Code: [Select]
(while (= 1 (logand (getvar "cmdactive") 1))
    (command pause)
)

possible bit settings are 1 2 4 8 16 32 etc  and (getvar "cmdactive") could be the sum of any of these in combination.

We want to test for bit 1 ..
so, to test if the bit 1 is included in the sumValue we use (logand ...

for example, try these, keeping in mind the bits settings of 1 2 4 8 16 32 etc
(logand 3 1)
(logand 17 1)

(logand 6 1)


added:

If your setting was 33
then the combination is this :
32   AutoLISP is active (only visible to an ObjectARX-defined command)
  1  Ordinary command is active
 
« Last Edit: January 16, 2007, 08:08:46 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MickD

  • King Gator
  • Posts: 3637
  • (x-in)->[process]->(y-out) ... simples!
Re: Sketch...ers
« Reply #17 on: January 16, 2007, 08:09:44 PM »
Sorry, TRUE wasn't quite correct, I guessed the 1 was a true flag but seeing the help as Kerry pointed out it was conveniently 1 to logand against, therefore perhaps it could have been written as-

while(=33 logand(getvar "CMDACTIVE) 33) ;;if 33 'is' the value for cmdactive which it is not

perhaps??, 'scuse my ignorance, trying to learn a bit myself :)
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien