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

How to export text from Layer to excel file ? - URGENT

20 REPLIES 20
SOLVED
Reply
Message 1 of 21
domniq
10899 Views, 20 Replies

How to export text from Layer to excel file ? - URGENT

hi,

I want to expoer the below text data in CSV, I tried Data Extraction command but it puts entire data in one colom. Can some one help to guide, is there any lisp available to export the below result in CSV as it is.

 

 

I have also attached my DWG file for testing.

TREE_DATA.png

20 REPLIES 20
Message 2 of 21
braudpat
in reply to: domniq

 

Hello

 

Sometimes I use the AutoCAD "DATAEXTRACTION" ...

 

And sometimes I use a Lisp/VLisp file which extract in a .CSV / .TXT / etc : Texts, MTexts, Attributes (and nothing else)

... which is easier and faster to use ...

 

APPLOAD to load the .LSP/.VLX/etc files ...

And then you will get a NEW command : TEXT-EXPORT

 

I hope it will be help you !?

 

TEXT-EXPORT has been written by Gilles (gile) - Thks to him !

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 3 of 21
3wood
in reply to: domniq

Please try TEXT2CSV.vlx.

Refer to link below:

https://sites.google.com/site/cadkits/home/text2csv

 

Let me know if it works well.

Message 4 of 21
domniq
in reply to: braudpat

HI Pat,

I tried the lisp you gave me. I selected only 5 rows from No 40 to No 45 as below :

TEXT_DATA.png

 

But the lisp converted it inot a file as shown below:

CONVERTED_CSV.png

 

Meaning all the data goes vertically. Is this the correct way ? What i do is as below:

 

I loaded the lisp;

I run the command;

I select the text;

I provide the delimator;

I save it into txt file;

i opan excel and add the data with semi colon as delimator and space.

 

And above is the result. Is this the correct way ?

 

Thanks, pls guide ..

Message 5 of 21
domniq
in reply to: 3wood

hi 3wood,

 

After using Text2CSV  for two rows i get this output:

TWO_ROWS.png

 

I selected only no 44 and 45 its still gives me row 1 ?  any idea ?

 

Thanks

 

Message 6 of 21
braudpat
in reply to: domniq

 

Hello from France

 

Sorry maybe I don't understand well your needs !

 

The routine "TEXT-EXPORT" is done to export to .CSV/.TXT/etc the following entities : Texts, MTexts, Attributes

but not at all to export Text/Mext inside an AutoCAD Table !? ... So the result is a little bit strange ...

 

I imagine that "TXT2CSV" from 3Wood has maybe the same "problem" !? 

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 7 of 21
3wood
in reply to: domniq

There are some redundant spaces before numbers in Girth, Height & Spread columns.

Hence the actual length of texts in these columns are overlapped with the texts in the column on the left hand side.

You need add some vertical lines to manually define the columns, as shown below, ensure the text insertion points (shown as colored dots) are separated by these lines (white lines).

text2csv 1.PNG

 

The conversion result with TEXT2CSV is as below:

text2csv 2.PNG

 

Because the first row in the dwg actually is one text, it will go to one cell as a whole text string in CSV files. You can either deleted  this row in the CSV file, or created multiple text objects to represent title of each column.

 

I attached the CSV file for your information (Still keep the title row).

Message 8 of 21
domniq
in reply to: 3wood

hi,

 

how did u identified the extra space ?

Can you tell me the steps to get the desired results. as u said. ??

Message 9 of 21
domniq
in reply to: 3wood

Hi 3wood,

 

Can help to please guide me with the steps to get the desired reports as the csv u have attached.?

 

 

Is there a way if i want to do this task for 2000 files how would i go ahead and achieve this ?

 

Appreciate your reply

 

Thanks

 

Message 10 of 21
3wood
in reply to: domniq


domniq wrote:

Is there a way if i want to do this task for 2000 files how would i go ahead and achieve this ?


Yes, it is possible but depending on the quality of the table and we need some works to format your talbes before using TEXT2CSV.

Also we need a command line function in TEXT2CSV - Currently this function does not exist in the vlx file.

 

As I have explained, some text objects have extra "spaces" in the front, such as  "      15.0" instead of "15.0".

