Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to convert Mtext or Text to Attribute Text?

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
mohamedahsaan126
13912 Views, 10 Replies

How to convert Mtext or Text to Attribute Text?

Dear All,

Is there any way to convert Text to Attribute Text.?

Because i need to extract text to excel. 

Please find the attached .dwg file give me a solution.

Thank you in advance.

Tags (1)
10 REPLIES 10
Message 2 of 11

@mohamedahsaan126 ,

There is no way to automatically turn text or mtext objects into attribute text using standard AutoCAD commands. You could manually create these attribute definitions and match the properties of the text or mtext object. 

There are also LISP routines that can help you automate this task.

See this forum post. The solution provided by @clindner is particularly relevant to your question. 



Rue Williams
Technical Support Specialist
Customer Service & Support
Autodesk, Inc.

Message 3 of 11

Dear Mr.Williams,

I'm really sorry to say this, i cloud not understand that.

Can you please explain me little more.

i load the LISP file and i don't know how to use this below comments.

Please guide me.

defun c:txt2tag (/ oldcmd ss)
  (setq oldcmd (getvar "CMDECHO")) (setvar "CMDECHO" 0)
  (if (setq ss (ssget (list (cons 0 "TEXT,MTEXT")
                            (if (getvar "CTAB")
                              (cons 410 (getvar "CTAB"))
                              (cons 67 (- 1 (getvar "TILEMODE")))))))
    (progn
      (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
        (command "-attdef"
		 "" ; settings
		 (cdr (assoc 1 (entget e))) ; tag name
		 "" ; prompt
		 "" ; default value
                 (cdr (assoc 10 (entget e))) ; ins pt
		 (cdr (assoc 40 (entget e))) ; height
		 (cdr (assoc 50 (entget e))) ; rotation
		 )
        (entdel e)))
    (princ "\nError: no text selected."))
  (setvar "CMDECHO" oldcmd)
  (princ))
(defun c:txt2att () (C:txt2tag))
(defun c:mtxt2att () (C:txt2tag))
(defun c:mtxt2tag () (C:txt2tag))
(princ)

 

Message 4 of 11

Hi @mohamedahsaan126 ,

I have created a .lsp file from the relevant post to lessen confusion. Please download the .lsp file attached to this post and use the APPLOAD to load the LISP file. Once the script file is successfully loaded, you can use any of the commands listed below to activate the script. 

  • txt2att
  • mtxt2att
  • mtxt2tag
  • txt2tag

I hope this better explains how to use this LISP script.



Rue Williams
Technical Support Specialist
Customer Service & Support
Autodesk, Inc.

Message 5 of 11

Dear Mr.Williams,

Thank you very much for your clear explain.

LISP file is working but it's not full filling my requirement.

Text convert to attribute but with only tag(please refer screen shot). There is no value added.

 

And i can not do export attribute. Please can you try on my work sheet, maybe something wrong on my sheet.i'll attached here. 

My aim for this only need to export data.

Once again thank you for your valuable time.😊😊

 

 

 

Tags (1)
Message 6 of 11

Hi @mohamedahsaan126 ,

We have reached the limit of my abilities with the LISP language. If you need further help, you can reach out to the AutoCAD Customization LISP forum and see if there is someone there who can help you modify the script to better fit your needs.



Rue Williams
Technical Support Specialist
Customer Service & Support
Autodesk, Inc.

Message 7 of 11

Dear Mr.Williams,

Thank you for your effort.

And i found one solution to extract that data.

First i change "every single manhole data" text to MTEXT by manually.

Then i'm using (DX)Data Extraction to get data in Excel.

Any way thank you for your support.

Message 8 of 11

Hi,

 

>> Because i need to extract text to excel. 

You can use command _DATAEXTRACTION to export Text content to Excel.

Why would you like to convert it to an attribute before?

 

-  alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 9 of 11

Dear Mr.Williams,

YES, my only aim was extract text to excel.

That time i don't know about "DATA-EXTRACTION" for text, but i know "ATTRIBUTE EXPORT" for attribute text.

That's way i asked help to convert Text to attribute.

Any how i got one solution. 

Thank your so much for your valuable time spending for me.

 

Message 10 of 11

Hi,

 

>> That time i don't know about "DATA-EXTRACTION" for text,

>> but i know "ATTRIBUTE EXPORT" for attribute text.

Just to make sure, you understood that _DATAEXTRACTION is a command inside AutoCAD ... and that it helps you can export text objects direct to XLS without the need of converting anything?

Just look >>>here<<< to get more information about that command (it could help in the future too).

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2024
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 11 of 11
clindner
in reply to: mohamedahsaan126

@mohamedahsaan126 ,

 

You may also want to explode the ATTOUT command that is part of AutoCAD's Express Tools. 

 

Regards,

Chris


Please use the Accept as Solution or Kudo buttons when appropriate

Chris Lindner
CAD Technology Consultant @ onebuttoncad.com
AUGI Board of Directors

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta