 - mjbz:dialog{
- label="面积标注插件";
- alignment=centered; //向中对齐
- :text{label="zhw--12测绘";}
- :popup_list{label="字高";key="popzg";edit_width=10;}
- :popup_list{label="小数点";key="popxsd";edit_width=10;}
- :radio_row{
- label="标注单位";
- key="bzdw";
- :radio_button{label="平方米";key="pfmbz";value=1;}
- :radio_button{label="亩";key="mbz";value=0;}
- :radio_button{label="公顷";key="gqbz";value=0;}
- }
- spacer_1; //空白一行
- ok_cancel;
- }
 - (defun c:mjbz()
- (setvar "cmdecho" 0)
- (setq popzg_list '("1" "2" "3" "4" "5" "8" "10" "12" "15" "20" "30"))
- (setq popxsd_list '("0.0" "0.00" "0.000" "0.0000" "0.00000" "0.000000" "0.0000000"))
- (chk_style)
- (dcl_mjbz)
- (prin1)
- )
- (defun readata ()
- (setq bzdw (get_tile "bzdw"))
- (setq bl (cond((= bzdw "pfmbz") 1)((= bzdw "mbz") (/ 10000 15.0))((= bzdw "gqbz") 10000)))
- (setq bzdw (cond((= bzdw "pfmbz") "平方米")((= bzdw "mbz") "亩")((= bzdw "gqbz") "公顷")))
- (setq txtzg (itoa (nth (itoa (get_tile "popzg")) popzg_list)))
- (setq xsd (1+ (itoa (get_tile "popxsd"))))
- )
- (defun dcl_mjbz()
- (if (> (setq dcl_id (load_dialog "mjbz.dcl")) 0) (progn
- (if (new_dialog "mjbz" dcl_id) (progn
- (show_lst "popzg" popzg_list)
- (set_tile "popzg" "0")
- (show_lst "popxsd" popxsd_list)
- (set_tile "popxsd" "2")
- (action_tile "cancel" "(done_dialog 0)")
- (action_tile "accept" "(readata)(done_dialog 1)")
- (setq dd(start_dialog)) ;将控制权交给DCL
- )
- (princ "\n无法显示对话框!")
- )
- (unload_dialog dcl_id)
- )
- (princ "\n无法加载对话框!")
- )
- (if (= dd 1) (progn
- (setq pt (getpoint "\请点取计算面积书写位置:" ))
- (if (setq STA (bpoly PT)) (progn
- (command "AREA" "E" "L")
- (setq QAREA (rtos (/ (getvar "AREA") bl) 2 xsd)) ;2 = 十进制,xsd = 小数点位数
- (command "TEXT" PT txtzg "0" (strcat QAREA bzdw)) ;txtzg=字高,0角度
- ))
- ))
- )
- (defun show_list(key newlist) ;调用显示选单数据子程序
- (start_list key) ;开始处理选单对象
- (mapcar 'add_list newlist) ;逐一加入信息至选单
- (end_list) ;结束处理选单
- )
- (defun chk_style() ;检查字型
- (setq chksty (tblsearch "style" "Standard"))
- (if (null chksty) ;如果不存在,则新建字形
- (command "_style" "Standard" "宋体" "" "" "" "" "")
- )
- (command "_layer" "m" "面积" "c" "3" "" "")
- (setvar "clayer" "面积") ;预设目前图层
- (setvar "textstyle" "Standard") ;预设目前字形
- )
-
|