Salut Je me suis amusé à te faire quelque chose Il fonctionne avec pdfCreator. Le premier folio est en bas à gauche, le suivant à sa droite puis au dernier sur la même ligne, on remonte d'un cran et on recommence. Tu peux avoir des "trous" dans tes lignes. (defun c:imp(/ bck bg doc ent hd lay lst pdf plt sel tot kill mon_impression)
(defun kill(qui / item meth1 meth2 obj WMI)
(setq WMI (vlax-create-object "WbemScripting.SWbemLocator")
meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil)
meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process")
)
(vlax-for item meth2
(and (setq obj (vlax-get item 'CommandLine)) (vl-string-search (strcase qui) (strcase obj))
(vlax-invoke item 'Terminate)
)
)
(foreach item (list WMI meth1 meth2)
(vlax-release-object item)
)
)
(defun mon_impression(dim)
(vlax-invoke lay 'setwindowtoplot (list (caar dim)(cadar dim))
(list (caadr dim)(cadadr dim))
)
(vl-catch-all-apply 'vlax-invoke (list plt 'plottodevice))
)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(and (ssget "x" (list (cons 0 "insert") (cons 2 "feuilledereperage3")))
(progn
(vlax-for ent (setq sel (vla-get-activeselectionset doc))
(vla-getboundingbox ent 'bg 'hd)
(setq lst (cons (list (vlax-safearray->list bg) (vlax-safearray->list hd)) lst))
)
(vla-delete sel)
(setq lst (vl-sort lst '(lambda(a B) (if (eq (cadar a) (cadar B))
(< (caar a) (caar B))
(< (cadar a) (cadar B))
)
)
)
)
(kill "PDFCreator.exe")
(setq pdf (vlax-create-object "PDFCreator.clsPDFCreator"))
(vlax-invoke pdf 'cstart "/NoProcessingAtStartup")
(vlax-put pdf 'cPrinterStop :vlax-true)
(vlax-put pdf 'cWindowState 0)
(vlax-invoke pdf 'cClearCache)
(setq lay (vla-get-activelayout doc)
plt (vla-get-plot doc)
tot 0
)
(vla-put-configname lay "PDFCreator")
(vla-refreshplotdeviceinfo lay)
(vla-put-canonicalmedianame lay "A4")
(vla-put-centerplot lay :vlax-true)
(vla-put-paperunits lay acMillimeters)
(vla-put-plothidden lay :vlax-false)
(vla-put-plotrotation lay ac0degrees)
(vla-put-plottype lay acWindow)
(vla-put-plotviewportborders lay :vlax-false)
(vla-put-plotviewportsfirst lay :vlax-true)
(vla-put-plotwithlineweights lay :vlax-true)
(vla-put-plotwithplotstyles lay :vlax-true)
(vla-put-scalelineweights lay :vlax-false)
(vla-put-standardscale lay acVpScaleToFit)
(vla-put-stylesheet lay "")
(vla-put-usestandardscale lay :vlax-true)
(if (vl-catch-all-error-p (setq bck (vl-catch-all-apply 'getvar (list "backgroundplot"))))
(setq bck nil)
)
(if bck
(setvar "backgroundplot" 0)
)
(foreach ent lst
(mon_impression ent)
(while (/= (vlax-get pdf 'cCountOfPrintjobs) (1+ tot)))
(setq tot (1+ tot))
)
(vlax-invoke pdf 'cCombineAll)
(vlax-release-object pdf)
(if bck
(setvar "backgroundplot" bck)
)
)
)
(princ)
) @+