Lisp to Detect PC3 Differences with extra Plot sequence prompt

Lisp to Detect PC3 Differences with extra Plot sequence prompt

paullimapa
Mentor Mentor
589 Views
6 Replies
Message 1 of 7

Lisp to Detect PC3 Differences with extra Plot sequence prompt

paullimapa
Mentor
Mentor

I noticed that with the AutoCAD pre-configured shipped printers like DWG to PDF.pc3 or DWF6 ePlot.pc3 (including the built-in PDFDWFDXB or Raster File Format drivers) all are missing an additional prompt request during the plot sequence. For example with DWG to PDF.pc3 this is the sequence:

-PLOT
Detailed plot configuration? [Yes/No] <No>: 
Enter a layout name or [?] <Model>: 

Enter a Page Setup <>: 
Enter an output device name or [?] <DWG To PDF.pc3>:

Enter File name

But with any other plotter device I add using even an AutoCAD provided drivers (AdobeCalCompHewlett-Packard & Xerox drivers all listed under Manufacturers on the Add-A-Plotter Wizard)., there's an extra prompt "Write the plot to a file [Yes/No] <Y>:"  regardless if I've already preset the port to File or not. For example, I added print driver I call AdobePS2.pc3 using AutoCAD's Postscript Level II built-in driver. Now that additional prompt appears:

-PLOT
Detailed plot configuration? [Yes/No] <No>: 
Enter a layout name or [?] <Model>: 

Enter a Page Setup <>: 
Enter an output device name or [?] <AdobePS2.pc3>:

Write the plot to a file [Yes/No] <Y>:

Enter File name

 

This really throws off my Plot Script files. Is there a way to detect when this prompt will occur?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Accepted solutions (1)
590 Views
6 Replies
Replies (6)
Message 2 of 7

Sea-Haven
Mentor
Mentor

PDF only has write to file hence no option. Just add what device your plotting to with a IF so pdf jpg etc dont have extra line in your plot routine.

 

Just a comment we had multi plot options using menu's so hard coded to correct pc3. Also checking user name so would plot to printer near them in a multi story office.

 

SeaHaven_0-1658021556173.png

 

0 Likes
Message 3 of 7

paullimapa
Mentor
Mentor

Thanks for your reply. In a very controlled environment where users cannot add their own printers or rename existing ones then this may not be an issue. But I'm actually trying to accommodate for a bit of flexibility. Unfortunately, even within the printer driver sets AutoCAD provides like Adobe which creates Postscript files, there's that extra prompt. I guess that's because back in the old days, those Postscript files would be sent directly to the printer instead of to file. 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 7

phanaem
Collaborator
Collaborator
Accepted solution

Hi

 

I found a trick for the "command" version., not elegant, and require running the command twice.

At the first run, assume it ask to plot on a file or not, answer "Yes" then complete the command with "No".

Then check cmdactive sysvar. It should be 0 or >0. Then you would know what prompt is required.

Something like this:

