Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script file to open multiple dwg file and run a lisp not working in ACAD 2012

7 REPLIES 7
Reply
Message 1 of 8
iharper
14115 Views, 7 Replies

Script file to open multiple dwg file and run a lisp not working in ACAD 2012

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 Smiley Frustrated Thank you!

7 REPLIES 7
Message 2 of 8
Patchy
in reply to: iharper
Message 3 of 8
Southernamp
in reply to: iharper

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?

Message 4 of 8
iharper
in reply to: iharper

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). 

Message 5 of 8
M_Hensley
in reply to: iharper

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:

 

OPEN

"drawingname"

(load "lispfilename")

QSAVE

CLOSE

OPEN...

 

(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.

Message 6 of 8
iharper
in reply to: iharper

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...

FILEDIA
0
OPEN
"C:\_Isaac\TEST-DRAWINGS\TEST1.DWG"
(load"86")
QSAVE
CLOSE
OPEN
"C:\_Isaac\TEST-DRAWINGS\TEST2.DWG"
(load"86")
QSAVE
CLOSE
OPEN
"C:\_Isaac\TEST-DRAWINGS\TEST3.DWG"
(load"86")
QSAVE
CLOSE
OPEN
"C:\_Isaac\TEST-DRAWINGS\TEST4.DWG"
(load"86")
QSAVE
CLOSE
FILEDIA
1

 

It opens TEST1.dwg fine but now I get nothing after that... this is the command prompt now.

Command: "C:\_Isaac\TEST-DRAWINGS\TEST1.DWG"
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.

Message 7 of 8
M_Hensley
in reply to: iharper

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.

Message 8 of 8
stevor
in reply to: iharper

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.

S

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost