Anthony Dawe has answered your question if what you want is to save a variable within each
file. If you want to create an external file to coordinate multiple drawings, you can use the
following functions:
(open filename mode) filename=string, mode="w" or "r" or "a"
for Write, Read or Append
This function returns a file handle (if successful)
(princ expression filehandle) used to send info to file line by line
Use "\n" character to start a new line
Expression can be a string, symbol, list....
Other printing functions work also.
(read-line filehandle) used to retrieve info from file
sequential access only. You need to establish a format or order.
(read string) used to translate string into lisp expression
returns the evaluation of the string into an exression
(close filehandle) necessary to do each time file is opened after done with it.
(findfile string) returns a fully qualifed filename if successful.
For example, you could save a "very simplified" version of the layer table with:
(tblobjname must be used for the complete layer table)
(setq fh (open "layers.lay" "w"))
(setq lay (tblnext "layer" t))
(while lay
(princ lay fh)
(setq lay (tblnext "layer"))
)
(close fh)
And to restore or rebuild the layer table
(setq fh (open "layers.lay" "r"))
(while (and (setq lays (read-line fh))
(setq lays (read lays))
(setq layc (cdr(assoc 67 lays))) ;color
(setq layl (cdr(assoc 6 lays))) ;linetype
(setq layn (cdr(assoc 2 lays))) ;name
....etc
) ;and
(command "layer" "c" layc layn) ;color
(command "lt" layl layn)
....etc
);while ...
(close fh)
Be careful about choosing extensions for your data files. Of course TXT is the
simplest since you can use notepad to examine them by just clicking on them. If you use any
other extension, you must inform the operating system which application you need to launch when
you double click on the file.
Pardon this over simplified explanation and example. You can set up the dictionary format in a
variety of forms but association lists can be written and read from files most easily. Each
line of the file could be an atom or list or a pointer to the number of lines to skip.
Doug Broad
"KBern" wrote in message
news:91B639C116723205702A1471E9ACFCD6@in.WebX.maYIadrTaRb...
> Doug,
> Could I somehow create a dictionary file that would house the settings for
> each file that requires this variable to be set? I guess I would need code
> that would access this dictionary and know which file is open so it could
> retrieve the correct value from the dictionary. I really don't know if this
> is possible, but if it is I would love to hear how I could do it. I really
> only know LISP, so this puts me at a disadvantage here.
>
> Kyle Bernhardt
>
>