乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 43|回复: 3

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

[复制链接]

68

主题

218

帖子

8

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
490
发表于 2004-4-29 10:23:00 | 显示全部楼层 |阅读模式
请教各位大哥,用atuolisp如何实现将变量的内容值赋于属性块以替代属性块中的属性值,应该用什么函数?
回复

使用道具 举报

16

主题

909

帖子

8

银币

中流砥柱

Rank: 25

铜币
973
发表于 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
)
回复

使用道具 举报

29

主题

1152

帖子

10

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1268
发表于 2004-4-30 16:04:00 | 显示全部楼层
PETTY
直接修改屬性塊中的屬性值不好嗎?看來你對AUTOCAD的不太了解
回复

使用道具 举报

20

主题

872

帖子

10

银币

中流砥柱

Rank: 25

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

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-8-16 03:28 , Processed in 1.582969 second(s), 61 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表