; 由离散点生成三角网[mini_triangle].lsp


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

(defun c:mini_triangle ( / old_cmd t0 sss pts)
  (mai_start nil)
  (mai_last_com "mini_triangle")
  (setq t0 (car (mai_entsel nil "选择一个实体并获得块或点的图层名:" "选择的不是实体." nil nil)))
  (or t0 (exit))
  (setq pts (mai_select_first (list (cons 0 "INSERT,point") (assoc 8 (entget t0)))
                              "选择要由离散点生成三角网triangle地形的块或点:<回车退出>"
                              "没有找到任何块或点."
            )
  )
  (princ "\n数据处理中......")
  ; (setq t0 (getvar "TDUSRTIMER"))
  (setq pts (mapcar '(lambda (x)(trans (mai_dxf 10 x) 0 1)) (mai_ssget_2_list pts))
        sss (mai_points_triangle pts)
  )
  ; (princ (strcat "\n用时" (rtos (* (- (getvar "TDUSRTIMER") t0) 86400) 2 4) "秒"))
  (apply 'mai_create_layer mai_triangle_layer)
  (mapcar '(lambda (x) (mai_a_triangle (mapcar '(lambda (y)(nth y pts)) x) nil)) sss)
  ; (princ (strcat "\n用时" (rtos (* (- (getvar "TDUSRTIMER") t0) 86400) 2 4) "秒"))
  (mai_end)
)
