I am trying to make a script file to open a drawing and run a lisp routine. They both work independently just fine, the script file will open the all of the files fine... and the lisp is in the startup suite and works in all the files. But when I tell the script file to open the first drawing then run the lisp it hangs trying to open the next file after running the lisp. I have Filedia set to 0, but the message I get when it goes to open the next is "No canvas exists. Please click New Canvas." (And on top of that... Filedia even set back to 1 still does not display the Dialog box anymore, I have to shut down AutoCAD 2012 and start again then it works.) I Have tried several ways, Opening one at a time then run lisp, and open all files first and then try to run lisp (that closes the file after running) and try and run it again in the next... It will only run the lisp one time and then locks up from there. PLEASE HELP ME... if anybody knows how to fix this... besides me having to learn .NET Thank you!
Getting a look at the lisp/script would give us all a huge head start at getting you pointed in the right direction...
My initial thoughts, sight unseen, would be what is your SDI value set to?
SDI=0 the SCR will open all dwgs and run lisp once in 1st file only. If I open one at a time and running the lisp it will not run the lisp in the 2nd dwg file. Lisp is in Startup Suite (However, it will work at the keyboard).
To avoid any issues with the lisp not being properly auto-loaded into each drawing you should load the lisp file in your script.
My script files for running lisp programs look like this:
(I write my lisp program without a defun C: so it will run when loaded without issuing another command.)
Also if your lisp program does not fully run and exit cleanly then the script will not open the next drawing.
Ok so I fixed the routine to run like you said... And if I open the file manually And type (load"86") it works fine...
(command "-layer" "T" "CAFM-PATT" "ON" "CAFM-PATT" "S" "CAFM-PATT" ""()
(command "-layer" "F" "*" "")
(command "-layer" "T" "CAFM-QURY" "ON" "CAFM-QURY" "")
(command "-layer" "T" "CAFM-TYPE" "ON" "CAFM-TYPE" "")
(command "-layer" "A" "D" "CLEAR PATT-QURY-TYPE" "" "")
(command "-layer" "A" "S" "CLEAR PATT-QURY-TYPE" "" "" "")
(command "-layer" "A" "R" "CLEAR PATT-QURY-TYPE" "" "")
(command ".erase" "ALL" "")
(command "-layer" "A" "R" "_MASTER" "" "")
But when it is in my script file...
It opens TEST1.dwg fine but now I get nothing after that... this is the command prompt now.
Unknown command "DWG"". Press F1 for help.
I made sure there is no extra spaces at the end of the script lines, And I hit enter on the last line...?
Im stumped... Before it would run the lisp once And open the next file but not run the lisp in the second file that opened. Now it will not even run the lisp in the first file it opens...
Here are the new files... FYI , the test2... test3... test4 dwg files are just a saveas of test1 And the new names.
Sorry can't send the SCR I guess it's not a valid acceptable extension, but it's shown above.
Once again thank you for your help.
I tried your script and it ran perfectly for me. Opened each drawing, loaded the lisp, saved and closed.
Seems like yourfiles are OK. Need to look for some other culprit.
Make sure none of your drawings are open i.e. call the script from a drawing that is not one that is named in the script.
To send files that are blocked by their extension,
you can change the extension, ie, .SCR to .RCS,
or put eveything in a zip or 7z container.
Access a broad range of knowledge to help get the most out of your products and services.