Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Kent1Cooper
en respuesta a: dpalmerVQ54W

Try this [minimally tested]:

 

(defun C:T2A (/ tss tent tdata txt); = Text (To) Attribute
  (prompt "\nTo convert Text object(s) to Attribute definition(s),")
  (if (setq tss (ssget '((0 . "TEXT"))))
    (repeat (setq n (sslength tss)); then
      (setq
        tent (ssname tss (setq n (1- n)))
        tdata (entget tent)
        txt (cdr (assoc 1 tdata)); text content to use as both Tag and Prompt
      ); setq
      (entmake
        (append
          '((0 . "ATTDEF")); new entity type
          (vl-remove-if '(lambda (x) (member (car x) '(-1 0 330 5 100 1))) tdata)
            ; everything common between both kinds [except expendable 100 entries]
          (list '(1 . "") (cons 3 txt) (cons 2 txt) '(70 . 0) '(74 . 0))
            ; 1 entry different in ATTDEF from TEXT; others in ATTDEF but not in TEXT
        ); append
      ); entmake
      (entdel tent); eliminate original Text object
    ); repeat
  ); if
  (princ)
); defun
Kent Cooper, AIA