Search the Community
Showing results for tags 'plottofile'.
-
use vla-PlotToFile with acwindow plotstyle, but plot area is offset
aHero posted a topic in AutoLISP, Visual LISP & DCL
I use vla-PlotToFile to plot dwg to pdf with acWindow plottype, but pdf is offset。 please help,thanks。 (defun c:myplot ( / ) (vl-load-com) (setq adoc (vla-get-activedocument (vlax-get-acad-object))) (setvar "CMDECHO" 0) (setvar "BLIPMODE" 0) (setvar "OSMODE" 0) ;(setvar "LAYOUTREGENCTL" 1) (setq lyout (vla-get-activelayout adoc)) (setq styleSheet "monochrome.ctb") (setq cfgName "AutoCAD PDF (High Quality Print).pc3") (vla-RefreshPlotDeviceInfo lyout) (vla-put-ConfigName lyout CfgName) (vla-put-PaperUnits lyout acMillimeters) (vla-put-plotrotation lyout ac0degrees) (vla-put-PlotType lyout acWindow) (vla-put-CanonicalMediaName lyout "ISO_full_bleed_A3_(420.00_x_297.00_mm)") (vla-put-PlotWithLineweights lyout :vlax-false) (vla-put-PlotWithPlotStyles lyout :vlax-true) (vla-put-StyleSheet lyout styleSheet) (vla-put-CenterPlot lyout :vlax-true) (vla-put-plotrotation lyout ac0degrees) (vla-put-activelayout adoc lyout) (setq ss (ssget "X" '((0 . "INSERT") (2 . "bztk") (67 . 0)))) (setq i -1) (repeat (sslength ss) (setq i (1+ i)) (setq tk_ent (ssname ss i)) (vla-GetBoundingBox (vlax-ename->vla-object tk_ent) 'minpoint 'maxpoint) (setq pointTemp1 (vlax-make-safearray vlax-vbDouble '(0 . 1))) (vlax-safearray-put-element pointTemp1 0 (vlax-safearray-get-element minpoint 0)) (vlax-safearray-put-element pointTemp1 1 (vlax-safearray-get-element minpoint 1)) (setq pointTemp2 (vlax-make-safearray vlax-vbDouble '(0 . 1))) (vlax-safearray-put-element pointTemp2 0 (vlax-safearray-get-element maxpoint 0)) (vlax-safearray-put-element pointTemp2 1 (vlax-safearray-get-element maxpoint 1)) (vla-SetWindowToPlot lyout pointTemp1 pointTemp2) (vla-put-activelayout adoc lyout) (vla-PlotToFile (vla-get-Plot adoc) (strcat (getvar 'dwgprefix) "draw" (itoa i))) ) (setvar "BLIPMODE" 0) (setvar "OSMODE" 231 ) (setvar "CMDECHO" 1) ) test.dwg