本帖最后由 USER2128 于 2013-1-3 18:13 编辑
![](source/plugin/imc_colorcode/images/loading.gif)
- (defun c:tt ()
- (setq line-pts '()
- cnt 0)
- (if (setq lines (ssget '((0 . "line"))))
- (progn
- (repeat (sslength lines)
- (setq ent (entget (ssname lines cnt))
- line-pts (cons (list (cdr (assoc 10 ent))
- (cdr (assoc 11 ent)))
- line-pts)
- cnt (1+ cnt)
- ))
- (setq line-pts (reverse line-pts))
- (setq txtent (mapcar '(lambda(u)
- (progn
- (setq x (car u)
- y (cadr u))
- (setq dist (* (distance x y) 0.5)
- ang (angle x y))
- (setq pt1 (polar x (+ (* pi 1.5) ang) dist)
- pt2 (polar pt1 ang (* dist 2))
- pt3 (polar y (+ (* pi 0.5) ang) dist)
- pt4 (polar pt3 (+ ang pi) (* dist 2))
- )
- (setq txtmp (ssget "_WP" (list pt1 pt2 pt3 pt4) '((0 . "TEXT"))))
- txtmp
- )) line-pts))
- (setq txts (mapcar '(lambda(x)
- (progn
- (setq cnt 0
- txtmp '())
- (repeat (if x (sslength x) 0)
- (setq txtmp (cons (cdr (assoc 1 (entget (ssname x cnt))))
- txtmp))
- (setq cnt (1+ cnt))
- )
- txtmp)) txtent))
- (setq cnt 1)
- (mapcar '(lambda(x y z)
- (progn
- (setq h (cdr (assoc 40 (entget (ssname y 0))))
- h (/ h 1.25)
- tmp (polar (car x) (angle (cadr x) (car x)) h)
- )
-
- (entmake (list '(0 . "CIRCLE") (cons 10 tmp) (cons 40 h)))
- (entmake (list '(0 . "TEXT") (cons 1 (itoa cnt))
- (cons 40 (* h 1.25))
- (cons 50 0.0) '(71 . 0) '(72 . 1) '(73 . 2)
- (cons 10 tmp) (cons 11 tmp)))
- (princ (strcat "\nLine" (itoa cnt) ":\t"))
- (mapcar '(lambda(u) (princ u) (princ "\t")) z)
- (setq cnt (1+ cnt))
- )) line-pts txtent txts)
- )
- (princ "\n未选取直线!!!")
- )
- txtent
- )
-
|