明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1930|回复: 3

如何实现autolisp将变量内容赋于属性块的属性值

[复制链接]
发表于 2004-4-29 10:23:00 | 显示全部楼层 |阅读模式
请教各位大哥,用atuolisp如何实现将变量的内容值赋于属性块以替代属性块中的属性值,应该用什么函数?
发表于 2004-4-30 09:10:00 | 显示全部楼层
The following codes has been pasted here for N times.... ;;; EXAMPLE: (vlex-ChangeAttributes (list blk (cons "tag" "new-value"))) ;;;
;;;***************************************************************************;;;
;;; Arguments:
;;; A list containing one atom and one or more dotted pairs.
;;; The atom is the entity name of the block to change.
;;; The dotted pairs consist of the attribute tag and the new value for that attribute.
;;;
;;; Notes:
;;; Modifies the specified attribute in the specified block reference
;;;***************************************************************************;;; (vl-load-com)
(defun vlex-ChangeAttributes (lst / blk itm atts)
(setq blk (vlax-Ename->vla-Object (car lst))
lst (cdr lst)
)
(if (= (vla-Get-HasAttributes blk) :vlax-true)
(progn
(setq atts (vlax-SafeArray->list
(vlax-Variant-Value (vla-GetAttributes blk))
)
); setq
(foreach item lst
(mapcar
'(lambda (x)
(if (= (strcase (car item)) (strcase (vla-Get-TagString x)))
(vla-Put-TextString x (cdr item))
); endif
)
atts
); mapcar
); foreach
(vla-Update blk)
)
); endif
)
发表于 2004-4-30 16:04:00 | 显示全部楼层

PETTY

直接修改屬性塊中的屬性值不好嗎?看來你對AUTOCAD的<圖元名稱>不太了解

发表于 2004-4-30 20:24:00 | 显示全部楼层
首先要搞清楚是同时改一个块中多个属性值,还是改块中多个属性中的一个(用点取还是用特征)或是一个块只有一个属性。


如果调用命令,用 attedit
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-1 12:56 , Processed in 0.184074 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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