All of the (cad....)'s below need 1 d removed, should be (car ...) (cadr
...) (caddr ...)
(setq insertpoint
(list
(+ 10 (cadr insertpoint))
(caddr insertpoint)
(cadddr insertpoint)
)
)
"The Real JD" wrote in message
news:4873738@discussion.autodesk.com...
I added the path (as seen below) it worked for finding the first one, but it
gets stuck on the insertion giving an error.
I'll modify the code to what you posted. Thanks!
(setq dir1 (dos_getdir))
(setq lst1 (vl-directory-files dir1 "*.dwg" 1))
(setq insertpoint (list 0 0 0))
(foreach mydwg lst1
(command "-insert" (strcat dir1 mydwg)
(setq insertpoint
(list
(+ 10 (cadr insertpoint))
(caddr insertpoint)
(cadddr insertpoint)
)
)
)
)
"Kevin Nehls" wrote in message
news:4873721@discussion.autodesk.com...
The Real JD wrote:
> This is what i've got so far..
>
> (defun c:quikinsert ()
> (setq dir1 (dos_getdir))
--> Take a look at the documentation for dos_getdir, there's some
additional parameters you can pass to customize it a little more if you
like.
> (setq lst1 (vl-directory-files dir1 "*.dwg" 1))
Crap! Forgot one major point, you need to append the directory to each
drawing....
(setq lst1
(mapcar '(lambda (x)
(strcat dir1 x))
lst1)
)
> (setq insertpoint (list 0 0 0))
> (foreach mydwg lst1 ()
> (command "-insert" mydwg
(command "-insert" mydwg insertpoint "1" "1" "0")
--> This should be your entire INSERT command
Now set insertpoint to the new value offset for the new location
> (setq insertpoint
> (list
> (+ 10 (cadr insertpoint))
> (caddr insertpoint)
> (cadddr insertpoint)
> ))
> )
--> Remove that paren, your command should finish as I show above.
> ))
>
> It looks like it will go to insert but can't find the file because it's
not
> part of the path.
> Should i be doing this in another way? Or is there another variable list
to
> get the path with the drawings, and not just the drawing files name....
Sorry about that, the fix is above.