杨如迁 发表于 2012-9-15 16:47:24

修改块名求助

怎么加上那个对话框啊(defun c:xgkm (/ blkselect )
(setq blkselect (entget(car(entsel "\n选择块: ")))
      blkname   (cdr(assoc 2 blkselect)) )
(princ (strcat "->>> " (cdr (assoc 2 blkselect)) " <<<-" ))
(setq blknew (getstring t "\n输入新块名: "))
(command "_.rename" "_block" blkname blknew)
(princ)
)
xgkm:dialog{label="修改块名";
:boxed_column{label="选项";
:edit_box{label ="块名: ";key ="e1";allow_accept = true;}
spacer_1;
}
spacer_1;
ok_cancel;
}不知道怎么驱动对话框O(∩_∩)O谢谢

yjr111 发表于 2012-9-15 18:12:55

到http://bbs.mjtd.com/thread-96336-1-1.html八楼去研究一下

ZZXXQQ 发表于 2012-9-15 19:42:29

程序未经调试。

(defun c:xgkm (/ blkselect )
(if (and (setq blkselect (entget(car(entsel "\n选择块: ")))
          (setq blkname   (cdr(assoc 2 blkselect)) )) (progn
(if (> (setq dcl_id (load_dialog "xgkm")) 0) (progn
   (if (new_dialog "xgkm" dcl_id) (progn
    (action_tile "e1" "(readata) (done_dialog 1)")
    (action_tile "accept" "(readata) (done_dialog 1)")
    (action_tile "cancel" "(done_dialog 0)")
    (setq re (start_dialog))
   )
    (princ "\n无法显示对话框!")
   )
   (unload_dialog dcl_id)
)
   (princ "\n无法加载对话框!")
)
(if (and (= re 1) (/= blkname blknew))
   (command "_.rename" "_block" blkname blknew)
)
))
(princ)
)

ZZXXQQ 发表于 2012-9-16 19:01:24

缺个函数
(defun readata ()
(setq blknew (read_tile "el))
)

杨如迁 发表于 2012-9-17 08:35:45

谢谢啊去试试

杨如迁 发表于 2012-9-17 08:44:07

命令: ; 错误: 输入的字符串有缺陷
页: [1]
查看完整版本: 修改块名求助