Author Topic: Combining multiple text objects into one (by selecting all at once)  (Read 4141 times)

0 Members and 1 Guest are viewing this topic.

CAKO

  • Guest
Hi,

I have a lisp file that combines text objects. It makes you select the very first (stationary one), then asks you to select 2nd, 3rd 4th etc, and adds them after one another.

What I am asking for is,

I want to select multiple text objects at once, and the lisp combines them using their very first characters' x or y coordinate (or both).

Do you have any ideas?

Thanks!

Tharwat

  • Swamp Rat
  • Posts: 707
  • Hypersensitive
Re: Combining multiple text objects into one (by selecting all at once)
« Reply #1 on: March 15, 2012, 06:34:18 AM »
is this what you mean  ... ?

Code: [Select]
(defun c:TesT (/ selectionset intger selectionsetname chars strings)
  ;;; Tharwat 15. March . 2012 ;;;
  (if (and (setq selectionset (ssget "_:L" '((0 . "TEXT,MTEXT"))))
           (setq point (getpoint "\n Specify point for Text :"))
      )
    (repeat (setq intger (sslength selectionset))
      (setq selectionsetname
             (ssname selectionset (setq intger (1- intger)))
      )
      (setq chars
             (cons (chr (car (vl-string->list
                               (cdr (assoc 1 (entget selectionsetname)))
                             )
                        )
                   )
                   chars
             )
      )
      (setq strings (apply 'strcat (reverse chars)))
    )
    (princ)
  )
  (if strings
    (entmakex (list '(0 . "MTEXT")
                    '(100 . "AcDbEntity")
                    '(100 . "AcDbMText")
                    (cons 10 point)
                    (cons 1 strings)
              )
    )
  )
  (princ)
)

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Combining multiple text objects into one (by selecting all at once)
« Reply #2 on: March 15, 2012, 07:26:23 AM »
TXT2MTXT ?

ronjonp

  • Needs a day job
  • Posts: 7526

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC