superxzg 发表于 2007-2-5 16:35 
zzxxqq,你真是我的偶像啊,真厉害!这都能想到!能不能给我介绍一下“p”的含义?我看书上是说“对应Autoc ...
;凸度计算弧心 - (defun c:tt ()
- (setq pclst (list))
- (if (and (setq s1 (entsel "\n选择多段线: "))
- (setq ent (entget(car s1)))
- (= (cdr(assoc 0 ent)) "LWPOLYLINE")) (progn
- (setq J 0 N (cdr (assoc 90 ent)) CL (rem (cdr (assoc 70 ent)) 2) K 1)
- (while (/= (car (nth J ent)) 10) (setq J (1+ J)))
- (setq P1 (cdr (nth J ent)) PS P1)
- (repeat (1- N)
- (setq P2 (cdr (nth (+ J (* K 4)) ent)) BULGE (cdr (nth (+ J (* K 4) -1) ent)))
- (if (> (abs BULGE) 0.0)
- (setq LL (* (distance P1 P2) 0.5) ANG (angle P1 P2)
- PC (polar (polar P1 ANG LL) (- ANG AL1) (* (+ BULGE (if (> BULGE 0) -1 1)) LL))
- pclst (cons PC pclst))
- )
- (setq P1 P2)
- )
- (setq BULGE (cdr (nth (+ J (* K 4) -1) ent)))
- (if (= CL 1)
- (if (> (abs BULGE) 0.0)
- (setq LL (* (distance P1 PS) 0.5) ANG (angle P1 PS)
- PC (polar (polar P1 ANG LL) (- ANG AL1) (* (+ BULGE (if (> BULGE 0) -1 1)) LL))
- pclst (cons PC pclst))
- )
- )
- ))
- pclst
- )
|