尝试以下操作:
- (defun c:blkrot ( / i r s )
- (if (setq s (ssget "_:L" '((0 . "INSERT") (66 . 1))))
- (repeat (setq i (sslength s))
- (if
- (and
- (setq r (LM:getattributevalue (setq b (ssname s (setq i (1- i)))) "ROTATION"))
- (setq r (angtof r))
- )
- (vla-put-rotation (vlax-ename->vla-object b) r)
- )
- )
- )
- (princ)
- )
- ;; Get Attribute Value - Lee Mac
- ;; Returns the value held by the specified tag within the supplied block, if present.
- ;; blk - [ent] Block (Insert) Entity Name
- ;; tag - [str] Attribute TagString
- ;; Returns: [str] Attribute value, else nil if tag is not found.
- (defun LM:getattributevalue ( blk tag / enx )
- (if (= "ATTRIB" (cdr (assoc 0 (setq enx (entget (setq blk (entnext blk)))))))
- (if (= (strcase tag) (strcase (cdr (assoc 2 enx))))
- (cdr (assoc 1 enx))
- (LM:getattributevalue blk tag)
- )
- )
- )
- (vl-load-com) (princ)
LM:从属性函数集中获取AttributeValue。 |