马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 marting 于 2021-1-29 02:12 编辑
- (defun XD::Plot->File (ConfigName MediaName Window
- FileName / AcadObj
- ActiveDocObj ActiveLayoutObj
- PlotObj ret
- )
- (setq AcadObj (vlax-get-acad-object)
- ActiveDocObj (vla-get-ActiveDocument AcadObj)
- ActiveLayoutObj (vla-get-ActiveLayout ActiveDocObj)
- )
- (vla-RefreshPlotDeviceInfo ActiveLayoutObj)
- (vla-Put-ConfigName ActiveLayoutObj ConfigName)
- (setq PlotObj (vla-get-Plot ActiveDocObj))
- (vla-Put-CanonicalMediaName ActiveLayoutObj MediaName)
- (vla-Put-StandardScale ActiveLayoutObj acScaleToFit)
- (vla-Put-PlotRotation ActiveLayoutObj ac0degrees)
- (vla-put-PlotOrigin
- ActiveLayoutObj
- (vlax-make-variant
- (vlax-make-safearray vlax-vbDouble '(0 . 1))
- )
- )
- (vla-Put-CenterPlot ActiveLayoutObj :vlax-false)
- (vla-SetWindowToPlot
- ActiveLayoutObj
- (vlax-make-variant
- (vlax-safearray-fill
- (vlax-make-safearray vlax-vbDouble '(0 . 1))
- (car Window)
- )
- )
- (vlax-make-variant
- (vlax-safearray-fill
- (vlax-make-safearray vlax-vbDouble '(0 . 1))
- (cadr Window)
- )
- )
- )
- (setq ret nil)
- (vla-Put-PlotType ActiveLayoutObj acWindow)
- (and (xd::apply vla-PlotToFile (list PlotObj FileName))
- (setq ret filename)
- )
- (foreach o (list PlotObj ActiveLayoutObj ActiveDocObj AcadObj)
- (vlax-release-object o)
- )
- ret
- )
- (defun c:tt ()
- (setq llpt (getpoint "\nll corner"))
- (setq urpt (getcorner llpt "\nur corner"))
- (if (setq
- fn (xd::plot->file
- "DWG To PDF.pc3"
- "ISO_A2_(594.00_x_420.00_MM)"
- (list (list (car llpt) (cadr llpt))
- (list (car urpt) (cadr urpt))
- )
- (strcat (getvar "DWGPREFIX") "FULL-FILE-NAME-TEST" ".pdf")
- )
- )
- (princ "\n文件成功打印到" fn)
- (princ "\n文件打印失败.")
- )
- (princ)
- )
|