
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this code which I modified from another question (thanks to @jdiala and to @hmsilva, http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/auto-insertion-of-multiple-dwg-into-a...
It is supposed to insert every dwg files from a folder in a grid like fashion. After inserting the first dwg at coord (10 , 20 , 0), it increases x by deltax. If x is smaller than a max value of 10000, the loop continues and the second dwg will be inserted at coord (460, 20, 0). After some iteration, x eventually becomes greater than 10000, and x is reset to its original value of 10, and y is increased by deltay to 340. So, the next iteration, the program should insert a dwg at coordinate (10, 340, 0), effectively starting a new row over the first one.
But, instead, the program crashes, the message is something like: Error: Incorrect function : 10 . So, it seems it bugs when trying to launch the insert command with a x value of 10.
(defun c:MyInsert ( / x y) (vl-load-com) (setq x 10) (setq y 20)
(setq deltax 450)
(setq deltay 320)
(setq max_x 10000)
(foreach path (vl-directory-files "C:/Users/My Folder/" "*.dwg") (command "-insert" (strcat "C:/Users/My Folder/" path) (list x y 0.0) "" "" "") (setq x (+ x deltax))
(if (> x max_x) (
(setq x 10)
(setq y (+ y deltay))
)
) ) (princ) )
Anything? Might be something simple actually, I just don't understand...
Regards
Solved! Go to Solution.