- 积分
- 733
- 明经币
- 个
- 注册时间
- 2022-10-14
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
10明经币
本帖最后由 q2284555 于 2022-11-6 17:46 编辑
请大神帮忙修改一下这是属性块提取到EXCEL表的源码。
请大神帮忙补充修改下,1.补充提取块名称和坐标 2.固定提取全图内名为“电缆统计1”和“G-DZPJT1” 这两种属性块~! !!
==============================================
(defun c:tSK () ;(/ d r ss n obj atts)
(while (setq d (tblnext "block" (null d)))
(setq r (cons (cdr (assoc 2 d)) r))
)
(and r
(setq filename (getfiled "属性输出文件名" "" "csv" 1))
)
(if filename
(progn
(setq f (open filename "w"))
(setq ss (ssget '((0 . "INSERT")))) ;选择对像,修改这里.
;(foreach name r
;(foreach (sslength ss) r
;(setq ss (ssget '((0 . "INSERT"))));选择对像,修改这里.
(if ss
(progn
(setq
atts (append
(vlax-invoke
(setq obj (vlax-ename->vla-object (ssname ss 0)))
'GetConstantAttributes
)
(vlax-invoke obj 'GetAttributes)
)
)
(princ "序号," f)
(foreach att atts
(princ (vla-get-TagString att) f)
(princ "," f)
) ;求出属性列表,写表头
(princ "\n" f)
(setq n -1)
(repeat (sslength ss)
(setq
obj (vlax-ename->vla-object (ssname ss (setq n (1+ n))))
)
(setq atts (append
(vlax-invoke obj 'GetConstantAttributes)
(vlax-invoke obj 'GetAttributes)
)
)
(princ (1+ n) f)
(princ "," f)
;(foreach att (reverse atts) ;;;同一列前后颠倒
(foreach att atts
(princ (vla-get-TextString att) f)
(princ "," f)
)
(princ "\n" f) ;写出属性值
)
(close f)
)
)
)
;(close f)
)
)
|
附件: 您需要 登录 才可以下载或查看,没有账号?注册
|