假设块不是动态的,请尝试以下操作:
- (defun c:addname ( / ss name data i )
- (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "A,B"))))
- (progn
- (setq name (getstring t "\nSpecify Name: "))
- (setq data
- (list
- (cons "CHECKED" name)
- '("STATUS" . "")
- )
- )
- (repeat (setq i (sslength ss))
- (LM:SetAttributeValues (ssname ss (setq i (1- i))) data)
- )
- )
- )
- (princ)
- )
- (defun c:forapproval ( / ss data i )
- (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "A,B"))))
- (progn
- (setq data
- '(
- ("CHECKED" . "")
- ("STATUS" . "FOR APPROVAL")
- )
- )
- (repeat (setq i (sslength ss))
- (LM:SetAttributeValues (ssname ss (setq i (1- i))) data)
- )
- )
- )
- (princ)
- )
- ;; Set Attribute Values - Lee Mac
- ;; Sets the block attributes whose tags are found in the supplied
- ;; association list to their associated values.
- (defun LM:SetAttributeValues ( block lst / elist item )
- (if
- (eq "ATTRIB"
- (cdr
- (assoc 0
- (setq elist
- (entget (setq block (entnext block)))
- )
- )
- )
- )
- (if (setq item (assoc (strcase (cdr (assoc 2 elist))) lst))
- (progn
- (if (setq elist (entmod (subst (cons 1 (cdr item)) (assoc 1 elist) elist)))
- (entupd (cdr (assoc -1 elist)))
- )
- (LM:SetAttributeValues block lst)
- )
- (LM:SetAttributeValues block lst)
- )
- )
- )
您可能还对这些函数感兴趣。 |