Gotrekk 发表于 2022-7-5 19:14:27


(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 Block Reference Object
;; tag - Attribute TagString
;; Returns: 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)
       )
   )
)

现在开始工作了

Lee Mac 发表于 2022-7-5 19:20:11

好东西
 
您可以参考我的网站获取最新版本的功能;为了避免这个问题,我重命名了Visual LISP函数。

Gotrekk 发表于 2022-7-5 19:23:25

编辑:已解决
 
谢谢
页: 1 [2]
查看完整版本: 动态块-属性