- (defun LM:GetAttributeValue ( blk tag )
- ;; © Lee Mac 2010
- (vl-some
- (function
- (lambda ( attrib )
- (if (eq tag (vla-get-Tagstring attrib))
- (vla-get-TextString attrib)
- )
- )
- )
- (vlax-invoke blk 'GetAttributes)
- )
- )
好啊知道了。。。我切换到:
- ;; Get Attribute Value - Lee Mac
- ;; Returns the value held by the specified tag within the supplied block, if present.
- ;; blk - [vla] VLA Block Reference Object
- ;; 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)
- )
- )
- )
现在开始工作了 |