- 积分
- 13710
- 明经币
- 个
- 注册时间
- 2016-1-6
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2022-4-28 08:19:24
|
显示全部楼层
(defun block:get-attributes (blk / lst)
"获取块属性,返回属性名和值的点对列表。"
(if (= (quote ename)
(type blk))
(if (safearray-value (setq lst (vlax-variant-value (vla-getattributes (vlax-ename->vla-object blk)))))
(mapcar (quote (lambda (x)
(cons (vla-get-tagstring x)
(vla-get-textstring x))))
(vlax-safearray->list lst)))
nil))
;;;;;;;;;;;;;;;;
(defun pickset:to-list (ss)
"选择集->像素列表"
"像素列表"
(if ss (vl-remove-if-not (quote p:enamep)
(mapcar (quote cadr)
(ssnamex ss)))
nil))
;;;;;;;;;;;;;;;;;
(defun c:j1()
(defun export-pt (/ fp)
(setq fp (open (strcat "D:/"
(car (string:to-list (@:timestamp) "."))
".txt")
"w"))
(mapcar
'(lambda(x)
(setq att% (block:get-attributes x))
(write-line
(strcat (cdr (assoc "CNTP" att%))"," ;;名称
(string:from-list (mapcar '@:to-string (entity:getdxf x 10))",")"," ;;坐标
(cdr (assoc "ELEV" att%))"," ;;标高
(cdr (assoc "DESC" att%))) ;; 描述
fp))
(pickset:to-list (ssget "x" '((0 . "insert")(2 . "cpoint")))) ;; 所有块像素
)
(close fp)
(@:cmd "notepad" filename) ;; 用 notepad 打开生成的文件
(princ))
是这样吗
|
|