(or mai_cehui_gcd_blk
    (mai_load_files (mai_panel_search "谜你测绘功能设置文件.lsp"))
)


;-------------------------------------
(defun Action_all_00j_Keys ( key value / tt bb  zdsj num lj high style str sj pt tt ) ;全部控件的点击动作触发
    (cond
        ((= key "accept")  ;;;{确认按钮}
            (setq bb
                (list
                    (Dcl:List-Getv "PopupZD")
                    (Dcl:List-Getv "PopupYS")
                    (Dcl:List-Getv "PopupGD")
                    (get_tile "ListWB")
                    (get_tile  "EditLJ")
                    (Dcl:List-Getv "PopupGS")
                )
            )
            (mai_set_style "正等线体" T)
            (if (= (getvar "userr1") 0.0)
                (setvar "userr1" 500.0)
            )
            ; (setvar "pdmode" 35)
            ; (setvar "PDSIZE" 0.3)
            (apply 'mai_create_layer mai_cehui_gcd_dianhao)
            (apply 'mai_create_layer mai_cehui_gcd_bianma)
            (apply 'mai_create_layer mai_cehui_gcd_blk)
            ;获取文件与文件数据
            (setq zdsj nil)
            (foreach num (mai_str2lst2 (nth 3 bb) " ")
                (setq lj (strcat (nth 4 bb) (nth (atoi num) slds))
                      zdsj (cons lj zdsj)
                )
            )
            ;根据格式获取文件数据
            (setq sjlst (if (= (strcase (vl-filename-extension lj)) ".DAT")  ;文件循环获取数据
                            (mapcar '(lambda(a)(mai_str2lst2 a ","))
                                     (apply 'append (mapcar '(lambda(lj)(mai_read_file lj nil nil T)) zdsj))
                            )
                        )
                    ;;数据展点
                    ;(list "点号+编码+高程" "点号+编码" "编码+高程" "点号+高程" "点号" "编码" "高程")
                  high (atof (caddr bb))
                  style (cadr bb)
                  str (if (= (nth 5 bb) "平面X,平面Y")
                          "(mapcar '(lambda(x)(atof(nth x sj)))(list 3 2 4))"
                          "(mapcar '(lambda(x)(atof(nth x sj)))(list 2 3 4))"
                      )
            )
            (foreach sj sjlst
                (setq pt (eval (read str)))
                ;;构造点
                (or (= (car bb) "高程")
                    (entmakeX (list '(0 . "POINT") (cons 10 pt) (cons 8 (car mai_cehui_gcd_dianhao))))
                )
                ;构造点号
                (if (wcmatch (car bb) "*点号*")
                    (entmakeX (list '(0 . "TEXT") (cons 1 (car sj)) (cons 7 style) (cons 8(car mai_cehui_gcd_dianhao)) (cons 10 pt) (cons 40 high)))
                )
                ;构造编码
                (if (wcmatch (car bb) "*编码*")
                    (entmakeX (list '(0 . "TEXT")(cons 1 (cadr sj))(cons 7 style)(cons 8 (car mai_cehui_gcd_bianma))(cons 10 pt)(cons 40 high)))
                )
                ;构造高程
                (if (wcmatch (car bb) "*高程*")
                    (gxl_cs:gcd pt (caddr pt) 0.5 2 (car mai_cehui_gcd_blk))
                )
            )
            (vla-ZoomExtents (vlax-get-acad-object))
            ;("点号+编码+高程" "仿宋" "1.0" "0 1 2" "C:\\Users\\Administrator\\Desktop\\松山湖环湖路")
            (Get_all_00j_Data)
            (done_dialog 1)
        )
        ((= key "GetFolar");;;{"选择根目录"} (按钮)
            (setq tt (mai_Getdir "选择目录" path))
            (if tt
                (progn
                    (setq path tt)
                    (set_tile "EditLJ" path)
                    (Dcl:List-Set "ListWB" (setq slds (mai_dos_dir path "*.dat")) nil)
                )
            )
        )
    )
)
;-------------------------------------
(defun Get_all_00j_Data ( / key);临时生成Dcl文件 返回文件名
    (foreach key keys
        (set (read (strcat key "_bak")) (get_tile key));每个控件都赋给一个变量 用于下次开启初始化
    )
)
;-------------------------------------
(defun Write_Dcl_all_00j( / Dcl_File file str)
    (setq Dcl_File (vl-filename-mktemp nil nil ".Dcl")
          file (open Dcl_File "w")
    )
    (foreach str
        '(   "CassZBZD:dialog{ label = \"坐标展点 [迷你修改版版 ]\" ;"
             "    :column {"
             "        :row { :button { fixed_width = true ; key = \"GetFolar\" ; label = \"选择根目录\" ; width = 5 ; }"
             "               :edit_box { key = \"EditLJ\" ; width = 60 ; }"
             "        }"
             "        :button { is_enabled = false ; key = \"jinzhi\" ; label = \"展点格式：点号,代码,平面坐标X,平面坐标Y,地面高程\" ; }"
             "        :row {"
             "            :column { fixed_width = true ; width = 50 ;"
             "                :popup_list { key = \"PopupZD\" ; label = \"展点功能\" ; }"
             "                :popup_list { key = \"PopupGS\" ; label = \"展点格式\" ; }"
             "                :popup_list { key = \"PopupYS\" ; label = \"字体样式\" ; }"
             "                :popup_list { key = \"PopupGD\" ; label = \"字体高度\" ; }"
             "            }"
             "            :column { fixed_width = true ; width = 40 ;"
             "                :list_box { key = \"ListWB\" ; multiple_select = true ;}"
             "            }"
             "        }"
             "    }"
             "    ok_cancel;"
             "}"
         )
        (write-line str file)
    )
    (close file)
    Dcl_File
)

;;说明:下拉菜单数据填充
;;参数:key:控件
;;参数:lst:表数据
;;参数:item:设置初始值
;;返回:
(defun Dcl:List-Set ( key lst item / change data sym sym_fun update)
  (or (listp lst) (setq lst nil))
  (setq sym_fun (read (strcat key ":list_box_fun")))
  (or (eval sym_fun) (set sym_fun 'vl-princ-to-string))
  (setq sym (read (strcat key ":list_box_data")))
  (set sym lst)
  (start_list key)
  (mapcar 'add_list (mapcar (eval sym_fun) lst))
  (end_list)
  (setq data (eval (read (strcat key ":list_box_data"))))
  (if (= (type item) 'INT)
      (set_tile key (itoa (if (member item data) (vl-position item data) item)))
      (if (member item data) ;字符时
          (set_tile key (itoa (vl-position item data)))
      )
  )
)
;;;取当前项
(defun Dcl:List-Getv ( key / veal index data ) ;index a data
  (or (= (setq index (get_tile key)) "")
      (setq data (eval (read (strcat key ":list_box_data")))
            veal (nth (atoi index) data)
      )
  )
  veal
)

;;于2017年7月26日创作
;;于2017年8月18日增加获取文档路径下的展点文件
;;感谢  wkq004  提供插入高程点函数
;;作者：范建威
;坐标展点[fjw_ZBZD].lsp
;-------------------------------------
(defun C:fjw_ZBZD ( / old_cmd dcl_id dcl_file dialog_return keys key path)
    (mini_start nil)
    (mai_last_com "fjw_ZBZD")
    (setq dcl_id (load_dialog (setq Dcl_File (Write_Dcl_all_00j))));对话框加载
    (vl-file-delete Dcl_File) ;加载后删除DCL文件
    (setq Dialog_Return 2)
    (while (> Dialog_Return 1) ;循环控制对话框是否结束
        (new_dialog "CassZBZD" dcl_id);建立窗体
        ;--->--->---对话框初始化--->--->---
        (setq keys '("GetFolar" "EditLJ" "jinzhi" "PopupZD" "PopupYS" "PopupGD" "PopupDYS" "PopupGS" "accept" "cancel"))
        ;->->-下拉列表初始化->->-
        (Dcl:List-Set "PopupZD" (list "点号+编码+高程" "点号+编码" "点号+高程" "编码+高程" "点号" "编码" "高程") 0)
        (Dcl:List-Set "PopupGS" (list "平面X,平面Y" "平面Y,平面X") 0)
        (Dcl:List-Set "PopupYS" (mai_tblsearch "style") nil)
        (Dcl:List-Set "PopupGD" (list "0.3" "0.5" "0.8" "1.0" "1.3" "1.5" "1.8" "2.0" "2.5" "3.0" "3.5") nil)
        (or path (setq path (getvar "dwgprefix")))
        (or (= path "")
            (progn
                (Dcl:List-Set "ListWB" (vl-directory-files path "*.dat" 1) nil)
                (set_tile "EditLJ" path)
            )
        )
        ;-<-<-下拉列表初始化完成-<-<-
        (foreach key keys ;全部控件的初始化
            (if (eval (read (strcat key "_bak"))) (set_tile key (eval (read (strcat key "_bak")))));控件内容
            (action_tile key "(Action_all_00j_Keys $key $value)");点击动作 $reason
        )
        ;---<---<---对话框初始化完成---<---<---
        (setq Dialog_Return (start_dialog));开启对话框(用户可见)
    )
    (unload_dialog dcl_id);退出时卸载对话框
    (mai_end);防止函数回显
)