Tsuky Posted June 12, 2023 Posted June 12, 2023 On 5/22/2023 at 5:13 PM, mhy3sx said: I find this code, is similar , working better but not support mtext. Can any one help? For Text is (vla-put-TextAlignmentPoint ....) For Mtext is (vla-put-AttachmentPoint ....) Is not the same Something more standard (not mine) but works for both! Command TXX TXY (defun getInputText (/ txt ss i lst) (if (setq txt (car (entsel "\nSelect reference text: "))) (if (wcmatch (cdr (assoc 0 (entget txt))) "*TEXT") (if (setq ss (ssget '((0 . "*TEXT")))) (cons txt (repeat (setq i (sslength ss)) (setq lst (cons (ssname ss (setq i (1- i))) lst)) ) ) ) (prompt "\nSelected object is not text.") ) ) ) (defun alignText (fun lst / coord elst dxf10 ucsPt) (and lst (setq fun (eval fun) coord (fun (trans (cdr (assoc 10 (entget (car lst)))) (car lst) 1)) ) (foreach txt (cdr lst) (setq elst (entget txt) dxf10 (assoc 10 elst) ucsPt (trans (cdr dxf10) txt 1) ) (entmod (subst (cons 10 (trans (subst coord (fun ucsPt) ucsPt) 1 txt)) dxf10 elst ) ) ) ) (princ) ) (defun c:txx () (alignText 'car (getInputText))) (defun c:txy () (alignText 'cadr (getInputText))) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.