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
7893 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 2 of 47
hmsilva
in reply to: kameron1967

Try to add

 

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

 Not tested...

 

HTH

Henrique

 

EESignature

Message 3 of 47
kameron1967
in reply to: hmsilva

That looks promising, but I tested the command and got this response.  That said, the routine still does not allow me to plot properly.  Any other suggestion?  Nice try though. 🙂

 

Command: (initcommandversion 1)
T

 

But when I ran the routine, it's giving me this error still:

 

Command: half
Unknown command "HALF".  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.

 

 

Message 4 of 47
hmsilva
in reply to: kameron1967


@kameron1967 wrote:

That looks promising, but I tested the command and got this response.  That said, the routine still does not allow me to plot properly.  Any other suggestion?  Nice try though. 🙂

 

Unknown command "INITCOMMANDVERSION".  Press F1 for help.


copy/paste into command line

Command: (INITCOMMANDVERSION 1)
T
you should receive a T

 

EDIT:

try to change the System variable CLIPROMPTUPDATE to 1

Again not test, I don't have AutoCAD 2013 in this pc...

For the command line "PLOT" try "-PLOT"

 

Henrique

EESignature

Message 5 of 47
kameron1967
in reply to: hmsilva

Hi Henrique - sorry, I guess this one is actually Autocad 2012. The CLIP..command does not exist. The "init.." command works, but routine still does not plot for some reason..
Message 6 of 47
hmsilva
in reply to: kameron1967

Try to enter -plot at command line, fallow the prompts and try to finalize the plot command.

 

Henrique

EESignature

Message 7 of 47
kameron1967
in reply to: hmsilva

Yes, I tried "-plot" as well but this autocad environment does not work. I have a 2012 running at a different location and the lisp works fine. That was why I thought this was version 2013, but in looking closer, it is still 2012. I might look to dotnet to see if that would resolve the issue (at least for this computer!)

 

Regarding your command line follow through, yes that command line process still works.  It's when I try to use lisp on it - that's when it gives me the unknown command error.  Weird, hu?

Message 8 of 47
hmsilva
in reply to: kameron1967

You're welcome, kameron
unfortunately, I did not give much help...

Henrique

EESignature

Message 9 of 47
kameron1967
in reply to: hmsilva

No worries.  I appreciate you efforts to help anyways, Henrique!  If I find the solution, I'll be sure to let you know. 🙂

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

Check to make sure you have the PC3 and pagesizes available. I was able to run your command and it stopped there on my machine. It could be that they are not available in your support path. That makes sense since I know I do not have those. one way to test is to manually walk through the -PLOT command and follow the steps shown in your code and see where it breaks.

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Message 11 of 47
dmfrazier
in reply to: matt.worland

"Check to make sure you have the PC3 and pagesizes available."

 

I suspect you are (at least partially) correct.  In addition to the PC3, it could also be the CTB file and/or the Windows printer (assuming the PC3 references one).

 

To the OP: This points out the importance of error handling in programming.  If a program depends on other things to run properly, there should be checks for those dependencies, and informative error messages issued to the user when they are not available.  This is one of the things that makes good programmers good.

Message 12 of 47
kameron1967
in reply to: dmfrazier

Before I input the information into the routine, I do a plot first through the dialogue box - where all the page setup and ctb files are selected. After a successful plot, I then go into the command line and type in '-plot', answering 'yes' and enter enter through until it plots. I then copy those lines and transfer the plotter, page size, ctb file into the routine. I'm confident that they all match. I check the pc3 and ctb file and they all exist and are in the path. Any other suggestions? Thanks again.
Message 13 of 47
matt.worland
in reply to: kameron1967

Wierd, based on your command line output it is erroring out right after you enter your pagesize. When I walk through the command I dont see a need for the "" between the size and orientation.

 

Can you post your command line history when you walk through the -plot command?

 

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Message 14 of 47
kameron1967
in reply to: dmfrazier

Here is the -plot sequence:

 

