TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: CAKO on March 15, 2012, 05:27:09 AM

Title: Combining multiple text objects into one (by selecting all at once)
Post by: CAKO on March 15, 2012, 05:27:09 AM
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!
Title: Re: Combining multiple text objects into one (by selecting all at once)
Post by: Tharwat 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)
)
Title: Re: Combining multiple text objects into one (by selecting all at once)
Post by: Lee Mac on March 15, 2012, 07:26:23 AM
TXT2MTXT ?
Title: Re: Combining multiple text objects into one (by selecting all at once)
Post by: ronjonp on March 15, 2012, 09:26:12 AM
You could try this as well: http://www.theswamp.org/index.php?topic=35382.msg407916#msg407916