Importing multiple DXF files into a drawing from a user defined directory?

Importing multiple DXF files into a drawing from a user defined directory?

Anonymous
Not applicable
2,458 Views
3 Replies
Message 1 of 4

Importing multiple DXF files into a drawing from a user defined directory?

Anonymous
Not applicable

I found this code while searching online, but I need to be able to pick a new directory folder each time I run the lisp. It would preferably open a file navigation dialog box, so I could browse to the desired folder. Anyone have ideas? Please and thank you!

 

(defun c:IDXFS (/ directory files)
(setq directory "C:\\MyFile\\DXFs")
(if (setq files (vl-directory-files directory "*.dxf" 1))
(foreach dxf files
(command "_.-insert"
(strcat directory "\\" dxf)
'(0. 0. 0.)
""
""
""
)
)
(princ "\n No DXF files found into that folder !")
)
(princ)
)

0 Likes
Accepted solutions (1)
2,459 Views
3 Replies
Replies (3)
Message 2 of 4

Ranjit_Singh
Advisor
Advisor
Accepted solution

replace "setq directory ......" with this and once you select any file in the directory it passes the path of the folder to directory variable


(setq directory (vl-filename-directory (getfiled "Select any file in subject directory" "" "" 2)))
0 Likes
Message 3 of 4

Anonymous
Not applicable

Awesome! Thank you!

0 Likes
Message 4 of 4

Ranjit_Singh
Advisor
Advisor

welcome!

0 Likes