CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoLISP 开发指南

关于 Xrecord 对象(AutoLISP)

2023-1-6 11:05| 发布者: admin| 查看: 613| 评论: 0|来自: AutoCAD

摘要: Xrecord 对象用于存储和管理任意数据。

Xrecord 对象用于存储和管理任意数据。

它们由 DXF 组代码和普通对象组代码(即非 xdata 组代码)组成,对于支持的范围,范围从 1 到 369。这些对象在概念上类似于 xdata,但不受大小或顺序的限制。

下面的代码示例在名为 XRECLIST 的自定义字典中创建并列出 xrecord 数据。

(defun C:MAKEXRECORD( / xrec xname )
  ; create the xrecord's data list.
  (setq xrec '((0 . "XRECORD")(100 . "AcDbXrecord")
    (1 . "This is a test xrecord list")
    (10 1.0 2.0 0.0) (40 . 3.14159) (50 . 3.14159)
    (62 . 1) (70 . 180))
  )

  ; use entmakex to create the xrecord with no owner.
  (setq xname (entmakex xrec))

  ; add the new xrecord to the named object dictionary.
  (dictadd (namedobjdict) "XRECLIST" xname)
 (princ)
)

(defun C:LISTXRECORD ( / xlist )
  ; find the xrecord in the named object dictionary.
  (setq xlist (dictsearch (namedobjdict) "XRECLIST"))

  ; print out the xrecord's data list.
  (princ xlist)
 (princ)
)

LISTXRECORD 命令的结果将类似于以下内容:

((-1 . <Entity name: 7ffffb05ee0>) (0 . XRECORD) (5 . 1E6) (102 . {ACAD_REACTORS) (330 . <Entity name: 7ffffb038c0>) (102 . }) (330 . <Entity name: 7ffffb038c0>) (100 . AcDbXrecord) (280 . 1) (1 . This is a test xrecord list) (10 1.0 2.0 0.0) (40 . 3.14159) (50 . 3.14159) (62 . 1) (70 . 180))

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 13:08

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部