Help with plotting lisp - Ghostscript or?

Help with plotting lisp - Ghostscript or?

DC-MWA
Collaborator Collaborator
2,194 Views
13 Replies
Message 1 of 14

Help with plotting lisp - Ghostscript or?

DC-MWA
Collaborator
Collaborator

Hello,

We use a handy little routine for doing quick plots to pdf. The issue is we are moving from acrobat to bluebeam. This affects how the program assembles multipage pdf files. I've tried to get ghostscript to work but I haven't had much luck getting the list of pdf's created into the temp folder into a list for ghostscript to digest.

My programming knowledge is limited as you will see by my lengthy / frankenlisp.

Thank you in advance for any assistance received.

Again, forgive my sloppy lisping.

0 Likes
2,195 Views
13 Replies
Replies (13)
Message 2 of 14

ronjonp
Mentor
Mentor

Have you used PUBLISH or SHEETSETS? In this day and age 'quick plotting' does not need code. 

0 Likes
Message 3 of 14

DC-MWA
Collaborator
Collaborator

We use publish for final plots, but we do quick plots during the project. Like 11x17 size prints, so we have P17 lisp that does this very quickly without reinventing the plot settings for each tab.

0 Likes
Message 4 of 14

ronjonp
Mentor
Mentor

Do you use predefined page setups? If so, you can use Charle's ( aka CAB ) Plot Tabs routine ... it works very well.

ronjonp_0-1654122900474.png

 

0 Likes
Message 5 of 14

DC-MWA
Collaborator
Collaborator

I have not. I don't know where to get it.

Also, I would love it if we could get our lisps to work without acrobat though. Our work flow is very fast and this is very fast. I'm old school and love fast keystrokes that work well.

0 Likes
Message 6 of 14

ronjonp
Mentor
Mentor

Better yet since you're using sheetsets already, just use pagesetup overrides like so 🙂

ronjonp_0-1654123863026.png

To accomplish this, setup a DWT on your network and create all your usual PAGESETUPS. Then point your Sheet Set to it ... joila!

ronjonp_0-1654124099287.png

 

 

0 Likes
Message 7 of 14

Sea-Haven
Mentor
Mentor

We have been using a custom plot lisp for years and it uses Ghostscript to rejoin the individuals back into 1 pdf.

 

Have a look at this.

 

The latest version for a customer has multi sized title blocks and portrait or  landscape back to 1 pdf.

 

 

;Plots layouts by range
; By Alan H Feb 2014

;(defun AH:pltlays ( / val1 val2 plotnames dwgname lendwg pdfname lay numlay numend dwgpre)
(defun AH:pltlays ( / )

(defun KGA_String_Join (strLst delim)
(if strLst
(apply
'strcat
(cons
(car strLst)
(mapcar '(lambda (a) (strcat delim a)) (cdr strLst))
)
)
""
)
)

(SETVAR "PDMODE" 0)
(setvar "plottransparencyoverride" 2)
(setvar "fillmode" 1)
(setvar "textfill" 1)
(setq plotnames '())

; check that pdf directory exists
(setq dwgpre (strcat (getvar "dwgprefix") "\pdf"))
(if (= (vl-file-directory-p dwgpre) nil)
(vl-mkdir dwgpre)
)
(SETQ LAYOUTS (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object))))
(SETQ COUNT (- (VLA-GET-COUNT LAYOUTS) 1))

(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq vals (AH:getvalsm  (list "Enter plot range" "Enter start tab number" 6 4 "1" "Enter end tab number" 6 4 (RTOS COUNT 2 0))))

(setq numlay (atoi (nth 0 vals)))
(setq numend (atoi (nth 1 vals)))

(setq len (+ (- numend numlay) 1))

(setq dwgname (GETVAR "dwgname"))
(setq lendwg (strlen dwgname))
(setq dwgname (substr dwgname 1 (- lendwg 4)))

(repeat len
(vlax-for lay LAYOUTS
(if (= numlay (vla-get-taborder lay))
  (setvar "ctab" (vla-get-name lay))
) ; if

(setq pdfname (strcat dwgpre "\\" dwgname "-" (getvar "ctab") ".pdf" ))
) ; for

(setvar "textfill" 1)
(setvar "fillmode" 1)
(setvar "PLOTTRANSPARENCYOVERRIDE" 2)
    (COMMAND "-PLOT"  "Y"  "" "dwg to Pdf"
	       "ISO A0 (841.00 x 1189.00 MM)" "m" "LANDSCAPE"  "N"   "E"  "F"  "C"
	       "y" "Acad.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
    )
    
(setq numlay (+ numlay 1))
(setq plotnames (cons pdfname plotnames))
) ; end repeat
(setq trgfile (strcat (getvar "dwgprefix") "pdf\\" dwgname "-D" (nth 0 vals) "-D" (nth 1 vals) ".pdf"))

(setq plotnames (reverse plotnames))

(IF (= (length plotnames) 1)
(princ)
(progn

(setq gsexe "D:\\gs\\gs9.55.0\\bin\\gswin64c.exe")

(startapp 
(strcat
gsExe " "
"-sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dQUIET  "
"-sOutputFile=\"" trgFile "\" "
"\"" (KGA_String_Join plotnames "\" \"") "\""
)
)

)
)



) ; defun

(AH:pltlays)

 

 Thanks also to KGA .

0 Likes
Message 8 of 14

DC-MWA
Collaborator
Collaborator

Thank you. My original script created the separate pdfs in a folder called temp.

My thinking is I could create a list of files within that folder and feed it to ghostscript. Doesn't work.

;;create list if pdfs in temp folder
(setq plotnames (vl-directory-files (strcat (strcat (getvar 'DWGPREFIX)) "\\Quick Plots\\temp") "*.pdf" 1) )
(setq plotnames (reverse plotnames))

 

;;run ghostscript
(startapp
(strcat
gsExe " "
"-sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dQUIET "
"-sOutputFile=\"" trgFile "\" "
"\"" (KGA_String_Join plotnames "\" \"") "\""
)
)

 

 

Any ideas??

 

 

0 Likes
Message 9 of 14

pendean
Community Legend
Community Legend
dumb question: why would you need 11x17 PDFs? They autoscale if you ever need paper prints of them, create the PDFs in the one size all day long quick and easy.

Don't go too old-school on us 😉

And if you use layouts, SSM is the way to speed up the process of PUBLISH.
0 Likes
Message 10 of 14

DC-MWA
Collaborator
Collaborator

lol.. it's true as I age, the more technology works against me. I have my 13 year old daughter do most phone or setup, etc.

Having said that, I've been using this program a long time as has my team, it helps enforce office standards by locating files and folders etc. It would be great to not have to learn/teach/setup new ways. 

0 Likes
Message 11 of 14

maratovich
Advisor
Advisor

@DC-MWA  написал (-а):

The issue is we are moving from acrobat to bluebeam.


Maybe use native DWG to PDF?
And print immediately to a multi-sheet file...

 

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes
Message 12 of 14

DC-MWA
Collaborator
Collaborator

Not sure how this would work??

0 Likes
Message 13 of 14

Sea-Haven
Mentor
Mentor

DC-MWA Read again the code I posted it makes a list of pdf names that is used by Ghostscript, second thing is I put the PDF's into a PDF directory at same level as dwg then the pdf's live with the dwg and not in temp, a recent version did make all the pdfs but save the joined pdf into same directory as DWG.

Message 14 of 14

maratovich
Advisor
Advisor

@DC-MWA  написал (-а):

Not sure how this would work??


It will work as it should from the beginning.
Bluebeam is not a standard printer.
We do not know your style of work and do not see an example file.
1. Use PUBLISH
2. Use lisp from Sea-Haven   - he gave it to you earlier
3. If your title blocks are all in the model, then this will help you - Revers 

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes