Author |
Topic |
|
bse1963
New Member
USA
5 Posts |
Posted - December 04 2006 : 09:35:29 AM
|
Hi
I have txt files with Layer Names,Color, Linetype, and a Description.
How do i create a script to read the containts of the txt file to make the layers?
what is the fromat the txt file needs in order to be read?
thanks
|
|
n/a
deleted
112 Posts |
Posted - December 04 2006 : 11:20:58 AM
|
I've attached a zip file which contains a LSP file and a LYR file which is similar to what you want, I think. The LYR file has to be in the format shown for the LSP file to work correctly. It is also required by the LSP file to be in the root of the C drive, although the LSP can be altered for another location. The LYR file, will have to be altered, of course, for your specific Layer names, colors, and linetypes. I don't know how to get the descriptions into the drawings, tho.
Before you start, back up your drawing files someplace safe in case the results are not what you expect.
Then, in order to use the LSP file, locate it in the AutoCAD search path. Create and run a two line script file as below:
(load "Mlayer") Mlayer
Hope this helps.
Download Attachment: Mlayer.zip 1.11 KB |
Steve Bubendorf
|
|
|
bse1963
New Member
USA
5 Posts |
Posted - December 04 2006 : 12:59:21 PM
|
thanks,
that that lisp works well, except i have a "column" with a "discription".
Autocad, in the -layer command has no way to make a discription, do you know of any way to add the discription?
see attached file
Download Attachment: mlayers.LYR.txt 6.65 KB |
|
|
n/a
deleted
112 Posts |
Posted - December 04 2006 : 1:56:23 PM
|
I didn't know how to get the description into the drawing (see my first post). However:
I did some research. Give these a try. Note: I think the option that I found uses Vlisp, Active X, or something. I'm not even sure which, or if they are the same thing or something different. Anyway: It seemed to work on my system, but I think you may have to have a version of AutoCAD newer than R14 for it to work for you. Again, make sure to back up your drawing files.
Also, I found that after the rework, anyway, that the first line of the LYR file was not being added/created in the drawing. The quickest way to solve the problem seemed to be to add a "dummy" line prior to the actual line that I needed. I simply repeated the first set of layers, ltypes, etc., so it skipped the first line and started with the duplicate second line.
Download Attachment: Mlayer2.zip 1.22 KB |
Steve Bubendorf
|
|
|
n/a
deleted
112 Posts |
Posted - December 04 2006 : 2:21:25 PM
|
I took the time to figure out why the routine was skipping the first line of the LYR file. This version should read the top line correctly without having to duplicate it. (I was able to shorten the routine some, also. I was kind of redundant with the previous versions and that was actually causing the line skip.)
Download Attachment: Mlayer3.zip 1.19 KB |
Steve Bubendorf
|
|
|
bse1963
New Member
USA
5 Posts |
Posted - December 04 2006 : 3:13:09 PM
|
Thanks, it works great. |
|
|
n/a
deleted
112 Posts |
Posted - December 04 2006 : 3:26:45 PM
|
You're welcome. Glad to help when I can. |
Steve Bubendorf
|
|
|
|
Topic |
|
|
|