; 由三角网生成等高线[mini_dgx].lsp

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


(defun c:mini_dgx ( / old_pwidth old_cmd t0 pts ent_mark)
  (mai_start nil)
  (mai_last_com "mini_dgx")
  (setq old_pwidth (getvar "plinewid"))
  (or mai_dgx (setq mai_dgx 1))
  (setq pts (mai_select_first '((0 . "3dface"))
                              "选择要把三角网triangle地形图变成等高线的3dface:<回车退出>"
                              "没有找到任何3dface."
            )
  )
  (and (setq t0 (getdist (strcat "\n输入等高线高度间隔:<" (rtos mai_dgx 2 3) ">")))
       (setq mai_dgx t0)
  )
  (apply 'mai_create_layer mai_cehui_dgx)
  (setvar "plinewid" 0)
  (princ "\n数据处理中......")
  (setq pts (mapcar
              '(lambda (x)(setq x (entget x)) (mai_remove_same (list (mai_dxf 10 x)(mai_dxf 11 x)(mai_dxf 12 x)(mai_dxf 13 x))))
               (mai_ssget_2_list pts)
            )
        ent_mark (entlast)
  )
  (mai_faces_elev pts mai_dgx)
  (setq t0 (strcase (getstring (strcat "\n是否曲线拟合多段线[是(Y)]:<回车为否N>"))))
  (and (= t0 "Y")
       (setq t0 (mai_ssget_2_list (mai_newset ent_mark)))
       (foreach pts t0 (command "_.pedit" pts "F" ""))
  )
  (mai_end)
)
