可以使用扩展数据 (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 )
GMT+8, 2024-6-10 17:57
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.