求教:如何让纸张列表与所选择的打印设备同步更新? 如下图所示,这是我自己做的对话框,其中的打印设备列表已把系统所有的打印设备列出,可随意选择;其下面的纸张列表虽也取得,但无法随打印机的选择同时更新相应的列表,也就是说无法达到CAD系统自带打印对话框的效果。下面的两段程序应该如何关联才能达到此效果?
;;;获取当前所有打印机列表 (defun GetPrinterlist () (vlax-safearray->list (vlax-variant-value (vla-getplotdevicenames (vla-item (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)) ) "Model" ) ) ) ) ) ;;;获得纸张类型列表 (defun GetPaperList () (setq acadobj (vlax-get-acad-object) doc (vla-get-activedocument acadobj) layout (vla-get-activelayout doc) ) (vla-RefreshPlotDeviceInfo layout) (setq CanPaperSizeVar (vla-GetCanonicalMediaNames layout) CanPaperSizeArr (vlax-variant-value CanPaperSizeVar) CanPaperSizeLIst (vlax-safearray->list CanPaperSizeArr) PaperSize '() index 0 ) (repeat (length CanPaperSizeList) (setq Papersize (cons (vla-GetLocaleMediaName layout (nth index CanPaperSizeList) ) Papersize ) index (1+ index) ) ) (reverse PaperSize) ) 以下是与对话框相关的操作 …… (setq printerlist (getprinterlist)) (start_list "printer") (mapcar 'add_list printerlist) (end_list) (if (setq paperlist (getpaperlist)) (progn (start_list "paper") (mapcar 'add_list paperlist) (end_list) ) ) …… |