1个回答
展开全部
(setq sjb '("abcd" 1234 ... 20.88))
(setq a (nth 0 sjb) ; a (car sjb)
b (nth 1 sjb); b (cadr sjb)
...
c (nth (1- (length sjb)) sjb); c (last sjb)
)
(princ "\na的值=")(princ a)
(princ "\b的值=")(princ b)
(princ "\nc的值=")(princ c)
用以下程序:
提取块参照的属性值
(defun c:test()
(vl-load-com)
(while (setq ent (car (entsel)))
(setq vob (vlax-ename->vla-object ent)
name (vlax-get vob "ObjectName")
)
(if (= name "AcDbBlockReference")
(if (setq attlist (vlax-invoke vob "GetAttributes"))
(progn
(setq fhz nil)
(foreach att attlist
(setq fhz (cons (list (vlax-get att "TagString")
(vlax-get att "TextString")
) fhz
)
)
)
(princ "\n属性值列表:")(princ fhz)
)
(alert "你选取的块不带有属性,请选取带有属性的块!")
)
(alert "你选取的不是块,请选取带有属性的块!")
)
)
(princ)
)
(setq a (nth 0 sjb) ; a (car sjb)
b (nth 1 sjb); b (cadr sjb)
...
c (nth (1- (length sjb)) sjb); c (last sjb)
)
(princ "\na的值=")(princ a)
(princ "\b的值=")(princ b)
(princ "\nc的值=")(princ c)
用以下程序:
提取块参照的属性值
(defun c:test()
(vl-load-com)
(while (setq ent (car (entsel)))
(setq vob (vlax-ename->vla-object ent)
name (vlax-get vob "ObjectName")
)
(if (= name "AcDbBlockReference")
(if (setq attlist (vlax-invoke vob "GetAttributes"))
(progn
(setq fhz nil)
(foreach att attlist
(setq fhz (cons (list (vlax-get att "TagString")
(vlax-get att "TextString")
) fhz
)
)
)
(princ "\n属性值列表:")(princ fhz)
)
(alert "你选取的块不带有属性,请选取带有属性的块!")
)
(alert "你选取的不是块,请选取带有属性的块!")
)
)
(princ)
)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询