本帖最后由 feng582304 于 2014-11-12 01:12 编辑
- (defun feng:plot ( / layout file dcl nameli sizeli pr )
- (setq layout (vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-acad-object)))
- file (open (setq dcl (VL-FILENAME-MKTEMP nil nil ".dcl")) "w")
- )
- (WRITE-LINE
- "plot:dialog {\n
- label = "打印配置" ;\n
- width = 100 ;\n
- :row {\n
- :list_box {\n
- label = "打印机名称:" ;\n
- key = "name" ;\n
- }
- :list_box {\n
- label = "纸张:" ;\n
- key = "size" ;\n
- height = 50 ;\n
- }\n
- }\n
- ok_cancel;\n
- }\n"
- file
- )
- (close file)
- (NEW_DIALOG "plot" (LOAD_DIALOG dcl))
- (START_LIST "name")
- (MAPCAR 'ADD_LIST (setq nameli (cdr (vlax-safearray->list (vlax-variant-value (vla-GetPlotDeviceNames layout))))))
- (END_LIST)
- (ACTION_TILE "name" "(setq sizeli (feng:plot:size layout nameli $VALUE))")
- (ACTION_TILE "accept" "(setq pr (list (GET_TILE "name") (GET_TILE "size"))) (DONE_DIALOG 1)")
- (if (= (START_DIALOG) 1) (princ (setq pr (MAPCAR 'nth (MAPCAR 'atoi pr) (list nameli sizeli)))))
- )
- (defun feng:plot:size ( layout li nu / sizeli )
- (vla-put-ConfigName layout (nth (atoi nu) li))
- (vla-RefreshPlotDeviceInfo layout)
- (START_LIST "size")
- (MAPCAR 'ADD_LIST (setq sizeli (MAPCAR '(LAMBDA (x) (vla-GetLocaleMediaName layout x)) (vlax-safearray->list (vlax-variant-value (vla-GetCanonicalMediaNames layout))))))
- (END_LIST)
- sizeli
- )
|