Command: -PLOT
Detailed plot configuration? [Yes/No] <No>: y
Enter a layout name or [?] <LAYOUT1>:
Enter an output device name or [?] <\\PRINTERX>:
Enter paper size or [?] <18" x 24">:
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.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>: y

Message 15 of 47
dmfrazier
in reply to: kameron1967

Enter paper size or [?] <18" x 24">:

I think this is where the LISP is going wrong.

In your code, this is what you have entered for the response to the page size:

"Oce18X24"

See the difference?

I can't test this for you, but hopefully that will do the trick.

Note: Because the page size you want to specify has quote marks in it, be sure to enter it carefully.

Message 16 of 47
hmsilva
in reply to: kameron1967

kameron,

just another idea,

 

when I set cmdecho to 0 and run your code I get:

 

Command: half
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.
...

 

just like the one you posted in Message #3, but if I set cmdecho to 1 and run your code I get:

 

Command: half
PLOT Detailed plot configuration? [Yes/No] <No>: Y
Enter a layout name or [?] <Model>: Enter an output device name or [?] <None>:
ABC.pc3 <ABC.pc3> not found.
Enter an output device name or [?] <None>: Oce18X24 <Oce18X24> not found.
Enter an output device name or [?] <None>: Can not use None device for plotting.
Command: Landscape Unknown command "LANDSCAPE".  Press F1 for help.
Command: No Unknown command "NO".  Press F1 for help.
Command: Extents Unknown command "EXTENTS".  Press F1 for help.
Command: FIT Unknown command "FIT".  Press F1 for help.
Command: CENTER Unknown command "CENTER".  Press F1 for help.
...

 

so, the code errors at the output device name and I think that's where the error is occurring, see if the output device name is is well written...

For easier debugging, set cmdecho to 1 and run your code.

 

HTH

Henrique

 

EESignature

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

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

 

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
Message 18 of 47
dmfrazier
in reply to: hmsilva

Good call on the CMDECHO thing.  That definitely makes it easier to see where the error is occurring.

You might have realized this already, but just in case....

The reason you get the error at "ABC.PC3" (as the response to the "Enter an output device name or [?]" prompt) is that you don't have a PC3 of that name in any path that your AutoCAD is set up to search.  (The OP doesn't get an error at this point because he has that printer config file.)  The rest of the errors you get as the "script" continues are due to the fact the PLOT command is still expecting to get an answer to the device question, but the subsequent responses in the script aren't satifying that expectation (they're meant to answer different questions).

If you had a valid "ABC.PC3" in AutoCAD's path, the "script" would probably fail at the next prompt for the page size, which you probably also don't have (it may be invalid/nonexistent or associated with a device you don't have).

Message 19 of 47
hmsilva
in reply to: dmfrazier


@dmfrazier wrote:

Good call on the CMDECHO thing.  That definitely makes it easier to see where the error is occurring.

You might have realized this already, but just in case....

The reason you get the error at "ABC.PC3" (as the response to the "Enter an output device name or [?]" prompt) is that you don't have a PC3 of that name in any path that your AutoCAD is set up to search.  (The OP doesn't get an error at this point because he has that printer config file.)  The rest of the errors you get as the "script" continues are due to the fact the PLOT command is still expecting to get an answer to the device question, but the subsequent responses in the script aren't satifying that expectation (they're meant to answer different questions).

If you had a valid "ABC.PC3" in AutoCAD's path, the "script" would probably fail at the next prompt for the page size, which you probably also don't have (it may be invalid/nonexistent or associated with a device you don't have).


Hi
please reread my post...

I was comparing the resulting echo (with cmdecho set to 0) from the OP routine, (I know I don't have the "ABC.PC3")... Smiley Wink

My echo:

Command: half
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.
...

The OP echo, posted in Message #3

 

Command: half
Unknown command "HALF".  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.
...

 

are identical, so, I think the error source is the same as mine, the output device name... just a guess, let's hope that the OP turms the cmdecho on...

 

Henrique

EESignature

Message 20 of 47
dmfrazier
in reply to: hmsilva

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

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

Post to forums  

Autodesk Design & Make Report

”Boost