File: dictionary.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 (142 lines) | stat: -rw-r--r-- 4,097 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
Dictionary
==========

.. module:: ezdxf.entities
    :noindex:

The `DICTIONARY`_ entity is a general storage entity.

AutoCAD maintains items such as MLINE_STYLES and GROUP definitions as objects in
dictionaries. Other applications are free to create and use their own
dictionaries as they see fit. The prefix ``'ACAD_'`` is reserved for use by
AutoCAD applications.

Dictionary entries are (key, :class:`DXFEntity`) pairs for fully loaded or
new created DXF documents. The referenced entities are owned by the dictionary
and cannot be graphical entities that always belong to the layout in which they
are located.

Loading DXF files is done in two passes, because at the first loading stage not
all referenced objects are already stored in the entity database. Therefore the
entities are stored as handles strings at the first loading stage and have to
be replaced by the real entity at the second loading stage.
If the entity is still a handle string after the second loading stage, the
entity does not exist.

Dictionary keys are handled case insensitive by AutoCAD, but not by `ezdxf`,
in doubt use an uppercase key. AutoCAD stores all keys in uppercase.

======================== =============================================================
Subclass of              :class:`ezdxf.entities.DXFObject`
DXF type                 ``'DICTIONARY'``
Factory function         :meth:`ezdxf.sections.objects.ObjectsSection.add_dictionary`
======================== =============================================================

.. warning::

    Do not instantiate object classes by yourself - always use the provided
    factory functions!

.. class:: Dictionary

    .. attribute:: dxf.hard_owned

        If set to 1, indicates that elements of the dictionary are to be
        treated as hard-owned.

    .. attribute:: dxf.cloning

        Duplicate record cloning flag (determines how to merge duplicate entries,
        ignored by `ezdxf`):

        === ==================
        0   not applicable
        1   keep existing
        2   use clone
        3   <xref>$0$<name>
        4   $0$<name>
        5   Unmangle name
        === ==================


    .. autoattribute:: is_hard_owner

    .. automethod:: __len__

    .. automethod:: __contains__

    .. automethod:: __getitem__

    .. automethod:: __setitem__

    .. automethod:: __delitem__

    .. automethod:: keys

    .. automethod:: items

    .. automethod:: count

    .. automethod:: get

    .. automethod:: add

    .. automethod:: remove

    .. automethod:: discard

    .. automethod:: clear

    .. automethod:: add_new_dict

    .. automethod:: get_required_dict

    .. automethod:: add_dict_var

    .. automethod:: add_xrecord

    .. automethod:: link_dxf_object


.. _DICTIONARY: http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-40B92C63-26F0-485B-A9C2-B349099B26D0

DictionaryWithDefault
=====================

======================== =========================================================================
Subclass of              :class:`ezdxf.entities.Dictionary`
DXF type                 ``'ACDBDICTIONARYWDFLT'``
Factory function         :meth:`ezdxf.sections.objects.ObjectsSection.add_dictionary_with_default`
======================== =========================================================================

.. class:: DictionaryWithDefault

    .. attribute:: dxf.default

        Handle to default entry as hex string like ``FF00``.

    .. automethod:: get

    .. automethod:: set_default


DictionaryVar
=============

======================== =========================================================================
Subclass of              :class:`ezdxf.entities.DXFObject`
DXF type                 ``'DICTIONARYVAR'``
Factory function         :meth:`ezdxf.entities.Dictionary.add_dict_var`
======================== =========================================================================

.. class:: DictionaryVar

    .. attribute:: dxf.schema

        Object schema number (currently set to 0)

    .. attribute:: dxf.value

        Value as string.

    .. autoproperty:: value