Jump to content

Recommended Posts

Posted (edited)

I have this  code to plot Layout to pdf

 

(defun C:laytopdf ( / cmd )
  (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0)
  (foreach Layout (layoutlist)

    (command "_.-PLOT" 
      "No"                                        ; Detailed plot configuration? [Yes/No] <No>: No
      Layout                                      ; Enter a layout name or [?] <Layout1>:
      ""                                          ; Enter a page setup name
      "DWG to PDF.pc5"                            ; Enter an output device name or [?] <DWG to PDF.pc5>:
      (strcat (getvar "DWGPREFIX") Layout ".pdf") ; Directory to save
      "No"                                        ; save changes to page setup?
      "YES"                                       ; proceed with plot?
    ); command
  ); foreach
  ;(vla-put-StyleSheet(vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-acad-object))) "monochrome.ctb" )
  (setvar 'cmdecho cmd)
  (princ)
); defun

 

This code plot all layouts and save them in drawing file with layout name.

 

I want to update the code not to plot all the layouts but only the current and gives me the option to change the save path or the name of the pdf. So I write this code

 

(defun C:laytopdf new (/ cmd f1)
  (setq cmd (getvar 'cmdecho))
  (setvar 'cmdecho 0)
  (setq Layout (getvar 'ctab))
  (setq f1 (getfiled "Create PDF File" (strcat (getvar "DWGPREFIX") (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 4)) ".pdf") "pdf" 1))
  (if f1
    (command "_.-PLOT"
      "No"                                        ; Detailed plot configuration? [Yes/No] <No>: No
      Layout                                      ; Enter a layout name or [?] <Layout1>:
      ""                                          ; Enter a page setup name
      "DWG to PDF.pc5"                            ; Enter an output device name or [?] <DWG to PDF.pc5>:
      f1                                          ; Directory to save
      "No"                                        ; Save changes to page setup?
      "YES"                                       ; proceed with plot?
    )
  )
  (setvar 'cmdecho cmd)
  (princ)
)

 

 

The problem is that in the first code create the pdf file in the drawing path and not open it. In the second code save the pdf in the selected path with the name I give and open the pdf. I don't want to open the pdf . How to fix this. I write DWG to PDF.pc5 and not DWG to PDF.pc3 because ZWCAD support DWG to PDF.pc5

 

Thanks

Edited by mhy3sx
Posted

I am not sure how the first one doesn't give a preview... in testing it gives a preview for me. I use .pc3 files for plotting and not .pc5.

 

What I have is a copy of the DWG to PDF.pc3 plotter (go to page setup, modify, select "Dwg to PDF.pc3", Properties, 'Save as', and I call mine "Dwg to PDF - No Preview.pc3"), then in PDF options de-select "Show Results in Viewer". You should now have 2 DWG to PDF plotters, and you can select which one to use. Modify your code above to use the preview or no preview plotter.

 

  • Agree 1
Posted

Hi Steven P. I didn't know that !!! I will test it. Thanks

Posted

Yes works fine. Thanks

  • Like 1
Posted

For Bricscad its "Print as PDF.pc3" but if you have a plot lisp can get which software is being used and set correct output.

 

(if (wcmatch  (getvar 'acadver) "*BricsCAD*" )
(setq printer "Print as PDF")
(setq printer "Plot to PDF")
)

Don't need Pc3 but I did copy "Publish to web PNG.pc3" from Acad to correct location but it returns not supported in my Bricscad. Not sure if later Versions have a PNG output.

  • Like 2

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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