Change Cursor Type (Shape)
I need some advice to change the cursor type (shape) during the program to match the input asked. Eg. I need to change the cursor to a cross (target) and then to change it back to default. I guess it has something to do with grread, I read AutoCAD help and a few examples on internet but I couldn't make it work. If someone could give me an example how to manipulate it would be great. Thank you. Quick example:(defun c:cursortype ( / c g ) (setq c 0) (princ "\nChoose : ") (while (or (= 5 (car (setq g (grread nil 14 c)))) (and (= 2 (car g)) (member (cadr g) '(78 80 83 110 112 115)) ) ) (if (= 2 (car g)) (setq c (cadr (assoc (cadr g) '((78 1)(80 0)(83 2)(110 1)(112 0)(115 2))))) ) ) (princ)) Thanks for the example, Lee Mac. It works, but unfortunately, I am unable to decipher it and adapt it to what I need. I was expecting to have a variable that needs to be changed so the cursor changes without asking user for input to change cursor. I tried using your example as a function to pass a variable to, but unsuccessful.
... some code - default cursor type
... some code - target cursor type (or none)
... some code - default cursor type again Is the system variable CURSORSIZE what you have been looking for?
Here is another quick example:
(defun c:test ( / e g ) (princ "\nPick a point: ") (while (= 5 (car (setq g (grread nil 12 0))))) (if (= 3 (car g)) (progn (princ "\nUser picked ") (princ (cadr g)) ) ) (princ "\nSelect an object: ") (while (= 5 (car (setq g (grread nil 12 2))))) (if (and (= 3 (car g)) (setq e (car (nentselp (cadr g)))) ) (princ (strcat "\nUser selected a " (strcase (cdr (assoc 0 (entget e))) t))) ) (princ)) Thanks, Lee Mac. This example is more clear. I am trying to adapt it to my program. It kind of works, but I have to hit ENTER to make the program continue, and when I do that, the cursor goes back to default. Here's what I'm trying to do:
..some code - box cursor type(while (null n) ;;here inside while I need point (target) cursor type instead of default (setq n (getint "\nNo of spaces: ")) (if (
This is not possible to achieve with your code since the cursor type will only be modified during evaluation of the grread function, and will revert back to the standard cursor when other user-input functions (such as getint) are evaluated.
The only way to change the cursor for the prompt would be to write your own version of the getint function using grread. This is not impossible, but not worth the effort in my opinion if you are only looking to change the cursor appearance. I understand. I appreciate your help, Lee Mac.
页:
[1]