明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1537|回复: 2

get block attribute textstring without opening drawing

[复制链接]
发表于 2011-9-22 14:58:04 | 显示全部楼层 |阅读模式
hi. how do you get the textstring of an attribute in  drawing without opening. i have this code so far....



(defun objectdbxdoc()
  (vlax-get-or-create-object
    (strcat "ObjectDBX.AxDbDocument."
            (substr (getvar "acadver") 1 2)
    )
  )
)

(defun c:cl()

  (setq pat (getfiled "Select filename to get path" "P:\\" "" 4))
  (setq pat (vl-filename-directory pat))
  (setq fils (vl-directory-files pat "*.dwg"))
  (foreach fil fils
    (setq odoc (objectdbxdoc))
    (vla-open odoc (strcat pat "\\" fil) :vlax-true)
    (if (setq blks (vla-get-blocks odoc))
      (progn
        (vlax-for i blks
          (if (= (vlax-get-property i 'name) "REVNO")
            (progn

;|
              (setq atts (vlax-invoke-method i 'getattributes)) ;THIS CODE DOESNT WORK SINCE THERE IS NO GETATTRIBUTES METHOD OF THE BLOCK.
              (setq atts (vlax-safearray->list (vlax-variant-value atts)))
              (setq val (cdr (assoc 1 (nth atts 0))))
              (alert val)
|;

            )
          )
        )
      ) ;progn
    ) ;if setq lays
    (vlax-release-object odoc)
  ) ;foreach fil
  (princ)
)

Thanks for all the help!


 楼主| 发表于 2011-9-23 17:11:31 | 显示全部楼层
顶一下,急需帮助!
发表于 2011-9-23 19:21:11 | 显示全部楼层
原来楼主会说中文啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-7-25 04:57 , Processed in 0.165656 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表