尝试以下操作,代码的后半部分可以通过调用 ATTSYNC 替换,但请记住,这样的调用会导致所有属性的属性恢复为块定义中定义的属性,这可能是不可取的。 [color=rgb( var(--theme-text_light) )]
- (defun c:fixatts ( / d e i s x )
- (while (setq d (tblnext "block" (null d)))
- (if (= 2 (logand 2 (cdr (assoc 70 d))))
- (progn
- (setq e (tblobjname "block" (cdr (assoc 2 d))))
- (while (setq e (entnext e))
- (if (and (setq x (entget e))
- (= "ATTDEF" (cdr (assoc 0 x)))
- (= "SIZE" (cdr (assoc 2 x)))
- )
- (entmod (cons (cons -1 e) '((8 . "SYM") (62 . 141))))
- )
- )
- )
- )
- )
- (if (setq s (ssget "_X" '((0 . "INSERT") (66 . 1))))
- (repeat (setq i (sslength s))
- (setq e (entnext (ssname s (setq i (1- i))))
- x (entget e)
- )
- (while (= "ATTRIB" (cdr (assoc 0 x)))
- (if (= "SIZE" (cdr (assoc 2 x)))
- (entmod (cons (cons -1 e) '((8 . "SYM") (62 . 141))))
- )
- (setq e (entnext e)
- x (entget e)
- )
- )
- )
- )
- (princ)
- )
|