本帖最后由 PhantomFox 于 2011-12-19 17:24 编辑
我正在学习lisp语言,有个程序,对里面的几个步骤不是很明白,请高手指点!
能把每行的具体内容和作用写明最好!
- ;;;重圆消除 (相同圆心、相同半径);;;
- ========================================
- (defun C:TT (/ SS LST I EN ENL PT10 PT11 A N LST_NEW)
- (if (setq SS (ssget '((0 . "CIRCLE"))))
- (progn ;;组织成表((en pt10 pt11)...)
- (setq LST '()
- I 0
- )
- (repeat (sslength SS)
- (setq EN (ssname SS I)
- ENL (entget EN)
- PT10 (cdr (assoc 10 ENL))
- r (cdr (assoc 40 ENL))
- )
- (setq LST (cons (list EN PT10 r) LST))
- (setq I (1+ I))
- )
- ;;逐个对比
- (while LST
- ;;取首个
- (setq A
- (car LST)
- LST (cdr LST)
- )
- ;;对比
- (setq LST_NEW '())
- (foreach N LST
- (if
- (and (equal (cadr A) (cadr N) 0.001)
- (equal (caddr A) (caddr N) 0.001)
- )
- (entdel (car N)) ;_删除实体
- (setq LST_NEW (cons N LST_NEW))
- )
- )
- ;; (setq LST LST_NEW) ) ) )
- (princ)
- )
- )
- )
- )
|