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

Lisp to plot does not work in 2013

46 REPLIES 46
SOLVED
Reply
Message 1 of 47
kameron1967
7901 Views, 46 Replies

Lisp to plot does not work in 2013

Hi guys,

 

I am not sure what's preventing me from plotting in Autocad 2013, as I am able to run this routine through 2012 and it works.  Has Autodesk do away with the command line plot?  Thanks in advance! 🙂

 

(defun C:HALF ()
(COMMAND "PLOT" "Y" "" "ABC.pc3" "Oce18X24" "" "Landscape" "No" "Extents" "FIT" "CENTER" "Yes" "Halfsize.ctb" "yes" "yes" "No" "No" "N" "Y" "Y")
(PRINC)
)

46 REPLIES 46
Message 21 of 47
hmsilva
in reply to: dmfrazier


@dmfrazier wrote:

"...are identical, so, I think the error source is the same as mine, the output device name... just a guess..."

 

I don't wish to make a mountain out of a mole-hill, but they are actually not identical.  (I did read and re-read your post, which I thought was helpful, but just slightly inaccurate.)

 

Your commandline sequence indicates that the LISP command "HALF" is recognized and begins to run.  The "unknown command" prompt only appears when "LANDSCAPE" is offered (within the script), as a response to the command prompt after the PLOT command has aborted. The reason for this is revealed when CMDECHO is turned on.

 

However, the OP's commandline sequence reveals that the LISP command "HALF" itself is not recognized ("unknown command") right from the get-go.  (I don't know why this happened since I don't know what his LISP looked like at the time it was run.)  The subsequent errors are for essentially the same reason as they are in your commandline.

 

"let's hope that the OP turms the cmdecho on"

 

I suspect the OP has taken matt.worland's solution and run with it.


dmfrazier,

my apologies, you're completely correct, only after post my msg, I saw that the echo was not identical...My bad Smiley Embarassed

 

Henrique

EESignature

Message 22 of 47
dmfrazier
in reply to: hmsilva

Pas de problème. C'est tout bon.

