@@ -18,29 +18,36 @@ storing XData, AppData and extension dictionaries in DXF entities and objects,
18
18
storing XRecords in the OBJECTS section and ends by using proxy entities or
19
19
even extending the DXF format by user defined entities and objects.
20
20
21
+ This is the common prolog for all Python code examples shown in this tutorial:
22
+
23
+ .. code-block :: Python
24
+
25
+ import ezdxf
26
+
27
+ doc = ezdxf.new()
28
+ msp = doc.modelspace()
29
+
21
30
Retrieving User Data
22
31
--------------------
23
32
24
33
Retrieving the is a simple task by `ezdxf `, but often not possible in CAD
25
- applications without using the scripting features (AutoLisp) or even the SDK.
34
+ applications without using the scripting features (AutoLISP) or even the SDK.
35
+
36
+ AutoLISP Resources
37
+ ++++++++++++++++++
38
+
39
+ - `Autodesk Developer Documentation <http://help.autodesk.com/view/OARX/2018/ENU/ >`_
40
+ - `AfraLISP <https://www.afralisp.net/index.php >`_
41
+ - `Lee Mac Programming <http://www.lee-mac.com >`_
26
42
27
43
.. warning ::
28
44
29
- I have no experience with AutoLisp so far and I created this scripts for
30
- AutoLisp while writing this tutorial. There may be better ways to accomplish
45
+ I have no experience with AutoLISP so far and I created this scripts for
46
+ AutoLISP while writing this tutorial. There may be better ways to accomplish
31
47
these tasks, and feedback on this is very welcome.
32
48
Everything is tested with BricsCAD and should also work with the
33
49
full version of AutoCAD.
34
50
35
- This is the common prolog for all Python code examples shown in this tutorial:
36
-
37
- .. code-block :: Python
38
-
39
- import ezdxf
40
-
41
- doc = ezdxf.new()
42
- msp = doc.modelspace()
43
-
44
51
Header Section
45
52
--------------
46
53
@@ -71,12 +78,12 @@ Getting the data in `BricsCAD` at the command line::
71
78
: USERI1
72
79
New current value for USERI1 (-32768 to 32767) <4711>:
73
80
74
- Getting the data by AutoLisp ::
81
+ Getting the data by AutoLISP ::
75
82
76
83
: (getvar 'USERI1)
77
84
4711
78
85
79
- Setting the value by AutoLisp ::
86
+ Setting the value by AutoLISP ::
80
87
81
88
: (setvar 'USERI1 1234)
82
89
1234
@@ -105,7 +112,7 @@ variable:
105
112
106
113
.. image :: gfx/custom_header_property.png
107
114
108
- AutoLisp script for getting the custom document properties:
115
+ AutoLISP script for getting the custom document properties:
109
116
110
117
.. code-block :: Lisp
111
118
@@ -163,7 +170,7 @@ which may never be used by `ezdxf` in the future.
163
170
The data is stored as XDATA in then BLOCK entity of the model space for DXF R12
164
171
and for DXF R2000 and later as a DXF :class: `~ezdxf.entities.Dictionary `
165
172
in the root dictionary by the key ``EZDXF_META ``.
166
- See following chapters for accessing such data by AutoLisp .
173
+ See following chapters for accessing such data by AutoLISP .
167
174
168
175
XDATA
169
176
-----
@@ -173,7 +180,7 @@ Each application needs a unique AppID registered in the AppID table to add
173
180
XDATA to an entity. The AppID ``ACAD `` is reserved and by using `ezdxf `
174
181
the AppID ``EZDXF `` is also registered automatically.
175
182
The total size of XDATA for a single DXF entity is limited to 16kB for AutoCAD.
176
- XDATA is supported by all DXF versions and is accessible by AutoLisp .
183
+ XDATA is supported by all DXF versions and is accessible by AutoLISP .
177
184
178
185
The valid group codes for extended data are limited to the following values,
179
186
see also the internals of :ref: `xdata_internals `:
@@ -204,6 +211,27 @@ Group Code Description
204
211
.. literalinclude :: src/customdata/xdata.py
205
212
:lines: 10-40
206
213
214
+ AutoLISP script for getting XDATA for AppID ``YOUR_UNIQUE_ID ``:
215
+
216
+ .. code-block :: Lisp
217
+
218
+ (defun C:SHOWXDATA (/ entity_list xdata_list)
219
+ (setq entity_list (entget (car (entsel)) '("YOUR_UNIQUE_ID")))
220
+ (setq xdata_list (assoc -3 entity_list))
221
+ (car (cdr xdata_list))
222
+ )
223
+
224
+ Script output:
225
+
226
+ .. code-block :: Text
227
+
228
+ : SHOWXDATA
229
+ Select entity: ("YOUR_UNIQUE_ID" (1000 . "custom text") (1040 . 3.141592) ...
230
+
231
+ .. seealso ::
232
+
233
+ `AfraLISP XDATA tutorial <https://www.afralisp.net/autolisp/tutorials/extended-entity-data-part-1.php >`_
234
+
207
235
Extension Dictionaries
208
236
----------------------
209
237
@@ -221,7 +249,7 @@ AutoCAD internally to store the handle to the :ref:`extension_dictionary` and
221
249
the :ref: `reactors ` in DXF entities.
222
250
`Ezdxf ` supports these kind of data storage for any AppID and the data is
223
251
preserved by AutoCAD and BricsCAD, but I haven't found a way to access this
224
- data by AutoLisp or even the SDK.
252
+ data by AutoLISP or even the SDK.
225
253
So I don't recommend this feature to store application defined data,
226
254
because :ref: `extended_data ` and the :ref: `extension_dictionary ` are well
227
255
documented and safe ways to attach custom data to entities.
0 commit comments