1Classes Section
2===============
3
4The CLASSES section in DXF files holds the information for application-defined classes whose instances appear in
5:class:`~ezdxf.layouts.Layout` objects. As usual package user there is no need to bother about CLASSES.
6
7.. seealso::
8
9    DXF Internals: :ref:`classes_section_internals`
10
11.. module:: ezdxf.sections.classes
12
13.. class:: ClassesSection
14
15    .. attribute:: classes
16
17        Storage of all :class:`~ezdxf.entities.DXFClass` objects, they are not stored in the entities database, because
18        CLASS has no handle attribute.
19
20    .. method:: register(classes: Iterable[DXFClass])
21
22    .. automethod:: add_class
23
24    .. automethod:: get(name: str) -> DXFClass
25
26    .. automethod:: add_required_classes(name: str) -> DXFClass
27
28    .. automethod:: update_instance_counters
29
30.. module:: ezdxf.entities
31    :noindex:
32
33.. class:: DXFClass
34
35    Information about application-defined classes.
36
37    .. attribute:: dxf.name
38
39        Class DXF record name.
40
41    .. attribute:: dxf.cpp_class_name
42
43        C++ class name. Used to bind with software that defines object class behavior.
44
45    .. attribute:: dxf.app_name
46
47        Application name. Posted in Alert box when a class definition listed in this section is not currently loaded.
48
49    .. attribute:: dxf.flags
50
51        Proxy capabilities flag
52
53        ======= =========================
54        0       No operations allowed (0)
55        1       Erase allowed (0x1)
56        2       Transform allowed (0x2)
57        4       Color change allowed (0x4)
58        8       Layer change allowed (0x8)
59        16      Linetype change allowed (0x10)
60        32      Linetype scale change allowed (0x20)
61        64      Visibility change allowed (0x40)
62        128     Cloning allowed (0x80)
63        256     Lineweight change allowed (0x100)
64        512     Plot Style Name change allowed (0x200)
65        895     All operations except cloning allowed (0x37F)
66        1023    All operations allowed (0x3FF)
67        1024    Disables proxy warning dialog (0x400)
68        32768   R13 format proxy (0x8000)
69        ======= =========================
70
71    .. attribute:: dxf.instance_count
72
73        Instance count for a custom class.
74
75    .. attribute:: dxf.was_a_proxy
76
77        Set to ``1`` if class was not loaded when this DXF file was created, and ``0`` otherwise.
78
79    .. attribute:: dxf.is_an_entity
80
81        Set to ``1`` if class was derived from the :class:`DXFGraphic` class and can reside in layouts.
82        If ``0``, instances may appear only in the OBJECTS section.
83
84    .. attribute:: key
85
86        Unique name as ``(name, cpp_class_name)`` tuple.