(I don't really know French, so I sure hope Google Translate is accurate. Smiley Wink)

Message 23 of 47
kameron1967
in reply to: matt.worland


@matt.worland wrote:

Try this code to see if it helps with the new settings based upon what you sent over

(defun C:HALF ()
	(COMMAND "PLOT" "Y" "" "\\PRINTERX" "18\" x 24\"" "Inches" "Landscape" "No" "Extents" "FIT" "CENTER" "Yes" "Halfsize.ctb" "yes" "yes" "No" "No" "No" "No" "Yes")
(PRINC)
)

 


Matt, sorry it's taken awhile, but I did put the "inches" in between the papersize and landscape.  Is this the only change?  It's still not working.  cmdecho is always set to 1.  Thanks.

Message 24 of 47
dmfrazier
in reply to: kameron1967

Pardon my intrusion, but I think we all could benefit from seeing (1) a copy of the LISP as you have it written right now, and (2) a copy of what shows up on your commandline when you run it (with command echo on, just for yucks).

Message 25 of 47
kameron1967
in reply to: dmfrazier

No problem. I had posted it on the very top, but here it is:

(defun C:HALF ()
(COMMAND "-PLOT" "Y" "" "PC3FILE.pc3" "18X24" "Inches" "Landscape" "No" "Extents" "FIT" "CENTER" "Yes" "HALF.ctb" "yes" "yes" "No" "No" "N" "Y" "Y")
(PRINC)
)

The pc3file.pc3 does exist (not sure if it's in the support path - that might be the problem), and the half.ctb file also exists.

Here's what the command gives me. Like I said, the routine works in another office (running either Autocad 2012 or 2013), but not in this office.

Command: HALF
Unknown command "INCHES". Press F1 for help.
Unknown command "LANDSCAPE". Press F1 for help.
Unknown command "NO". Press F1 for help.
Unknown command "EXTENTS". Press F1 for help.
Unknown command "FIT". Press F1 for help.
Unknown command "CENTER". Press F1 for help.
Unknown command "YES". Press F1 for help.
Unknown command "CTB". Press F1 for help.
Unknown command "YES". Press F1 for help.
Unknown command "NO". Press F1 for help.
Unknown command "NO". Press F1 for help.
Unknown command "NO". Press F1 for help.
Unknown command "N". Press F1 for help.
Unknown command "Y". Press F1 for help.
Unknown command "Y". Press F1 for help.

Message 26 of 47
dmfrazier
in reply to: kameron1967

Well, now it appears to be failing just before "Inches" is fed to the command line from the script.  This would lead me to believe that there is something wrong with the "18x24" you have placed in the LISP to answer the plot command's request for a page size.  (The PC3 file is apparently found, otherwise you would have gotten a different prompt at the point where the script enters the "device" name.)

If you go back and look at the LISP that matt.worland posted, you will see that his response to that prompt is different from what you apparently have in your code now.  I don't know which page size it should be, but it is important to get it right.  It must be a page size that exactly matches one that is available to the printer defined in the PC3 file.  Also, note that if there are quote marks (inch marks) in the page size, these must be handled as shown in matt.worland's code.

If this is working in another office, then I would guess that they have a different printer or driver version that recognizes the "18x24" page size.

Message 27 of 47
hmsilva
in reply to: kameron1967

kameron1967,
only for testing purposes, please run this quick and dirty test code

 

(defun c:test (/ ACLYT ACPLT)
  (if
    (member "PC3FILE.pc3"
	    (vl-directory-files
	      (vla-get-PrinterConfigPath
		(vla-get-Files (vla-get-Preferences (vlax-get-acad-object)))
	      )
	      "*.pc3"
	      1
	    )
    )
     (progn
       (setq aclyt (vla-get-ActiveLayout
		     (vla-get-ActiveDocument (vlax-get-acad-object))
		   )
       )
       (setq acplt (vla-get-ConfigName aclyt))
       (vla-Put-ConfigName aclyt "PC3FILE.pc3")
       (if
	 (member "18X24"
		 (vlax-safearray->list
		   (vlax-variant-value (vla-GetCanonicalMediaNames aclyt))
		 )
	 )
	  (prompt "\nPc3 and paper exist")
	  (prompt "\nPc3 exist and paper don't exist")
       )
       (vla-Put-ConfigName aclyt acplt)
     )
     (prompt "\nPc3 don't exist")
  )
  (princ)
)

 

and let us know what you receive at the commandline.

 

Henrique

EESignature

Message 28 of 47
kameron1967
in reply to: hmsilva

Thanks.  I will test it when I am at that location tomorrow.  Thanks!!

Message 29 of 47
dmfrazier
in reply to: hmsilva

"...this quick and dirty test code"

Nicely done. (Tha's what I's talkin' 'bout!)

 

To the OP: hmsilva's code assumes your LISP is specifying a PC3 file named "PC3FILE.pc3" and a page size named "18x24".  Please be sure the code you load and run includes the PC3 file name and page size that is in your LISP, otherwise it will not tell you what we (you) need to know.

 

Message 30 of 47
hmsilva
in reply to: dmfrazier


@dmfrazier wrote:

"...this quick and dirty test code"

Nicely done. (Tha's what I's talkin' 'bout!)

 

 


Thank you dmfrazier!

 


@dmfrazier wrote:

To the OP: hmsilva's code assumes your LISP is specifying a PC3 file named "PC3FILE.pc3" and a page size named "18x24".  Please be sure the code you load and run includes the PC3 file name and page size that is in your LISP, otherwise it will not tell you what we (you) need to know.

 


1+

Henrique

EESignature

Message 31 of 47
kameron1967
in reply to: hmsilva

Thanks for the clarification, dmfrazier.  I updated the three locations accordingly and tested it.  This is what I got:

Pc3 exist and paper don't exist

Now, I then tested the FULLcommand to plot full size - same PC3, just different page size - which plotted successfully.  I then updated the plot test routine with the new page size and then run the routine.  I am still getting the same message in that the
Pc3 exist and paper don't exist.  Can anyone test to see if the page size portion of the routine is working properly?  After that successful FULL plot, I then typed in "-plot", 'y" .....until I got the page setup.  I then copied that page size into the routine.  I understand that if I have a quotation mark, I'd need the '\' in front of it, which I did that.  But the routine should have said that it's found the page size, but it didn't.  That's why I wonder if the pagesize portion is working properly or not.  Please test it and let me know.  Thanks in advance Henrique and dmfrazier! 🙂

Message 32 of 47
dmfrazier
in reply to: kameron1967

I had tested hmsilva's Test LISP with a PC3 name and page size that I have and the routine worked as intended.  It told me when neither were there, or if the PC3 was there but the page size wasn't.  So I think the Test LISP is sound.

On the PC where this is NOT working, can you show us (with screenshots) a list of the page sizes available (just show a page that includes the page size you would like to use) when you modify the PC3 file?

Message 33 of 47
kameron1967
in reply to: dmfrazier

Here is a screenshot of the both the routine and the screen shot of the manual plot to make everything clear. This would help me and you both narrow down what the issues may be.

First, the routine:
(defun C:HALFPLOT ()
(COMMAND "-PLOT" "Y" "" "Oce TDS320.pc3" "Oce C+ 18x24 in (Landscape)" "INCHES" "Landscape" "No" "Extents" "FIT" "CENTER" "Yes" "Halfsize_Mono-Rev10.ctb" "yes" "yes" "No" "No" "N" "Y" "Y")
(PRINC)
)
(C:HALFPLOT)

Here is the manual version, which executed successfully:

Command: -PLOT
Detailed plot configuration? [Yes/No] <No>: Y

Enter a layout name or [?] <DRAWING1>:
Enter an output device name or [?] <Oce TDS320>:
Enter paper size or [?] <Oce C+ 18x24 in (Landscape)>:
Enter paper units [Inches/Millimeters] <Inches>:
Enter drawing orientation [Portrait/Landscape] <Landscape>:
Plot upside down? [Yes/No] <No>:
Enter plot area [Display/Extents/Layout/View/Window] <Extents>:
Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <Fit>:
Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>:
Enter plot style table name or [?] (enter . for none) <Halfsize_Mono-Rev10.ctb>:
Plot with lineweights? [Yes/No] <Yes>:
Scale lineweights with plot scale? [Yes/No] <Yes>:
Plot paper space first? [Yes/No] <No>:
Hide paperspace objects? [Yes/No] <No>:
Write the plot to a file [Yes/No] <N>:
Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>:
Effective plotting area: 24.00 wide by 17.14 high

Plotting viewport 1.

Message 34 of 47
hmsilva
in reply to: kameron1967

Hi kameron,

 

try the revised code...

 

(defun c:test (/ ACLYT ACPLT PAPER PAPERLST)
  (if
    (member "Oce TDS320.pc3"
	    (vl-directory-files
	      (vla-get-PrinterConfigPath
		(vla-get-Files (vla-get-Preferences (vlax-get-acad-object)))
	      )
	      "*.pc3"
	      1
	    )
    )
     (progn
       (setq aclyt (vla-get-ActiveLayout
		     (vla-get-ActiveDocument (vlax-get-acad-object))
		   )
       )
       (setq acplt (vla-get-ConfigName aclyt))
       (vla-Put-ConfigName aclyt "Oce TDS320.pc3")
       (setq paper (vlax-safearray->list (vlax-variant-value (vla-GetCanonicalMediaNames aclyt))))
       (foreach x paper (setq paperlst (cons (vla-GetLocaleMediaName aclyt x) paperlst)))
       (if
	 (member "Oce C+ 18x24 in (Landscape)" paperlst
	 )
	  (prompt "\nPc3 and paper exist")
	  (prompt "\nPc3 exist and paper don't exist")
       )
       (vla-Put-ConfigName aclyt acplt)
     )
     (prompt "\nPc3 don't exist")
  )
  (princ)
)

 

Henrique

EESignature

Message 35 of 47
dmfrazier
in reply to: hmsilva

I find it curious that the PC3 name and page size keep changing.  But I digress...

For what it's worth, this Test LISP works fine for me.

To the OP: When I said "screenshot", I meant an actual picture of the list of page sizes you see to choose from when you edit the PC3 file (Plotter Configuration Editor, Custom Properties).  I think it will help if we can see what you see.  My theory is that the list will look different on the two PCs.

Another thing that would help is to know if this PC3 references a Windows System printer or other.  If so, what is the printer, and if not, what driver (manufacturer/model) does it print to?

 

 

Message 36 of 47
kameron1967
in reply to: hmsilva

Nope. copy/pasted your updated routine, save and reloaded it, but it's still not finding it.  It's so close to my nose that I'm not seeing it.  That's why it's great that you both are helping me troubleshoot, but it's so close...and yet so far! 🙂


Command: ap
APPLOAD TESTPLOT.LSP successfully loaded.
Command:
Pc3 exist and paper don't exist

 

 

ALSO, I loaded my half routine and run it - this is what I got now when I load this routine:

 

(defun C:HALFPLOT ()
(COMMAND "-PLOT" "Y" "" "Oce TDS320.pc3" "Oce C+ 18x24in (Landscape)" "INCHES" "Landscape" "No" "Extents" "FIT" "CENTER" "Yes" "Halfsize_Mono-Rev10.ctb" "yes" "yes" "No" "No" "N" "Y" "Y")
(PRINC)
)
(C:HALFPLOT)

 

Command: ap
APPLOAD PLOT.LSP successfully loaded.

Command:
Unknown command "INCHES".  Press F1 for help.

Unknown command "LANDSCAPE".  Press F1 for help.

Unknown command "NO".  Press F1 for help.

Unknown command "EXTENTS".  Press F1 for help.

Message 37 of 47
kameron1967
in reply to: dmfrazier

Here is the image that you've asked for.  Thanks.

 

dmfrazier - can you test that routine and change the page setup to reflect your plotter information?  I'd like to know if it will tell you whether both the plotter and page size is found.  If it says "none are found" - that still does not tell me if the page size portion is working properly or not.  Please change them so that the page setup for your plotter is in that test routine and let me know if it said that it found them.  Thanks.

Message 38 of 47
dmfrazier
in reply to: kameron1967

"...can you test that routine and change the page setup to reflect your plotter information?"

 

I did, and as I noted before it works fine.  When I put a PC3 file and page size that are valid for me, it tells me it found both.  (Obviously, it would tell me it found neither if I were to leave it the way hmsilva wrote it, since I have neither the PC3 nor the device set up.)

 

Thanks for the image, but that's not exactly what I meant either.  I wanted to see the list of page sizes supported by the printer you are trying to print to.  You can get to the list while editing a PC3 file.

 

Just on a "hunch", let's try this (because we're adventurous people):

In your plot LISP, change the page size from "Oce C+ 18x24in (Landscape)" to "Oce C+ 18x24in" and see if it runs then.

Message 39 of 47
hmsilva
in reply to: kameron1967


kameron1967 wrote:

 

...can you test that routine and change the page setup to reflect your plotter information?  I'd like to know if it will tell you whether both the plotter and page size is found.  Thanks.



kameron,

it will tell that whether both the plotter and page size is found...

From message #33

"Oce C+ 18x24 in (Landscape)"

from message #36

"Oce C+ 18x24in (Landscape)"

 

the name is not the same, tou have a space between 24 and in...

the names must be the correct one...

 

Henrique

EESignature

Message 40 of 47
dmfrazier
in reply to: hmsilva

Oh, the suspense is killing me! Smiley Wink

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

Post to forums  

Autodesk Design & Make Report

”Boost