您可以使用扩展数据 (xdata) 将所需的任何类型的信息存储在实体上。 附加到实体的 xdata 可能是外部数据库中的记录、添加或修改实体时的日期和时间戳,或者包含表示现实世界中某个项目(如电话或工作站)的信息。由于 xdata 对用户是隐藏的,因此在不使用自定义应用程序的情况下更难修改。 注意:在当前图形中或图形之间复制对象时,将保留附着到图元的 Xdata。
以下示例代码演示了将 xdata 附加到最后添加到图形的图元的基础知识。在执行以下示例代码之前,请绘制一个实体(例如直线或圆): ; Gets the association list of definition data
; for the last entity.
(setq lastent (entget (entlast)))
; Registers the application name.
(regapp "NEWDATA")
(setq exdata ; Sets the variable
'((-3 ("NEWDATA" ; exdata equal to the
(1000 . "This is a new thing!") ; new extended data—
))) ; in this case, a text
) ; string.
; Appends new data list to entity's list.
(setq newent
(append lastent exdata))
; Modifies the entity with the new definition data.
(entmod newent)
以下示例代码可用于验证是否已将新 xdata 附加到实体: (entget (car (entsel)) '("NEWDATA"))
相关概念 |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 11:23
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.