Saving UCS as Temp, in reply to Kent, etal: Yep, and your "P" for Previous is the better way, for that case, and for most cases.
Save the UCS is a debug habit, not normally required.
Just account for the UCS being something other than world...
(defun c:Test (/ e d p) (vl-load-com) (setvar 'ERRNO 0) (if (and (progn (while (progn (setq e (car (entsel "\nSelect *Text object for angle: "))) (cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again.")) ((eq (type e) 'ENAME) (if (not (wcmatch (cdr (assoc 0 (setq d (entget e)))) "MTEXT,TEXT")) (princ "\nInvalid object!") ) ) ) ) ) e ) (setq p (getpoint "\nSpecify first point: ")) ) (progn (vl-cmdf "_.line" "_non" p (strcat "<" (angtos (if (and (eq (cdr (assoc 0 d)) "TEXT") (zerop (getvar 'WORLDUCS))) (- (cdr (assoc 50 d)) (angle '(0. 0. 0.) (trans (getvar 'UCSXDIR) 0 (trans '(0. 0. 1.) 1 0 T) T)) ) (cdr (assoc 50 d)) ) (getvar 'AUNITS) 4 ) ) PAUSE ) (while (eq (logand 1 (getvar 'CMDACTIVE)) 1) (vl-cmdf "")) ) ) (princ) )
1. Notice the post of alanjt: I do not recall if my post included UCS translations.
2. And notice that you can change the Layer and LINE offset down distance, in the code.
And remove the temp UCS, as per Kent1's post.
I was actually thinking of another alternative that goes something like this:
(setq p1 (cdr (assoc 10 (setq b (entget (car (entsel)))))))
(command ".xline" p1 (polar p1 (cdr (assoc 50 b)) 1) "")
Yes, it's tested!
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.