(vl-load-com)
(setq *adoc* (vla-get-activedocument (vlax-get-acad-object)))
(defun c:poly-by-blocks_a4 (/ selset ins)
(if (= (type (setq selset (vl-catch-all-apply (function (lambda () (ssget '((0 . "INSERT"))))))))
'pickset
) ;_ end of =
(progn
(foreach ent (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex selset))))
(if (wcmatch (strcase (vla-get-effectivename ent)) (strcase "Рамка_формат"))
(progn (setq ins (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint ent))))
(poly-plot (getfiled "Where to plot" (_kpblc-get-desktop-path) "pdf" 1)
(mapcar (function (lambda (x) (mapcar '+ ins x))) '((0. 0. 0.) (210. 297. 0.)))
"ISO_A4_(297.00_x_210.00_MM)"
) ;_ end of poly-plot
) ;_ end of progn
) ;_ end of if
) ;_ end of foreach
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
(defun c:poly-by-blocks_a3 (/ selset ins)
(if (= (type (setq selset (vl-catch-all-apply (function (lambda () (ssget '((0 . "INSERT"))))))))
'pickset
) ;_ end of =
(progn
(foreach ent (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex selset))))
(if (wcmatch (strcase (vla-get-effectivename ent)) (strcase "Рамка_формат"))
(progn (setq ins (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint ent))))
(poly-plot (getfiled "Where to plot" (_kpblc-get-desktop-path) "pdf" 1)
(mapcar (function (lambda (x) (mapcar '+ ins x))) '((0. 0. 0.) (420. 297. 0.)))
"ISO_A3_(297.00_x_420.00_MM)"
) ;_ end of poly-plot
) ;_ end of progn
) ;_ end of if
) ;_ end of foreach
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
(defun poly-plot (filename pt-lst name / layout)
(setq layout (vla-get-activelayout *adoc*)
pt-lst (mapcar (function (lambda (x) (list (car (trans x 0 2)) (cadr (trans x 0 2))))) pt-lst)
) ;_ end of setq
(vla-refreshplotdeviceinfo layout)
(vla-put-configname layout "DWG to PDF.pc3")
(vla-put-canonicalmedianame layout name)
(vla-put-centerplot layout :vlax-true)
(vla-put-plotrotation layout ac90degrees)
(vla-put-standardscale layout acscaletofit) ;(vla-put-stylesheet layout "acad.ctb")
(vla-setwindowtoplot layout
(vlax-safearray-fill (vlax-make-safearray vlax-vbdouble '(0 . 1)) (car pt-lst))
(vlax-safearray-fill (vlax-make-safearray vlax-vbdouble '(0 . 1)) (last pt-lst))
) ;_ end of vla-setwindowtoplot
(vla-put-plottype layout acwindow)
(vla-regen *adoc* acallviewports)
(vla-plottofile (vla-get-plot *adoc*) filename)
) ;_ end of defun
(defun _kpblc-get-desktop-path ()
(vl-registry-read "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
"desktop"
) ;_ end of vl-registry-read
) ;_ end of defun