本帖最后由 自贡黄明儒 于 2014-3-13 10:45 编辑
- ;;组码比较=>((相同)(不同))
- ;;比较同一对象:1 先执行w1, 2 改变对象 3 再执行w1
- (defun C:W1 (/ ANSWER BT E1 E2 EN2 FLAG XT)
- (initget "Yes No")
- (cond ((setq answer (GETKWORD "[不相同(N)/相同(Y)]<不相同N>")) nil)
- (T
- (setq *en1* nil)
- (setq answer "No")
- )
- )
- (setq Flag (and (not *en1*) (equal answer "Yes")))
- (cond ((or Flag (equal answer "No"))
- (setq e1 (car (entsel)))
- (setq *en1* (entget e1))
- )
- )
- (if Flag
- nil
- (cond (*en1*
- (setq e2 (car (entsel)))
- (setq en2 (entget e2))
- )
- )
- )
- (cond
- (Flag (princ "\n 再次执行此命令,选择相同对象"))
- (T
- (cond
- ((and *en1* en2)
- (foreach x *en1*
- (if (member x en2)
- (setq xt (cons x xt))
- (setq bt (cons x bt))
- )
- )
- (princ (list (reverse xt) (reverse bt)))
- )
- )
- (setq *en1* nil)
- )
- )
- (princ)
- )
;;组码比较=>((相同)(不同))
;;比较同一个对象:1 先执行w1 2 改变对象 3 再执行w1
(defun C:W1 (/ ANSWER BT E1 E2 EN2 FLAG XT)
(initget "Yes No")
(cond ((setq answer (GETKWORD "[不相同(N)/相同(Y)]<不相同N>")) nil)
(T
(setq *en1* nil)
(setq answer "No")
)
)
(setq Flag (and (not *en1*) (equal answer "Yes")))
(cond ((or Flag (equal answer "No"))
(setq e1 (car (entsel)))
(setq *en1* (entget e1))
)
)
(if Flag
nil
(cond (*en1*
(setq e2 (car (entsel)))
(setq en2 (entget e2))
)
)
)
(cond
(Flag (princ "\n 再次执行此命令,选择相同对象"))
(T
(cond
((and *en1* en2)
(foreach x *en1*
(cond((member x en2) (setq xt (cons x xt))))
)
(foreach x en2
(cond ((member x *en1*) nil)
(T (setq bt (cons x bt)))
)
)
(princ (list (reverse xt) (reverse bt)))
)
)
(setq *en1* nil)
)
)
(princ)
) |