Jump to content

Recommended Posts

Posted
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)))

 

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • mhy3sx

    12

  • BIGAL

    3

  • Tsuky

    2

  • marko_ribar

    1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...