aHero Posted December 24, 2019 Share Posted December 24, 2019 (edited) 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 Edited December 24, 2019 by aHero Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 24, 2019 Share Posted December 24, 2019 (edited) I have had this happen when automating plotting multi layouts and have no idea what caused it would put a margin on left auto on right done 1 at a time. Never really solved it, they were very old standard dwgs . Edited December 24, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.