|
(defun c:BZ();边长注记
(setq os(getvar "osmode" ))
(setvar "osmode" 0)
(setq sskent(ssget '((0 . "lwpolyline"))))
(setq ssl(sslength sskent))
(setq i 0)
(command "style" "黑体" "simhei.ttf" "0.4" "1" "0" "n" "n" )
;;; (setq num (getint "请键入一个数字:"))
(while (< i ssl )
(setq ssn(ssname sskent i))
(tqjl ssn )
(setq i(1+ i) ))
(setvar "osmode" os)
)
;;;)
;;;)
(princ)
;1if
(defun tqjl(ssn);提取距离
(setq n 0)
(setq y 0)
;;; (setq li10 nil)
(setq li1 nil li2 nil)
(setq li0 nil)
;;;(setq ssn(ssname ss i))
(setq ssdata(entget ssn))
(repeat (- (length ssdata) 1);提取多段线顶点列表
(setq tmp (car (nth n ssdata)))
(cond
((= tmp 10)(progn ;(setq li10(nth n ssdata))
(setq li1(cdr(nth n ssdata)))
(if (= li0 nil )
(setq li0 li1)
)
(if (/= li2 nil)
(progn
(setq sjl(rtos (distance li1 li2) 2 2))
(setq hd(angle li2 li1))
(if (and (> hd 1.5708 )(< hd 6.26))(setq hd( + hd 3.14159)))
;;; (if (and (> (- hd 1.5708)0)(< (- hd 3.14159)0)) (setq hd(+ hd 3.14159)))
(setq jd(angtos hd 0 4))
(setq zd(mapcar '/ (mapcar '+ li1 li2) '(2 2 2)))
(command "text" "j" "bc" zd jd sjl)
)
)
(setq li2(cdr(nth n ssdata)))
;;; (setq li10 (append (list (nth n ssdata)) li10)));找到顶点就添加进列表
;;; (setq s (strcat "pt" "," (rtos (nth 1 li10) 2 3) "," (rtos (nth 2 li10) 2 3))))
;;; (write-line s ff)
;;; (if (> n (- (length ssdata)3))
;;; (progn
;;; (setq sjl(rtos (* (distance li0 li1) 0.4) 2 2))
;;; (setq jd(angtos (angle li0 li1)0 4))
;;; (setq zd(mapcar '/ (mapcar '+ li0 li1) '(2 2 2)))
;;; (command "text" "j" "bc" zd "0" jd sjl)
;;; )
;;; )
(setq y (1+ y))
)))
(setq n (1+ n))
)
(if (AND (> y 2) (>= (cdr(ASSOC 70 SSDATA )) 128))
(progn
(setq sjl(rtos (distance li0 li1) 2 2))
(setq hd(angle li1 li0))
;;; (if (> (- hd 3.14159)0) (setq hd(+ hd 3.14159)))
(setq jd(angtos hd 0 4))
(setq zd(mapcar '/ (mapcar '+ li0 li1) '(2 2 2)))
(command "text" "j" "bc" zd jd sjl)
))
;;; (setq sjl1(cdr(car li10)))
;;; (setq sjl2(cdr(cadr li10)))
;;; (setq sjll(distance sjl1 sjl2))
;;; (setq i(1+ i))
)
(princ)
|
|