(defun c:test ( / filename)
  (setq filename "D:\\Test")
  (command
    "-plot"
    "No" ;detailed config
    ""   ;layout
    ""   ;page setup
    ""   ;output device
    "Yes";Plot to file? OR filename
    "No" ;filename OR Save
    "No" ;Save OR Proceed
  )
  (if
    (> (getvar 'cmdactive) 0)
    (command
      "no" ;end previous Plot Command
      "-plot"
      "No" ;detailed config
      ""   ;layout
      ""   ;page setup
      ""   ;output device
      "No" ;Plot to file
      "No" ;Save
      "Yes";Proceed
    )
    (command
      "-plot"
      "No" ;detailed config
      ""   ;layout
      ""   ;page setup
      ""   ;output device
      filename
      "No" ;Save
      "Yes";Proceed
    )
  )
  (princ)
)
      
      
Command:
Command: *Cancel*

Command: TEST -plot Detailed plot configuration? [Yes/No] <No>: No
Enter a layout name or [?] <Model>:
Enter a page setup name <>:
Enter an output device name or [?] <DWG To PDF.pc3>:
Enter file name <Drawing1.pdf>: Yes
Save changes to page setup [Yes/No]? <N> No
Proceed with plot [Yes/No] <Y>: No
Command: -plot Detailed plot configuration? [Yes/No] <No>: No
Enter a layout name or [?] <Model>:
Enter a page setup name <>:
Enter an output device name or [?] <DWG To PDF.pc3>:
Enter file name <Drawing1.pdf>: D:\Test
Save changes to page setup [Yes/No]? <N>
No Proceed with plot [Yes/No] <Y>: Yes
Effective plotting area:  5.94 wide by 11.00 high

Plotting viewport 2.

Command:
Command:
Command:
Command: _plot
Command: TEST -plot Detailed plot configuration? [Yes/No] <No>: No
Enter a layout name or [?] <Model>:
Enter a page setup name <>:
Enter an output device name or [?] <HP LaserJet Pro M428-M429 PCL-6 (V4) (Network)>:
Write the plot to a file [Yes/No] <N>: Yes
Enter file name <Drawing1.plt>: No
Save changes to page setup [Yes/No]? <N> No
Proceed with plot [Yes/No] <Y>: no
Command: -plot Detailed plot configuration? [Yes/No] <No>: No
Enter a layout name or [?] <Model>:
Enter a page setup name <>:
Enter an output device name or [?] <HP LaserJet Pro M428-M429 PCL-6 (V4) (Network)>:
Write the plot to a file [Yes/No] <N>: No
Save changes to page setup [Yes/No]? <N> No
Proceed with plot [Yes/No] <Y>: Yes
Effective plotting area:  5.76 wide by 10.67 high

Plotting viewport 2.

Command:

 

Message 5 of 7

Sea-Haven
Mentor
Mentor

I dont understand why your pushing write to file ? Do you not have access to a printer and say are going elsewhere to plot at another office maybe ?

 

Again you could make choices in 1 lisp I have Multi radio buttons 2col as per image so write the output to suit, we had like 10 printers/plotters yes all hard coded names.

 

SeaHaven_0-1658104189471.png

 

 

 

 

(if (not ah:buttscol)(load "Multi Radio buttons 2col.lsp"))
(if (= ah:but nil)(setq ah:but 1))
(if (= ah:but2 nil)(setq ah:but2 1))
(setq lst1 (list "Select printer" "Printer " "printer 2" "Printer 3" "printer 4" "Printer 5" "Printer 6"))
(setq lst2 (list "Select output" "File" "To printer"))
(ah:buttscol ah:but ah:but2 "Select printer" lst1 lst2)

(setq ans1 (nth ah:2col lst1))
(setq ans2 (nth ah:2col2 lst2))

 

 

 Just put IF's in your plot code so respond "To file" etc (if (= ans2 "File")(command "Y") (command "N")) a cond for printer name, all my plot routines have this and same for filename no user input.

Enter an output device name or [?] <HP LaserJet Pro M428-M429 PCL-6 (V4) (Network)>:

Enter an output device name or [?] printername

 

You can save the previous answer into ah:but & ah:but2 for repeat plotting use button number look at ah:col ah:col2

0 Likes
Message 6 of 7

paullimapa
Mentor
Mentor

Thanks for your reply and the very nicely designed dialog.

Unfortunately, the write to file or not prompt is built-in to the print driver.

As I mentioned in my original post, there are drivers that Autodesk provides with AutoCAD that don't have that prompt during the plot sequence. But there are also drivers Autodesk provides with AutoCAD that do have that prompt. So the code whether written in script form or lisp would have to accommodate for this assuming there's a way the driver can be analyzed to determine one vs the other.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 7

paullimapa
Mentor
Mentor

Yours is an excellent solution. I've modified the code to just give me an alert instead of following through with the print.  Thanks for this very smart way of resolving the problem.

 

; by Stefan Muntean modified by Paul Li
; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-detect-pc3-differences-with-extra-plot-sequence-prompt/m-p/11302830/highlight/false#M433841
; pc3tst checks to see if output device has the additional built-in print to file prompt
; Argument: 
; outputdev-arg = name of output device

(defun pc3tst (outputdev-arg / cmdecho menuecho)
  (setq cmdecho(getvar"cmdecho") menuecho(getvar"menuecho"))
  (setvar"cmdecho"0)(setvar"menuecho"0)
  (command
    "-plot"
    "No" ;detailed config
    ""   ;layout
    ""   ;page setup
    outputdev-arg   ;output device
    "Yes";Plot to file? OR filename
    "No" ;filename OR Save
    "No" ;Save OR Proceed
  )
  (if
    (> (getvar 'cmdactive) 0)
    (progn
     (command "_No") ;end previous Plot Command
     (alert(strcat "[" outputdev-arg "]\nDoes have Print To File Prompt."))
    )
    (alert(strcat "[" outputdev-arg "]\nDoes NOT have Print To File Prompt."))
  )
  (setvar"menuecho"menuecho)(setvar"cmdecho"cmdecho)(princ)
) ; defun pc3tst

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes