PLOT PDF SAVE
in LISP
hello,
I want to make the following list selection.
For example, when you enter the command, page size, scale, plot style etc. can you help? Batch to create pdf in one go.
(vl-load-com)
(defun c:plot_pdf (/ bas dwg file hnd i len llpt lst mn mx ss tab urpt)
(if (setq ss (ssget "_X" '((0 . "INSERT") (2 . "SHEET"))))
(progn
(repeat (setq i (sslength ss))
(setq hnd (ssname ss (setq i (1- i)))
tab (cdr (assoc 410 (entget hnd)))
bas (cdr (assoc 10 (entget hnd))) ; get insert base point
lst (cons (cons tab (cons bas hnd)) lst) ; include insert base point
)
)
; (setq lst (vl-sort lst '(lambda (x y) (> (car x) (car y)))))
; sort by blocks insert base point x ascending = from left right
(setq lst (vl-sort lst '(lambda (x y) (> (car (cadr y)) (car (cadr x))))))
; sort by blocks insert base point y descending = from top down
(setq lst (vl-sort lst '(lambda (x y) (< (cadr (cadr y)) (cadr (cadr x))))))
(setq i 0)
(foreach x lst
(setq file (strcat (getvar 'DWGPREFIX)
(substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4))
"-"
(itoa (setq i (1+ i)))
".pdf"
)
)
(if (findfile file)
(vl-file-delete file)
)
; (vla-getboundingbox (vlax-ename->vla-object (cdr x)) 'mn 'mx)
(vla-getboundingbox (vlax-ename->vla-object (cddr x)) 'mn 'mx)
(setq llpt (vlax-safearray->list mn)
urpt (vlax-safearray->list mx)
len (distance llpt (list (car urpt) (cadr llpt)))
)
(command "-plot"
"yes"
(car x)
"DWG TO PDF.PC3"
; "ISO A3 (420.00 x 297.00 MM)"
; "ISO A1 (841.00 x 594.00 MM)"
"ISO full bleed A4 (297.00 x 210.00 MM)"
"Millimeters"
"Portrait"
"No"
"Window"
llpt
urpt
"Fit"
; "1:10"
"Center"
"yes"
; "grayscale.ctb"
; "Screening 75%.ctb"
"monochrome.ctb"
"yes"
""
)
(if (/= (car x) "Model")
(command "No" "No" file "no" "Yes") ; pspace
(command file "no" "Yes") ; model
)
)
)
)
(princ)
)
0
Comments
-
A question.
Are the title blocks in Model space or in layouts ?
Yes I have
Plot all titles in modelspace
Plot range layouts
Plot various size tiles in layouts, note must be customised for a client
Google "Plotting by Maratovich" very powerful program lots of features.
0