custom .pc3 not supported

custom .pc3 not supported

harimadhavan66
Explorer Explorer
2,119 Views
43 Replies
Message 1 of 44

custom .pc3 not supported

harimadhavan66
Explorer
Explorer

Hi Everyone, Good day to all, Im a beginner with lisp knowledge

 

I'm trying to customize a LISP routine to create PDFs using my own .pc3 and ctb file — specifically, I'm using "Foxit PDF Editor Printer.pc3". I tried replacing the default printer and setting a custom paper size, but the code isn’t working as expected.

 

 

(defun c:PDF ( / cm )

   (setq cm (getvar 'CMDECHO))

   (setvar 'CMDECHO 0)

   (command "_.-plot" "_y"

       (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))

       "AutoCAD PDF (High Quality Print).pc3" "ARCH D (24.00 x 36.00 Inches)"

       "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "monochrome.ctb" "_Y"

   )

   (if (= 1 (getvar 'TILEMODE))

       (command "_A")

       (command "_N" "_Y")

   )

   (command "_N" (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME))) "_Y" "_Y")

   (setvar 'CMDECHO cm)

   (princ)

)

(vl-load-com) (princ)

 

 

When I replace the default .pc3 file in the LISP code with my own (Foxit PDF Editor Printer.pc3), instead of plotting automatically, it starts asking for every input again — like paper size, plot area, etc

 

 As below 👇 

 

Command: PDF

Yes or No, please.

Don't use Esc while using a Lisp commandWrite the plot to a file [Yes/No] <N>: y

Command: MOPRINT

Yes or No, please.

Don't use Esc while using a Lisp commandWrite 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: 903.11 wide by 603.25 high

Plotting viewport 1.

Effective plotting area: 792.73 wide by 577.98 high

Plotting viewport 2.

 

Also, it would be awesome if we could add a feature where each layout gets plotted using a name format and save location pulled from an Excel file. That would seriously save a ton of time and effort. Thanks in advance, friends!

0 Likes
Accepted solutions (3)
2,120 Views
43 Replies
Replies (43)
Message 21 of 44

Sea-Haven
Mentor
Mentor

Did you Google "Using saved Page Settings" there is lisp code out there that will go to all layouts and setup the Page Settings so it has the correct printer, CTB and sheet size.

 

Solved: Assign a page setup to ALL layout tabs (prior to / or without going into "publish dialog") -...

Message 22 of 44

harimadhavan66
Explorer
Explorer

Hi Sir,

Plotfox works really well so far, but I have two more things I’m struggling with. First, I’d like to save the PDF files automatically, without the “Save As” dialog popping up. Second, I want the saved PDF’s filename to follow a specific format where only one part changes—for example: 2535_TabName_APP_00, and just the "TabName" part needs to change and other details are prefixed to DWG file to file. Can you help me with this?

0 Likes
Message 23 of 44

paullimapa
Mentor
Mentor

As I mentioned in msg 6 & 16 because you’re using a custom pdf device like Foxit instead of the built in AutoCAD devices like Dwg To Pdf.pc3 that Save As pdf name dialog box will appear. Also any attempts to customize to pdf filename is lost. 


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

harimadhavan66
Explorer
Explorer

Okey sir,

The main problem is black lines darkness is higher when I plot with DWG to pdf.pc3 how could I manage that. I have tried to reduce the screening value but it wouldn't work. That's the case I'm switch to foxit.pc3 any solution sir?..

0 Likes
Message 25 of 44

paullimapa
Mentor
Mentor

Should be the same since you’re using the same ctb. Perhaps it’s the pdf viewer you’re using that might show there’s a difference. Perhaps you can share the pdf you using dwg to pdf.pc3 and also pdf from foxit both generated from same dwg so we can take a look here what are the differences?


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

paullimapa
Mentor
Mentor

FYI: Attached is the test process I followed through to demonstrate my point using AutoCAD's built-in DWG To PDF.pc3 vs FoxIt.pc3 

Both pdfs are generated from the same Floor Plan Samples.dwg that comes with AutoCAD and monochrome.ctb

Snapshots of both PLOT windows:

paullimapa_0-1753042553491.png

paullimapa_1-1753042563259.png

Snapshots of both PDFs zoomed into same area at 333%:

paullimapa_4-1753042650950.png

paullimapa_5-1753042678771.png

Conclusion: I don't see any difference in "black lines darkness"

Attached are dwg & both pdfs

 

 


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

harimadhavan66
Explorer
Explorer

Yes sir, If I'm use donuts and plines with different global width has darkness appearance. Also I have assigned ligh weight based on colour as red - 0.2mm donuts are in cyan - 0.5mm and so on... How could I solve it sir?.

0 Likes
Message 28 of 44

paullimapa
Mentor
Mentor

can you share a sample dwg and the ctb you're using to plot

along with pdf using Dwg To Pdf.pc3 & another using Foxit so we can all see the differences?


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

harimadhavan66
Explorer
Explorer

Hi Sir,

 

Sorry for delayed reply, Im currently out of station. Here I have attached the sample dwg file and CTB file that I have use. But I don't have any pdfs.

 

Sample DWG and Free state.ctb to download ctb and dwg click the drive link.

0 Likes
Message 30 of 44

paullimapa
Mentor
Mentor

I dnloaded & opened your sample dwg: #200451_RS-01-01D_APP_00.dwg

The following alert window appeared:

paullimapa_0-1753641527875.png

Opening the External Reference palette the following shows Unreferenced:

paullimapa_1-1753641580797.png

I then generated from the current layout RS2-2A the following Pdfs:

PLOT window using Foxit PDF Editor Printer.pc3 to generate #200451_RS-01-01D_APP_00 RS2-2A (FoxIt).pdf

paullimapa_4-1753642461257.png

 

PLOT window using AutoCAD's buit-in DWG To PDF.pc3 to generate #200451_RS-01-01D_APP_00 RS2-2A (Dwg To Pdf).pdf

paullimapa_5-1753642501750.png

 

Now opening both pdfs (attached) using Foxit Reader I've produced the same conclusions as I stated in my previous responses.

There are no line weight differences (darker or lighter) between using the paid version of FoxIt vs AutoCAD's built-in free Dwg To Pdf.pc3

So I would stay with AutoCAD's Dwg To Pdf.pc3 to successfully batch plot running the lisp code which also allows you to specify the generated pdf file names.

 

Zoomed Fit to page FoxIt Pdf:

paullimapa_6-1753642589401.png

Zoomed in to 90% Dwg To Pdf:

paullimapa_7-1753642629570.png

Zoomed in to 90% FoxIt Pdf:

paullimapa_8-1753642755058.png

Zoomed in to 90% Dwg To Pdf:

paullimapa_9-1753642788735.png

 

 

 


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

harimadhavan66
Explorer
Explorer

Hi sir, It seems but if you closely look at the filleted area there is flar effect you can notice. And dot leader side also.

 

 

0 Likes
Message 32 of 44

paullimapa
Mentor
Mentor

please mark up in red exactly the area you see that's different between the two pdfs because I cannot see the difference looking at your screenshot.


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

harimadhavan66
Explorer
Explorer

Hi sir, I have attached the screenshot with highlighted.

0 Likes
Message 34 of 44

paullimapa
Mentor
Mentor
Accepted solution

The problem is caused by the Foxit Reader.

Here are screenshots using Acrobat Reader:

paullimapa_0-1753669686105.png

paullimapa_1-1753669727946.png

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 35 of 44

harimadhavan66
Explorer
Explorer

Ohh okey sir. If you look closely at the line's darkness, with foxit is lighter and DWG to pdf would darker that's the main issue. Any solution sir. My doubt about the calibration settings in .pc3 file would reason.

0 Likes
Message 36 of 44

paullimapa
Mentor
Mentor
Accepted solution

Actually looking closely the Dwg To Pdf.pc3 PDF darkness completely fills the area.

But FoxIt 's PDF filled darkness is incomplete with lots of white lines.

So my preference is still Dwg To Pdf.pc3.  But this is looking more and more like a subjective exercise.

In conclusion, you can continue to use your paid version of FoxIt.

But as I stated over and over again you won't be able to use lisp code to automate the pdf generation process.

So the choice in the end is yours.


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

harimadhavan66
Explorer
Explorer

Thanks alot for the explanation. A knowledgeable conversation with you sir.

0 Likes
Message 38 of 44

paullimapa
Mentor
Mentor

you are welcome...cheers!!!


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

harimadhavan66
Explorer
Explorer

Hi sir,

 

I find the solution. PDF name might restricted by .pc3 file. To resolve change the save location to default would resolve the issue (See snap-1). Now I improve some part. To loop through and name the pdf automatically. But the issue is pdf naming would applied for .plt file. But it should apply for .pdf. If it get fixed it super good.

 

(defun c:PltFox2 (/ cmdecho filedia dwgname layoutlist defaultFormat formatInput layoutname parts finalPdfName)

  (vl-load-com)

  ;; Save system variables
  (setq cmdecho (getvar "cmdecho"))
        (setq filedia (getvar "filedia"))
        (setvar "cmdecho" 0)
        (setvar "filedia" 0)

  ;; Get DWG name
  (setq dwgname (vl-filename-base (getvar "dwgname")))

  ;; Get layout list and reverse it
  (setq layoutlist '())
  (vlax-for layout (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
    (if (not (wcmatch (strcase (vla-get-name layout)) "MODEL"))
      (setq layoutlist (cons (vla-get-name layout) layoutlist))
    )
  )

  ;; Get last used format or default
  (or (setq defaultFormat (getenv "PLTFOX_FORMAT"))
      (setq defaultFormat (strcat "#" dwgname "*")))

  ;; Prompt user for filename format
  (initget 1)
  (setq formatInput
    (getstring
      (strcat "\nEnter PDF name format using * as layout marker <" defaultFormat ">: ")
    )
  )
  (if (= formatInput "") (setq formatInput defaultFormat))
  (setenv "PLTFOX_FORMAT" formatInput)

  ;; Loop through layouts in reverse
  (foreach layoutname layoutlist

    ;; Replace * with layout name
    (setq parts (vl-string->list formatInput))
    (setq finalPdfName "")
    (foreach ch parts
      (setq finalPdfName
        (strcat finalPdfName
                (if (= (chr ch) "*") layoutname (chr ch))
        )
      )
    )

    ;; Add full path and .PDF extension
    (setq finalPdfName
      (strcat (getvar "dwgprefix") finalPdfName ".PDF")
    )

    ;; Begin plot command
    (command "_.-PLOT"
      "_Yes" 
      layoutname
      "Foxit PDF Editor Printer.pc3"
      "ARCH D"
      "_Millimeters"
      "_Landscape"
      "_No"
      "_E"
      "_F"
      "_C"
      "_Yes"
      "Free State.ctb"
      "_Yes"
    )

    ;; Layout/model specific option
    (if (= 1 (getvar "tilemode"))
      (command "_A")
      (command "_No" "_Yes" "_No")
    )

    ;; Save as PDF
    (command "_Yes" finalPdfName "_Yes" "_Yes")

  )

  ;; Restore system variables
  (setvar "filedia" filedia)
  (setvar "cmdecho" cmdecho)

  (princ)
)

 

Snap-1

harimadhavan66_0-1754138170069.png

 

0 Likes
Message 40 of 44

paullimapa
Mentor
Mentor

Here are my observations:

(1) When you make these changes as you stated in your post to FoxIt Pdf Editor Printer.pc3

paullimapa_0-1754168351782.png

(2) In the plot sequence when you select plot to file, AutoCAD will create the .plt files as you've observed. But the plt files created do NOT have any content so thus the file size is 0. So even after renaming the .plt to .pdf those files are useless because FoxIt will follow the .pc3 Custom Target Folder settings as discussed in (1).

(3) In case you're curious here are the changes I made to your PltFox2.lsp:

a) Do not use layoutlist a built-in lisp function as a variable. The following line is commented out:

; (/ cmdecho filedia dwgname layoutlist defaultFormat formatInput layoutname parts finalPdfName)

The replacement line uses layout-list as variable:

  (/ cmdecho filedia dwgname layout-list defaultFormat formatInput layoutname parts finalPdfName)

b) There's no need to run these lines of code to get a list of layouts in the current drawing:

;; no need to run these lines of code
;  (setq layoutlist '()) ; layoutlist is a built-in lisp function so do not use as variable
;  (vlax-for layout (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
;    (if (not (wcmatch (strcase (vla-get-name layout)) "MODEL"))
;      (setq layoutlist (cons (vla-get-name layout) layoutlist))
;    )
;  )

Instead just use the built-in layoutlist function:

  ;; Get layout list and reverse it
  (setq layout-list (reverse (layoutlist)))  ; just use built-in layoutlist function

c) The initget function does NOT have any impact on the getring function:

paullimapa_1-1754169171676.png

So the following line should be commented out before running getstring:

  ;; Prompt user for filename format
;  (initget 1) ; initget function has no impact on getstring function
  (setq formatInput
    (getstring
      (strcat "\nEnter PDF name format using * as layout marker <" defaultFormat ">: ")
    )
  )

d) Since layoutlist variable is now replaced with layout-list, I modified this line of code:

  ;; Loop through layouts in reverse
  (foreach layoutname layout-list ; layoutlist

e) I added a dash "-" between filename & layout name by making the following modifications:

    ;; Replace * with layout name
    (setq parts (vl-string->list formatInput))
    (setq finalPdfName "")
    (foreach ch parts
      (setq finalPdfName
        (strcat finalPdfName 
                (if (= (chr ch) "*") (strcat "-" layoutname) (chr ch))  ; add dash as separator between dwgname and layoutname
        )
      )
    )

f) The following lines of code before the plot sequence removes the ".PDF" file name extension without adding the ".plt" because AutoCAD automatically adds the ".plt" extension to the saved plot file:

    ;; Add full path and .PDF extension
    (setq finalPdfName
;      (strcat (getvar "dwgprefix") finalPdfName ".PDF")
      (strcat (getvar "dwgprefix") finalPdfName) ; .PLT extension automatically added
    )

g) The following lines of code after the plot sequence renames the .plt generated file to .PDF:

    ;; rename plt to pdf
    (if (findfile finalPdfName)
      (vl-file-rename finalPdfName (strcat (vl-string-right-trim ".plt" finalPdfName) ".PDF")) 
    )

But the conclusion is still the same. Though you've resolved the issue of the plot filename request window from appearing, there's no way using lisp to customize different locations telling FoxIt where to create the pdf and also no way to change the name of the generated pdf.


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