♂此处空白♂ 发表于 2015-2-3 14:34:41

怎么把DCL合并到LISP中

怎么把DCL合并到LISP中 那位高手帮个忙
;;dcl对话框
cmm:dialog {
    height = 20 ;
    label = "选择物体改变其图层" ;
    :list_box {
      fixed_width_font = true ;
      height = 20 ;
      key = "lism" ;
      label = "图层名称选单:" ;
    }
    ok_cancel;
}

;;;LISP程序

(DEFUN C:test (/ os ce bm ss se la )
(setvar "cmdecho" 0)
(setq ss (ssget))
(if (not (null ss))
(mpcm)
)
       (princ)
)
;;;;;;
(defun mpcm (/ w lay sslay dcl_id do_what value tbl lism selm
lenth layer clayer num a b no tem_list cood)
(SETQ W (TBLNEXT "LAYER" T))
(WHILE (/= NIL W)
(SETQ LAY (CDR (ASSOC 2 W)))
(if (/= (STRCASE lay) "DEFPOINTS")
(SETQ SSLAY (append SSLAY (list LAY)))
)
(SETQ W (TBLNEXT "LAYER"))
)

      (setq dcl_id (load_dialog "cmm.dcl"))
(setq do_what 3)
    (while (> do_what 1)
(if (not (new_dialog "cmm" dcl_id)) (exit))
(mode_tile "lism" 2)
(start_list "lism" 2)
(mapcar 'add_list SSLAY)
(end_list)
(action_tile "selm" "(done_dialog 2)")
(action_tile "lism" "(setq value $value)")
(action_tile "accept" "(setq value (get_tile \"lism\"))(done_dialog 1)")
(setq do_what (start_dialog))
(if (= 2 do_what)
   (setq ss (ssget))
)
    )

(unload_dialog dcl_id)
(if (= 1 do_what)
(progn
   (setq lenth (read value)
    clayer (nth lenth sslay)
   )
   (setq tbl (tblsearch "layer" clayer))
   (if (not (null tbl))
                  (command "_chprop" ss "" "la" clayer "")
   )
)
)
(princ))

鱼与熊掌 发表于 2015-2-6 16:12:19

把dcl变成字符串。
然后使用创建临时文件的方法创建dcl文件
然后在呼出。
页: [1]
查看完整版本: 怎么把DCL合并到LISP中