
(defun c:ye_zd ( / a f f_1 gao k list_2 m n n1 new_n1 ob1 p pt ptd s1 str wtxt x y z)
(alert "\\n警告:\\n\\n 展点前请先检查数据,将数据多余抬头和空格尽量删掉,以保证展点顺畅!!!!")
(setvar "cmdecho" 0)
(command "_undo" "_begin")
; 改变点的样式和大小
(setvar "pdmode" 32)
(setvar "pdsize" 0.25)
; 指定路径
(setq wtxt (getfiled "Select a Lisp File"
"c:/program files/acad2000/support/" "*" 8
)
) ; 开始打开文件读取数据
(princ "\\n--------------------------------------------------------------->开始展点!!!\\n")
(setq a (open wtxt "r"))
(setq list_2 nil)
(while (setq f (read-line a))
(if (/= f "")
(progn
(setq f_1 (delstring f
(setq list_2 (cons f_1 list_2))
)
)
)
(close a)
(setq list_2 (vl-remove NIL (reverse list_2))) ; 开始从TXT到CAD处理
(if (null (tblsearch "layer" "孤点"))
(command "layer" "m" "孤点" "c" "1" "" "")
)
(if (null (tblsearch "layer" "注记"))
(command "layer" "m" "注记" "c" "6" "" "")
)
(setq k 0)
(setq m 0)
(setq p (length list_2))
(repeat p
(setq n1 (nth k list_2))
(setq new_n1 nil)
(foreach n n1
(if (vl-string-search "." n)
(setq new_n1 (cons n new_n1))
)
)
(if (/= new_n1 nil)
(progn
(setq new_n1 (reverse new_n1))
(setq x (nth 0 new_n1))
(setq y (nth 1 new_n1))
(setq z (nth 2 new_n1))
(if (and
(/= x nil)
(/= y nil)
(/= z nil)
)
(progn
(setq pt (cons 10 (list (atof x) (atof y) (atof z)))) ; 展出孤点
(entmake (append
'((0 . "POINT") (8 . "孤点"))
(list pt)
)
)
(setq s1 (entlast))
;(setq ob1 (vlax-ename->vla-object s1))
;(vla-put-Layer ob1 "孤点")
)
(progn
(setq str "")
(foreach n new_n1
(setq str (strcat str n
)
(princ (strcat "\\n" str "-------------------------------------------有误"))
)
) ; 开始写出标高
(command "style" "ye1" "txt" "" "" "" "n" "n" "n")
(setq ptd (assoc 10 (entget s1)))
(setq gao (strcat " " (rtos (nth 3 ptd) 2 2)))
(entmake (append
'((0 . "TEXT") (8 . "注记"))
(list ptd)
'((40 . 1.0))
(list (cons 1 gao))
'((41 . 1.0) (51 . 0.0)
(7 . "ye1")
(71 . 0)
(72 . 0)
)
(list (cons 11 (cdr ptd)))
'((73 . 0))
)
)
)
(progn
(setq str "")
(foreach n n1
(setq str (strcat str n
)
(princ (strcat "\\n" str
"-------------------------------------------有误\\n"
)
)
(setq m (+ m 1))
)
)
(setq k (+ k 1))
(Gfun-progress K P)
)
(princ (strcat "\\n--------------------------------------------------------------->完成展点!!!"))
(princ (strcat "\\n--------->共成功展点:<" (itoa (- k m)) ">个,其中:<"
(itoa m) ">个点有误,未能展出."
)
)
(prin1)
(command "zoom" "e")
(command "_undo" "e")
)
;;; 把字符串用 " " , . 隔开----------------------------------------------->
(defun delstring (str delim / ptr lst)
;(setq str "1 ,1000.0000 ,1000.0000,1000.0000,922, " )
;(setq delim
(while (setq ptr (vl-string-search delim str))
(if (/= ptr 0)
(setq lst (cons (vl-string-trim " " (substr str 1 ptr)) lst))
)
(setq str (substr str (+ ptr 2)))
)
(setq str(vl-string-trim " " str))
(if (/= str "")
(setq lst (cons str lst)))
(reverse lst)
)
;===========================状态栏进度条==============================
(defun Gfun-progress(a b / i i1 i2); a:分子,b:分母
(setq i (atoi (rtos (/ a b 0.01) 2 0)))
(if (< i 0) (setq i 0))
(if (> i 100) (setq i 100))
(if (/= i (atoi (rtos (/ (- a 1) b 0.01) 2 0)));只显示100次,进度与上一次相同时不显示
(progn
(setq i1 (* (fix (/ i 8)) 2))
(setq i2 (rem i 8))
(GRTEXT -2 (strcat
">>>>>>>>>> " (itoa i) "%"
(substr "████████████████████" 1 i1)
(nth i2 '("" "▏" "▎" "▍" "▌" "▋" "▊" "▉"))
))
(if (= i 100) (GRTEXT))
)
)
)
