Carriage return in lisp-create
Hello,I have the following lisp which displays the coordinates of a selected point with a leader:
(defun c:xy ()(setq pt (getpoint " Pick Point: "))(setq x (rtos (car pt)))(setq y (rtos (cadr pt)));(setq z (rtos (caddr pt)))(setq ptcoord (strcat x "mE, " y "mN"))(command "QLEADER" pt pause "" "" ptcoord ""))
This give me:
"123.45mE, 678.90mN"
But I would like:
"123.45mE
678.90mN"
How do I amend the strcat line so it uses a carriage return?
Thanks,
Rob (setq ptcoord (strcat x "mE, \n" y "mN")) Thank you!
You're welcome .
A few modification if you'd like .
(defun c:xy (/ pt) (while (setq pt (getpoint "\n Pick Point : ")) (command "_.QLEADER" "_none" pt "_none" pause "" "" (strcat (rtos (car pt)) "mE, \n" (rtos (cadr pt)) "mN") "") ) (princ)) I'd like very much, thanks again.
Is there any way to make the text in the Mtext right-justified when it is created or would I have to do that manually?
Does it mean that you always place the text on the left hand side ?
Cause if you place the text on the right side hand with right-justified property of the Mtext , you'd have irregular shape of the Leader . I have been using the xy routine above (post 4) with great success, thank you Tharwat.
Would somebody be kind enough to help me to enhance this routine?
I would like to be able to have it so that it gives the coordinates of the currently selected UCS but creates the text square to the world system.Is this possible?
Happy to hear that .
Can you give an example ( or a drawing ) ? This is a little lazy of me, but I need to get to bed . There are better ways, perhaps Tharwat might help you with one of them.
This takes advantage of the fact that a QLEADER is made up of two entities and the MTEXT is created last.
(defun c:xy ( / el pt rot ) (setq rot (cons 50 (- (apply 'atan (cdr (reverse (getvar "UCSXDIR"))))))) (while (setq pt (getpoint "\n Pick Point : ")) (command "_.QLEADER" "_none" pt "_none" pause "" "" (strcat (rtos (car pt)) "mE, \\P" (rtos (cadr pt)) "mN") "") (entmod (subst rot (assoc 50 (setq el (entget (entlast)))) el)) ) (princ) )
Oh, and I did change the "\n" to "\\P" in the string. Change it back if you want. It just seems to me that most (not all) of the functions floating around the web that extract formatting strings remember "\\P" and forget "\n".
That's because \n will yield a soft return (shift + enter), whereas \\P is an actual hard carriage return.
页:
[1]
2