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

Script Error

3 REPLIES 3
Reply
Message 1 of 4
christopher.l.evans
447 Views, 3 Replies

Script Error

Wrote a script that loads a lisp which has a cond to load another lisp if the dwg file is the same name as the lsp file.  Runs fine if I load it in any of the specified drawings and outputs pdf files expected.  However when I use it through script pro 2 it crashes on any one of the given drawings.  In the script pro log it the error says it cant read the dwg log file but it still generates 2/3's of the sheets to pdf.  Most of my searches on this came back relating to the script pro log not the drawing file log.  I did see one thread where it talked about adjusting the timeout setting in script pro but I don't know if that is just a best guess for timeout if it is the issue.  Being as it works loaded into a single drawing I havn't messed with it yet.  Any ideas on this?

3 REPLIES 3
Message 2 of 4

Christopher,

just guessing, you didn't show us your code...

If your code have a call to the CLOSE command, just remmove it, the Script Pro 2 will close the each file.

HTH
Henrique

EESignature

Message 3 of 4

Here's the code, only difference is I have a bunch of conditions in the "PDF ALL PACKAGES.LSP" that just have different corresponding dwg and lsp file names.  If I load "PDF ALL PACKAGES.LSP" into any of the drawings in the condition it works fine, it's just when I run it with the script it generates about 2/3's of the sheets to PDF's.  When it does error autocad closes reopens then closes and script pro then asks if I want to see the log file.  The log file from script pro says;

 

[Status summary]

Failed

 

Error while reading log file for M:\CAD\MY DRAWING.dwg

 

So that's where I'm at still so far, perhaps there is a better way to accomplish this.  I have 30 or so drawings I was just going to let run through scriptpro 2.0 until it erred.

 

Script code:

(load "M:\\CAD\\LISP\\PDF ALL PACKAGES.LSP")
PDFALL

 

(defun C:PDFALL (/)
  (cond
    ((=  (getvar 'DWGNAME) "MY DRAWING.DWG")
     (load "M:\\CAD\\LISP\\MY DRAWING.LSP"))
  )
  (C:PDFPACKAGE)
);end

 

(defun C:PDFPACKAGE (/ layouts num )
	(command "_DATALINKUPDATE" "_U" "_K")
	(setq layouts (layoutlist);list all paperspace layouts in the drawing
	      num 0);zero counter
	(repeat (length layouts);Repeats the plot command on all layouts
		(cond
			((= (nth num layouts) "Sheet 5");flags sheet 5 for layer varibles
			    (command "-layer" "p" "n" "ER400|A-CTRAY,ER400|A-EFIXT,ER400|A-EQPM" "");turns on/off xref drawing layers for plot
			);Sheet 5 Condition
			((= (nth num layouts) "Sheet 6");flags sheet 6 for layer varibles
			    (command "-layer" "p" "p" "ER400|A-EQPM" "");turns on/off xref drawing layers for plot
			);;Sheet 6 Condition
			((= (nth num layouts) "Sheet 7");flags sheet 7 for layer varibles
			    (command "-layer" "p" "n" "ER400|A-EQPM" "p" "p" "ER400|A-EFIXT" "");turns on/off xref drawing layers for plot
			);Sheet 7 Condition
			((= (nth num layouts) "Sheet 8");flags sheet 8 for layer varibles
			    (command "-layer" "p" "n" "ER400|A-EFIXT" "p" "p" "ER400|A-CTRAY" "");turns on/off xref drawing layers for plot
			);Sheet 8 Condition
		);; cond
		(command ".-PLOT" "Y" (nth num layouts)
			 "DWG TO PDF.PC3"
			 "ANSI D (34.00 X 22.00 INCHES)"
			 "I" "L" "N" "W" "0,0" "34,22" "1:1" "C" "Y"
			 "Black & White.ctb"
			 "Y" "Y" "N" "N"
			 (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME)) " " (getvar 'CTAB) ".pdf")
	  		 "N" "Y");pdf plot routine
		(setq num (1+ num)); Increment counter
	); end repeat
	(command "-layer" "p" "p" "ER400|A-EFIXT,ER400|A-EQPM" "");turns plot layers off back on
); end

 

Message 4 of 4

Hi Christopher,

 

unfortunately, I can't see anything wrong with your codes... nor the error reason...

 

Henrique

 

 

 

EESignature

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

Post to forums  

Autodesk Design & Make Report

”Boost