我也来个重叠检查,欢迎提意见~~~~- ;货物分两组(样品 . 库存)
- (defun lst->2lst(lst / lst1 lst2)
- (setq lst1 '() lst2 '())
- (foreach a lst
- (if (member a lst2)
- (setq lst1 (cons a lst1))
- (setq lst2 (cons a lst2))
- )
- )
- (cons (reverse lst2) (reverse lst1))
- )
- ;检查重叠块
- (defun c:chk_blocks (/ ss entlst ptlst 2ptlst x pt)
- (setq ss (ssget '((0 . "insert")));若要检查其他图元类型,修改这里
- i 0
- )
- (if (and ss (> (sslength ss) 2))
- (progn
- (setq entlst (zml-ss->enlist ss)
- ptlst (mapcar '(lambda(x) (assoc 10(entget x))) entlst)
- 2ptlst (lst->2lst ptlst)
- )
- (if (setq 2ptlst (cdr 2ptlst))
- (progn
- (setq pt (getpoint (strcat "\n 找到" (itoa (length 2ptlst)) "个重叠块,选择引出标注点:")))
- (foreach x 2ptlst
- (entmake (list '(0 . "line") '(8 . "0-辅助层tem") (cons 62 1) x (cons 11 pt)))
- )
- (princ "\n 标注完成,为避免出错,请老大落实后再枪决!")
- )
- (alert "报告老大,没有找到重叠块!")
- )
- )
- (alert "老大,这么简单的问题自己解决!")
- )
- (princ)
- )
|