Jump to content

Recommended Posts

Posted (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 by aHero
Posted (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 by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...