File: drawing.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 (264 lines) | stat: -rw-r--r-- 7,056 bytes parent folder | download
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
Drawing Class
=============

.. module:: ezdxf.document

The :class:`Drawing` class is the central management structure of a DXF document.

Access Layouts
--------------

- :meth:`Drawing.modelspace`
- :meth:`Drawing.paperspace`

Access Resources
----------------

- Application ID Table: :attr:`Drawing.appids`
- Block Definition Table: :attr:`Drawing.blocks`
- Dimension Style Table: :attr:`Drawing.dimstyles`
- Layer Table: :attr:`Drawing.layers`
- Linetype Table: :attr:`Drawing.linetypes`
- MLeader Style Table: :attr:`Drawing.mleader_styles`
- MLine Style Table: :attr:`Drawing.mline_styles`
- Material Table: :attr:`Drawing.materials`
- Text Style Table: :attr:`Drawing.styles`
- UCS Table: :attr:`Drawing.ucs`
- VPort Table: :attr:`Drawing.viewports`
- View Table: :attr:`Drawing.views`

- Classes Section: :attr:`Drawing.classes`
- Object Section: :attr:`Drawing.objects`

- Entity Database: :attr:`Drawing.entitydb`
- Entity Groups: :attr:`Drawing.groups`
- Header Variables: :attr:`Drawing.header`


Drawing Class
-------------

.. class:: Drawing

    The :class:`Drawing` class is the central management structure of a DXF document.

    .. attribute:: dxfversion

        Actual DXF version like ``'AC1009'``, set by :func:`ezdxf.new` or
        :func:`ezdxf.readfile`.

        For supported DXF versions see :ref:`dwgmanagement`

    .. attribute:: acad_release

        The AutoCAD release name like ``'R12'`` or ``'R2000'`` for actual
        :attr:`dxfversion`.

    .. attribute:: encoding

        Text encoding of :class:`Drawing`, the default encoding for new drawings
        is ``'cp1252'``. Starting with DXF R2007 (AC1021), DXF files are written
        as UTF-8 encoded text files, regardless of the attribute
        :attr:`encoding`.
        The text encoding can be changed to encodings listed below.

        see also: :ref:`dxf file encoding`

        ============ =================
        supported    encodings
        ============ =================
        ``'cp874'``  Thai
        ``'cp932'``  Japanese
        ``'gbk'``    UnifiedChinese
        ``'cp949'``  Korean
        ``'cp950'``  TradChinese
        ``'cp1250'`` CentralEurope
        ``'cp1251'`` Cyrillic
        ``'cp1252'`` WesternEurope
        ``'cp1253'`` Greek
        ``'cp1254'`` Turkish
        ``'cp1255'`` Hebrew
        ``'cp1256'`` Arabic
        ``'cp1257'`` Baltic
        ``'cp1258'`` Vietnam
        ============ =================

    .. attribute:: output_encoding

        Returns required output encoding for saving to filesystem or encoding
        to binary data.

    .. attribute:: filename

        :class:`Drawing` filename, if loaded by :func:`ezdxf.readfile` else ``None``.

    .. attribute:: rootdict

        Reference to the root dictionary of the OBJECTS section.


    .. attribute:: header

        Reference to the :class:`~ezdxf.sections.header.HeaderSection`, get/set
        drawing settings as header variables.

    .. attribute:: entities

        Reference to the :class:`EntitySection` of the drawing, where all
        graphical entities are stored, but only from modelspace and the
        *active* paperspace layout. Just for your information: Entities of other
        paperspace layouts are stored as :class:`~ezdxf.layouts.BlockLayout`
        in the :class:`~ezdxf.sections.blocks.BlocksSection`.

    .. attribute:: objects

        Reference to the objects section, see also :class:`~ezdxf.sections.objects.ObjectsSection`.

    .. attribute:: blocks

        Reference to the blocks section, see also :class:`~ezdxf.sections.blocks.BlocksSection`.

    .. attribute:: tables

        Reference to the tables section, see also :class:`~ezdxf.sections.tables.TablesSection`.

    .. attribute:: classes

        Reference to the classes section, see also :class:`~ezdxf.sections.classes.ClassesSection`.

    .. attribute:: layouts

        Reference to the layout manager, see also :class:`~ezdxf.layouts.Layouts`.

    .. attribute:: groups

        Collection of all groups, see also :class:`~ezdxf.entities.dxfgroups.GroupCollection`.

        requires DXF R13 or later

    .. attribute:: layers

        Shortcut for :attr:`Drawing.tables.layers`

        Reference to the layers table, where you can create, get and
        remove layers, see also :class:`~ezdxf.sections.table.Table` and
        :class:`~ezdxf.entities.Layer`

    .. attribute:: styles

        Shortcut for :attr:`Drawing.tables.styles`

        Reference to the styles table, see also :class:`~ezdxf.entities.Textstyle`.

    .. attribute:: dimstyles

        Shortcut for :attr:`Drawing.tables.dimstyles`

        Reference to the dimstyles table, see also :class:`~ezdxf.entities.DimStyle`.

    .. attribute:: linetypes

        Shortcut for :attr:`Drawing.tables.linetypes`

        Reference to the linetypes table, see also :class:`~ezdxf.entities.Linetype`.

    .. attribute:: views

        Shortcut for :attr:`Drawing.tables.views`

        Reference to the views table, see also :class:`~ezdxf.entities.View`.

    .. attribute:: viewports

        Shortcut for :attr:`Drawing.tables.viewports`

        Reference to the viewports table, see also :class:`~ezdxf.entities.VPort`.

    .. attribute:: ucs

        Shortcut for :attr:`Drawing.tables.ucs`

        Reference to the ucs table, see also :class:`~ezdxf.entities.UCSTableEntry`.

    .. attribute:: appids

        Shortcut for :attr:`Drawing.tables.appids`

        Reference to the appids table, see also :class:`~ezdxf.entities.AppID`.

    .. attribute:: materials

        :class:`~ezdxf.entities.MaterialCollection` of all
        :class:`~ezdxf.entities.Material` objects.

    .. attribute:: mline_styles

        :class:`~ezdxf.entities.MLineStyleCollection` of all
        :class:`~ezdxf.entities.MLineStyle` objects.

    .. attribute:: mleader_styles

        :class:`~ezdxf.entities.MLeaderStyleCollection` of all
        :class:`~ezdxf.entities.MLeaderStyle` objects.

    .. autoattribute:: units

    .. autoattribute:: get_abs_filepath

    .. automethod:: save

    .. automethod:: saveas

    .. automethod:: write

    .. automethod:: encode_base64

    .. automethod:: encode

    .. automethod:: query

    .. automethod:: groupby

    .. automethod:: modelspace

    .. automethod:: paperspace

    .. automethod:: layout

    .. automethod:: active_layout

    .. automethod:: layout_names

    .. automethod:: layout_names_in_taborder

    .. automethod:: new_layout

    .. automethod:: page_setup

    .. automethod:: delete_layout

    .. automethod:: add_image_def

    .. automethod:: set_raster_variables

    .. automethod:: set_wipeout_variables

    .. automethod:: add_underlay_def

    .. automethod:: add_xref_def

    .. automethod:: layouts_and_blocks

    .. automethod:: chain_layouts_and_blocks

    .. automethod:: reset_fingerprint_guid

    .. automethod:: reset_version_guid

    .. automethod:: set_modelspace_vport

    .. automethod:: audit

    .. automethod:: validate

    .. automethod:: ezdxf_metadata