File: dxftag_collections.rst

package info (click to toggle)
ezdxf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 104,528 kB
  • sloc: python: 182,341; makefile: 116; lisp: 20; ansic: 4
file content (193 lines) | stat: -rw-r--r-- 4,507 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
.. automodule:: ezdxf.lldxf.tags

.. class:: Tags

    Subclass of ``list``.

    Collection of :class:`~ezdxf.lldxf.types.DXFTag` as flat list. Low level tag container, only required for advanced
    stuff.

    .. automethod:: from_text(text: str) -> Tags

    .. automethod:: dxftype

    .. automethod:: get_handle

    .. automethod:: replace_handle

    .. automethod:: has_tag

    .. automethod:: has_embedded_objects

    .. automethod:: get_first_tag(code: int, default=DXFValueError) -> DXFTag

    .. automethod:: get_first_value(code: int, default=DXFValueError) -> Any

    .. automethod:: find_all(code: int) -> List[DXFTag]

    .. automethod:: filter(codes: Iterable[int]) -> Iterable[DXFTag]

    .. automethod:: collect_consecutive_tags(codes: Iterable[int], start: int = 0, end: int = None) -> Tags

    .. automethod:: tag_index

    .. automethod:: update(tag: DXFTag)

    .. automethod:: set_first(tag: DXFTag)

    .. automethod:: remove_tags

    .. automethod:: remove_tags_except

    .. automethod:: pop_tags(codes: Iterable[int]) -> Iterable[DXFTag]

    .. automethod:: strip(tags: Tags, codes: Iterable[int]) -> Tags

.. autofunction:: group_tags(tags: Iterable[DXFTag], splitcode: int = 0) -> Iterable[Tags]


.. module:: ezdxf.lldxf.extendedtags

.. class:: ExtendedTags(tags: Iterable[DXFTag]=None, legacy=False)

    Represents the extended DXF tag structure introduced with DXF R13.

    Args:
        tags: iterable of :class:`~ezdxf.lldxf.types.DXFTag`
        legacy: flag for DXF R12 tags

    .. attribute:: appdata

        Application defined data as list of :class:`Tags`

    .. attribute:: subclasses

        Subclasses as list of :class:`Tags`

    .. attribute:: xdata

        XDATA as list of :class:`Tags`

    .. attribute:: embedded_objects

        embedded objects as list of :class:`Tags`

    .. autoattribute:: noclass

    .. automethod:: get_handle

    .. automethod:: dxftype

    .. automethod:: replace_handle

    .. automethod:: legacy_repair

    .. automethod:: clone() -> ExtendedTags

    .. automethod:: flatten_subclasses

    .. automethod:: get_subclass(name: str, pos: int = 0) -> Tags

    .. automethod:: has_xdata

    .. automethod:: get_xdata(appid: str) -> Tags

    .. automethod:: set_xdata

    .. automethod:: new_xdata(appid: str, tags: 'IterableTags' = None) -> Tags

    .. automethod:: has_app_data

    .. automethod:: get_app_data(appid: str) -> Tags

    .. automethod:: get_app_data_content(appid: str) -> Tags

    .. automethod:: set_app_data_content

    .. automethod:: new_app_data(appid: str, tags: 'IterableTags' = None, subclass_name: str = None) -> Tags

    .. automethod:: from_text(text: str, legacy: bool = False) -> ExtendedTags


.. module:: ezdxf.lldxf.packedtags

Packed DXF Tags
---------------

Store DXF tags in compact data structures as ``list`` or :class:`array.array` to reduce memory usage.

.. class:: TagList(data: Iterable = None)

    Store data in a standard Python ``list``.

    Args:
        data: iterable of DXF tag values.

    .. attribute:: values

        Data storage as ``list``.

    .. automethod:: clone() -> TagList

    .. automethod:: from_tags(tags: Tags, code: int) -> TagList

    .. automethod:: clear

.. class:: TagArray(data: Iterable = None)

    :class:`TagArray` is a subclass of :class:`TagList`, which store data in an :class:`array.array`.
    Array type is defined by class variable ``DTYPE``.

    Args:
        data: iterable of DXF tag values.

    .. attribute:: DTYPE

        :class:`array.array` type as string

    .. attribute:: values

        Data storage as :class:`array.array`

    .. automethod:: set_values

.. class:: VertexArray(data: Iterable = None)

    Store vertices in an ``array.array('d')``.
    Vertex size is defined by class variable :attr:`VERTEX_SIZE`.

    Args:
        data: iterable of vertex values as linear list e.g. :code:`[x1, y1, x2, y2, x3, y3, ...]`.

    .. attribute:: VERTEX_SIZE

        Size of vertex (2 or 3 axis).

    .. automethod:: __len__

    .. automethod:: __getitem__

    .. automethod:: __setitem__

    .. automethod:: __delitem__

    .. automethod:: __iter__

    .. automethod:: __str__

    .. automethod:: insert

    .. automethod:: append

    .. automethod:: extend

    .. automethod:: set

    .. automethod:: clear

    .. automethod:: clone() -> VertexArray

    .. automethod:: from_tags(tags: Iterable[DXFTag], code: int = 10) -> VertexArray

    .. automethod:: export_dxf