Cad批量打印vlisp源码必备.doc_第1页
Cad批量打印vlisp源码必备.doc_第2页
Cad批量打印vlisp源码必备.doc_第3页
Cad批量打印vlisp源码必备.doc_第4页
Cad批量打印vlisp源码必备.doc_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Cad批量打印vlisp源码必备,获取打印机名,获取打印样式,获取指定打印机的图纸尺寸,必用的系统变量等代码详解;获取 acad.exe 所在目录(vla-get-path (vlax-get-acad-object);获取文件搜索路径(getvar acadprefix);增加文件搜索路径(defun PutSupportPath (Path)(vla-put-SupportPath(vla-get-Files(vla-get-Preferences(vlax-get-acad-object)(strcat (getvar acadprefix) ;Path);Windows系统路径(mjtd)(getenv Windir);获取AUTOCAD的语言版本(mjtd) 英文=enu 简体=chs 繁体=cht(getvar LOCALE) ;+;打印机系列(setq ad (vla-get-activedocument (vlax-get-acad-object);所有的图纸尺寸定义(defun GetCanonicalMediaNames (ad)(vla-RefreshPlotDeviceInfo(vla-get-activelayout ad)(vlax-safearray-list(vlax-variant-value(vla-GetCanonicalMediaNames(vla-item (vla-get-layouts ad) Model);图纸尺寸定义的本地名称(defun GetLocaleMediaNames (ad / mn mnl)(setq la (vla-item (vla-get-layouts ad) Model)(foreach mn (GetCanonicalMediaNames ad)(setq mnl (cons (vla-GetLocaleMediaName la mn) mnl)(reverse mnl);所有的打印机设置.(设置,不是名称!)(defun GetPlotDevices (ad)(vla-RefreshPlotDeviceInfo(vla-get-activelayout ad)(vlax-safearray-list(vlax-variant-value(vla-getplotdevicenames(vla-item (vla-get-layouts ad) Model);当前布局的当前打印机 :pc3(defun GetActivePlotDevice (ad)(vla-get-ConfigName(vla-get-ActiveLayout ad);当前设置下的打印样式 : ctb(defun GetPlotStyleTableNames (ad)(vla-RefreshPlotDeviceInfo(vla-get-activelayout ad)(vlax-safearray-list(vlax-variant-value(vla-getplotstyletablenames(vla-item (vla-get-layouts ad) Model);所有的,(可能不会这么用)(defun ListAllMediaNames(ad / al cn pd apmn)(setq al (vla-get-activelayout ad)(setq cn (vla-get-configname al)(foreach pd (GetPlotDevices)(if (/= pd None)(progn(vla-put-configname al pd)(setq apmn (cons pd apmn)(setq apmn (cons (GetCanonicalMediaNames ad) apmn)(if (/= cn None) (vla-put-configname al cn)(reverse apmn); (ListAllLocalMediaNames (vla-get-activedocument (vlax-get-acad-object)(defun ListAllLocalMediaNames(ad / al cn pd apmn)(setq al (vla-get-activelayout ad)(setq cn (vla-get-configname al)(foreach pd (GetPlotDevices ad)(if (/= pd None)(progn(vla-put-configname al pd)(setq apmn (cons pd apmn)(setq apmn (cons (GetLocaleMediaNames ad) apmn)(if (/= cn None) (vla-put-configname al cn)(reverse apmn);某一配置的图纸尺寸定义; (GetCanonicalMediaNamesOfConfigname ad Acrobat PDFWriter)(defun GetCanonicalMediaNamesOfConfigname(ad cn / oldcn al cmn)(setq al (vla-get-ActiveLayout ad)(setq oldcn (vla-get-configname al)(vla-put-configname al cn)(vla-RefreshPlotDeviceInfo al)(setq cmn (GetCanonicalMediaNames ad)(if (/= oldcn None) (vla-put-configname al oldcn)cmn);上面的本地名; (GetLocalMediaNamesOfConfigname ad Acrobat PDFWriter)(defun GetLocalMediaNamesOfConfigname(ad cn / oldcn al cmn)(setq al (vla-get-ActiveLayout ad)(setq oldcn (vla-get-configname al)(vla-put-configname al cn)(vla-RefreshPlotDeviceInfo al)(setq cmn (GetLocaleMediaNames ad)(if (/= oldcn None) (vla-put-configname al oldcn)cmn);当前布局,下面有用.(defun ActLay ()(vla-get-ActiveLayout(vla-get-activedocument(vlax-get-acad-object); Return the Plotter configuration name(defun GetActivePlotDevice ()(vla-get-ConfigName(ActLay); Return the Plot style table name(defun GetActiveStyleSheet ()(vla-get-StyleSheet(ActLay); Force the Plotter configuration to something(defun PutActivePlotDevice (PlotDeviceName)(vla-put-ConfigName(ActLay)PlotDeviceName); Force the Plot style table to something(defun PutActiveStyleSheet (StyleSheetName)(vla-put-StyleSheet(ActLay)StyleSheetName); Return a list of all Plotter configurations(defun PlotDeviceNamesList ()(vla-RefreshPlotDeviceInfo (ActLay)(vlax-safearray-list(vlax-variant-value(vla-GetPlotDeviceNames(ActLay); Return a list of all Plot style tables(defun PlotStyleTableNamesList ()(vla-RefreshPlotDeviceInfo (ActLay)(vlax-safearray-list(vlax-variant-value(vla-GetPlotStyleTableNames(ActLay); If the saved Plotter configuration doesnt exist set it to None(defun PutActivePlotDeviceToNoneIfNotExist ()(if (not (member (GetActivePlotDevice) (PlotDeviceNamesList)(PutActivePlotDevice None); If the saved Plot style table doesnt exist set it to None(defun PutActiveStyleSheetToNoneIfNotExist ()(if (not (member (GetActiveStyleSheet) (PlotStyleTableNamesList)(PutActiveStyleSheet ); Change the Plotter configuration Emtunga.pc3 to your need(defun PutActivePlotDeviceToCompanyStandardIfNotExist ()(if (not (member (GetActivePlotDevice) (PlotDeviceNamesList)(PutActivePlotDevice Emtunga.pc3); Change the Plot style table Emtunga-A3-BW.ctb to your need(defun PutActiveStyleSheetToCompanyStandardIfNotExist ()(if (not (member (GetActiveStyleSheet) (PlotStyleTableNamesList)(PutActiveStyleSheet Emtunga-A3-BW.ctb); Change the Plotter configuration to the default one set in the options; if the active plot device does not exist(defun PutActivePlotDeviceToDefaultIfNotExistOrNone ()(if (or (not (member (GetActivePlotDevice) (PlotDeviceNamesList)(= (GetActivePlotDevice) None)(if (= (vla-get-UseLastPlotSettings(vla-get-output(vla-get-preferences (vlax-get-acad-object):vlax-true)(PutActivePlotDevice(getenv GeneralMRUConfig)(PutActivePlotDevice(vla-get-DefaultOutputDevice(vla-get-output(vla-get-preferences (vlax-get-acad-object); Change the Plot style table to the default one set in the options; if the active Plot style table does

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论