layer names in external files

dwane101

Usenet Archive
Joined
Jul 12, 2003
Messages
4
Reaction score
0
im wanting to create a routine (lisp hopefully) that can allow me to have an external file (lets say layer.txt), that i can save default layer names to (ie toilets, vanities, towel rails etc to go on layer "bathroom").at present i can easily make a routine that has the layers hard coded in, but i want some flexiblility in it. question is - can this be done easily??
 
Yes-- many routines use such as an INI file... see if you can borrow ADT (architectural desktop), I beleive that's what it does.

What you need to do is set a value to seek... say, layer name ... then use (open ... to get the external file...then use a (read-line Statement in your Lisp to read a line... continue reading line by line until you reach your layer-name value

from there... repeat the read-line until you reach the end of specs available... each spec on one line and enough to define your layer. you could use a special character to speed the read-line loop until the layername is reached... see partial INI format below.

(if (= "**" readline-value )(read-line)
(if (/= readline-value layername-value)
[ ... go to setup layer routine ... which would also close the INI file ] )
)

setup layer routine would handle all lines from ** to **... and close INI file before processing next layer-name

**
layer_name1
color##1
linetype1
lineweight1
**
layer_name2
color##2
linetype2
lineweight2
**
 
What about a simple script file?

No additional programming required,

and can be use in Autocad and LT.

Like (modify the names to suit):

layer make "1" color 1 "" LW 0.18 ""

layer make "2" color 2 "" LW 0.25 ""

layer make "3" color 3 "" LW 0.35 ""

layer make "4" color 4 "" LW 0.50 ""

layer make "5" color 5 "" LW 0.70 ""

layer make "6" color 6 "" LW 1.00 ""

layer make "7" color 7 "" LW 0.05 ""

layer make "8" color 8 "" LW 0.00 ""

layer make "9" color 9 "" LW 0.09 ""

 

"dwane101" <> wrote:

im wanting to create a routine (lisp hopefully) that can allow me to have an external file (lets say layer.txt), that i can save default layer names to (ie toilets, vanities, towel rails etc to go on layer "bathroom").at present i can easily make a routine that has the layers hard coded in, but i want some flexiblility in it. question is - can this be done easily??
 
Yes, it can be done easily.  A lisp file can read such a text file

and set up the layers like you want.

 

What you ask is really the function of template files however.

Set up the layers as you want in a new drawing and save it

as a template.  Each time you start a new drawing, use that

template.

"dwane101" <> wrote:

im wanting to create a routine (lisp hopefully) that can allow me to have an external file (lets say layer.txt), that i can save default layer names to (ie toilets, vanities, towel rails etc to go on layer "bathroom").at present i can easily make a routine that has the layers hard coded in, but i want some flexiblility in it. question is - can this be done easily??
 
I use templates for different dwgs (ie: foundataion, conduit, structural, etc) that each use their own layers. When I need a certain layer, or group of layers, I open the templates in design center and drag and drop them into my dwg. That way I don't have unused layers just sitting around.
 

Latest threads

Back
Top