If default file location path is specified then the pop up window will open with this path. This field can be NULL.

If you specify the default file extension then you will be able to select only that type of file, if it is NULL then any types of file could be selected.

One can further customize the pop up window by setting the flag value to 1,4,3 and 8or any combinations of these numbers.

Opening and writing files: For opening external files through autocad we have to use the open function.

Syntax of open:(open “filename” “mode”)

We have three modes for open function here:

For reading: use r

For writing: use w

For appending: use w

Let’s see an example:

(setq f(open “aaa.txt” “w”)

Autolisp should return something like #<file "aaa1.txt">.

(write-line “I love u” f)

Autolisp will write the above line to that file “aaa.txt”.

Now you should close the file as below:

(closef)

Important note: Autocad always try to open and write file from the autocad installation directory (e.g. “C:\Program Files\ACAD2000”). So if you want some file from other location you should first find and assign that file from that location or else autocad will create a file in its instillation directory. We will discuss an example regarding this in my next part of the article.)

This post is part of the series: Autocad customization

This is the series of articles that describe AutoCAD cutomization using the tools like Autolisp, Visual lisp ,VB,C++ used for customization of Autocad.