Jump to content
GregGleason

Lisp to Plot PDF Stopped Working

Recommended Posts

GregGleason

This code used to work fine for plotting to a .pdf:

 

(defun c:SendToPDFefa()
      (vl-load-com)
    
      (if (setq filename (getfiled "Save File Location" ""  "pdf" 1))
  (progn 
      (command "-plot" "yes" "" "DWG To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)"
          "inches" "landscape" "yes" "Extents"
          "fit" "center" "yes" "acad.ctb" "yes" "a" filename "no" "yes")
                )
          )
      )

Now it fails with this output:

Command: SENDTOPDFEFA
Unknown command "P:\randomfolderstructure\ACADFILENAME.PDF".  Press F1 for help.
Unknown command "NO".  Press F1 for help.
Unknown command "YES".  Press F1 for help.
nil

 

I know IT had been adjusting printers when this happened, but i don't know if that is coincidental.

I have two questions:

 

  1. How does the code need to be adjusted
  2. What could have caused the code to fail

 

Greg

Share this post


Link to post
Share on other sites
rlx

I think things go bad after .... "yes" "acad.ctb" "yes" "a" -> what's up with the "a"? This is the prompt after 'Scale lineweigths with plot scale? (Yes / No).

Best way to check is to park the defun for a moment and do every step of your routine one line at the time by typing it in yourself. That way you see for yourself when the code fails.

 

Other things I usually check : number of prompts for model and paper space are different. Folder you are saving your pdf can be readonly , well , here @ my own work anyway.

Share this post


Link to post
Share on other sites
GregGleason

Thanks rlx, that was helpful. 

 

I think it's almost there but I need a bit more help.

 

I revised the code as follows:

 

(defun c:zzz()
      (vl-load-com)
    
      (if (setq filename (getfiled "Save File Location" ""  "pdf" 1))
  (progn 
      (command "-plot" "yes" "" "DWG To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)"
          "inches" "landscape" "No" "Layout"
          "1:1" "0.00,0.00" "yes" "acad.ctb" "yes" "no" "no" "no" filename "n" "y")
                )
          )
      )

This will at least plot, but it is shifted off to the right (see "2018-141-PI-SK-001.Lisp.pdf").

 

However, when I plot it manually it comes out correct (see "2018-141-PI-SK-001.Manual.pdf").

 

See the plot settings used.

 

How do I adjust to code to get it fixed?

 

Greg

Plot.Setup.jpg

2018-141-PI-SK-001.Lisp.pdf

2018-141-PI-SK-001.Manual.pdf

Share this post


Link to post
Share on other sites
rlx

not entirely sure, believe it has to do with margins that have to match exactly.

 

https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/Plotting-to-PDF-shifts-the-layout-to-the-lower-left-in-AutoCAD.html

 

I usualy plot extents with fit unless I have to deal with multiple borders where I use plot with window, Did read a post somewhere and the advise was not to use Dwg to PDF but to plot using adobe driver but that only works if you have this installed. You could play with a negative x-origin or use a slightly smaller scale like something 1:0.99. Doubt if anyone would even notice. Small difference would not matter much for the plot itself but it can make a big difference for getting autocad to use the proper margins as suggested in the link above.

Share this post


Link to post
Share on other sites
Roy_043

The dialog and the Lisp code show different page sizes:

"ANSI full bleed B (11.00 x 17.00 Inches)"

"ANSI expand B (11.00 x 17.00 Inches)"

 

Share this post


Link to post
Share on other sites
rlx
53 minutes ago, Roy_043 said:

The dialog and the Lisp code show different page sizes:

"ANSI full bleed B (11.00 x 17.00 Inches)"

"ANSI expand B (11.00 x 17.00 Inches)"

 

@ eagle eyed Roy.... totally overlooked this. My first reaction would have been to use the full bleed size but when I saw OP was using this in his dialog and said he used exactly the same settings overlook this... so be aware  roy_043 sees everything 😁

Share this post


Link to post
Share on other sites
BIGAL

Rather than find the original posts this may be useful uses a window rather than a layout. Plots a range of layouts. Maratovich has a real nice plot just about anything routine worth having a look at also.

 

 

plotA3Pdfrange2.lsp

GETVALS3.lsp

Share this post


Link to post
Share on other sites
maratovich

GregGleason

Attach an example of your file with the title block.

 

Share this post


Link to post
Share on other sites
GregGleason
On 10/25/2018 at 2:51 AM, rlx said:

@ eagle eyed Roy.... totally overlooked this. My first reaction would have been to use the full bleed size but when I saw OP was using this in his dialog and said he used exactly the same settings overlook this... so be aware  roy_043 sees everything 😁

 

On 10/25/2018 at 1:52 AM, Roy_043 said:

The dialog and the Lisp code show different page sizes:

"ANSI full bleed B (11.00 x 17.00 Inches)"

"ANSI expand B (11.00 x 17.00 Inches)"

 

 

That was it!  I just ran a test and it came in like I wanted.

 

You guys are the best!

 

Greg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...