To format the table properly that TEXT2CSV can be used without drawing additional vertical separation lines, you (or a script file) need do the following

1. Firstly we need find out a solution to get AutoCAD to identify the talbe from other objets automaticaly. If the table itself is on a special layer, it will be quite easy. We can simply isolate it from other objects.

2. Then we can scale the table by 100 times, and change the justification of all text objects to MC with command TJUST.

3. Then we change the height of text objects to its original height.

These 3 steps above is to ensure all insertion point of texts objects are located in each cell properly.

 

Then we may need do some works in TEXT2CSV itself to introduce a command line function which can be used in a script file.

 

The last step is to find out a program to run above scritps on 2000 files.

 

But even without the script file and command line functions, I reckon all 2000 files can be done in 2-3 days with current TEXT2SV alone.

Message 11 of 21
domniq
in reply to: 3wood

Hi 3wood,

 

Appreciate your reply, just want to understand when you say 2 - 3 days meaning, r u saying that we open each file and process it with the commandText2CSV and close the file ?

 

Can you help to provide the scripts for the 3 steps you mentioned ?

 

Any suggestion to run the process in a batch program?

 I tried to identify and came across BatchInDatabase which process multiple file but it only process bolck attribute not the whole layer.

 

Can you suggest how to achieve all the above for 200 files ?

 

Thanks

Message 12 of 21
3wood
in reply to: domniq

Yes,if it is only 200 files, just open each one and do above steps. Around 1~2 minutes per drawing. You will get it done in 1 day. No need search for scripts for hours.

If you need do the task on regular base, or have 2000+ drawings to proceed, then we can work out a better and quicker solution.

Message 13 of 21
domniq
in reply to: 3wood

Hi 3wood,

 

Appologies it is 2000 files, can help me to automate this task as we need this task to be completed on urgent basis.

Apart from this the task will also be on a regular base.

 

 

 

Thanks

Message 14 of 21
3wood
in reply to: domniq

From the example dwg file I can see,

There are 2 problems prevent we doing the task automatically.

1. There are other information other than the table in Layer Tree

2. Texts in 1 column are not lined up perfectly - That means we need either draw vertical lines to define columns, or line up texts based on their insertion points properly.

(Sorry nothing to do with UCS).

 

Now I think the only way is to manually do it on 2000 drawings (3 days hard work?)

 

If the source file is nice and tidy, We don't need introduce a command line function for TEXT2CSV, just add below 2 lines to the script file:

(c:text2csv)

all

 

Note: There is a space after "all"

It will create a csv file from all objects shown in current drawing and it is saved in the same folder as the dwg file.

Message 15 of 21
domniq
in reply to: 3wood

hi 3wood,

 

I want to open each file and load the vlx file every time. i was wondering if there is a way that i can add this in ACADDOC.lsp file so that i can aviod loading your script every time? this will save my 3 steps, as i have to process 2000+ files.

 

If there is a way to fix this to my autocad session then let me know.

 

Also i wan to understand, is there a way that i can use this file with mac? i was trying to load the .vlx file in AutoCad installed on mac book but it dose'nt allow me to load it.

 

Any suggestion is highly appreciated.

 

Thanks

 

Message 16 of 21
3wood
in reply to: domniq

You can add the vlx file to Startup Suite, as shown below.

appload.png

 

Also, you can try this technique:

When you select texts, do not select any line, because you only have 2 lines as the table boudary, if they are included in the selection, TEXT2CSV will reckon all text objects between these 2 lines as in 1 cell.

Message 17 of 21
domniq
in reply to: 3wood

Thanks, very helpful.

 

Secondly is there a way to load .vlx files in Mac version of autocad ?

Message 18 of 21
3wood
in reply to: domniq

Sorry I don't have Mac, but as far as I know, current Mac version AutoCAD does not support lsp & vlx file.

There is webpage in AutoCAD website comparing Mac and PC version, you can search it.

Message 19 of 21
braudpat
in reply to: domniq

 

Hello

 

As far as I Know almots all pure Lisp files are running on AutoCAD Mac !

 

But there is no ActiveX on Mac, so no VL / VLA / etc functions !!

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 20 of 21
3wood
in reply to: braudpat

Yes you are correct. Thank for the correction.

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

Post to forums  

Autodesk Design & Make Report

”Boost