Anuncios

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

Convert Text to Attribute

dpalmerVQ54W
Enthusiast

Convert Text to Attribute

dpalmerVQ54W
Enthusiast
Enthusiast

I have a title block which is made up of two rows of single line text and I would like to convert these to being a block with attributes. Is there a command to convert the single line text to an attribute?

 

Capture.JPG

David P
AutoCAD 2021
0 Me gusta
Responder
4.733 Vistas
3 Respuestas
Respuestas (3)

leothebuilder
Advisor
Advisor

Welcome to this forum.

No, there is no command to convert text to an attribute.

 

You will have to use the ATTDEF command and create the attribute definitions.

Kent1Cooper
Consultant
Consultant

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

Anonymous
No aplicable

There is an add-in on the Autodesk App Store for AutoCAD 2021.  It's names Text To Attribute 2021.  It also works with all the AutoCAD 2021 verticals.