Thank you, James! As you can tell, I've been striving for intuitive and
minimal pesky prompts and user input. This routine is principally for
text and mtext on topo drawings, which can get unbelievably dense. But
should be handy everywhere. Clean code is to be desired (as we learned
in Fortran in the '70s) but not at the expense of functionality.
Here's the dream (Autodesk, take note!): Pick the object and a little
circle appears at the pick point. Now the user picks: if he picks the
little circle he can drag the object. If he picks anywhere else a
temporary line appears and he can rotate the object. For me, 2-d is
fine. But wouldn't it be cool to do this in 3-d, with solids?
I like lastpoint, too, but I forgot it. The grread is pretty slick;
strange that it wanders. There's only milliseconds between the
completion of the move and the grread; not much time to move the mouse.
rs
"JamesA" wrote in message
news:405f7ec5$1_1@newsprd01...
> "Maybe I'd better read up on reactors?"
>
> rs, your code is certainly cleaner, but I think this gets what you
want. I
> can use this too. Thanks for the spark.
>
> BTW, I noticed the insertion point wandering with grread, so I
switched it
> to getvar "lastpoint". I've not used grread for anything, so I'm not
sure
> if it might have served some other purpose I'm missing.
>
> Thanks,
>
> --
> James Allen
> Malicoat-Winslow Engineers, P.C.
> Columbia, MO
>
>
> (defun c:mr (/ obj pnt StopCurrentCommand)
> ;MR.LSP - Move and Rotate at will
> (command "undo" "begin")
> (setq obj (entsel "\nSelect an object at the working point: "))
> (setq pnt (cadr obj))
> (vl-load-com)
> ;; MR:RtClkNotify is the MouseRxr callback function
> (defun MR:RtClkNotify (calling-reactor commandInfo /)
> (setq StopCurrentCommand t)
> )
> ;; Set a mouse reactor
> (setq MouseRxr (vlr-mouse-reactor
> nil
> (list '(:vlr-beginRightClick . MR:RtClkNotify))
> )
> )
> ;; Basic loop
> (while (not StopCurrentCommand)
> (princ "\nMOVE: ")
> (command "move" obj "" pnt pause)
> (if (not StopCurrentCommand)
> (progn
> (setq pnt (getvar "lastpoint"))
> (princ "\nRotate: ")
> (command "rotate" obj "" pnt pause)
> )
> )
> )
> ;; Abort and undo current Move command
> (command)
> (command "undo" "")
> ;; Remove reactor
> (vlr-remove MouseRxr)
> (command "undo" "end")
> (princ)
> )
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.600 / Virus Database: 381 - Release Date: 2/28/2004