File: groups.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 (99 lines) | stat: -rw-r--r-- 2,286 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
Groups
======

.. module:: ezdxf.entities.dxfgroups


A group is just a bunch of DXF entities tied together. All entities of a group
has to be in the same layout (modelspace or any paperspace layout but not block).
Groups can be named or unnamed, but in reality an unnamed groups has just a
special name like "\*Annnn". The name of a group has to be unique in the drawing.
Groups are organized in the group table, which is stored as attribute
:attr:`~ezdxf.document.Drawing.groups` in the :class:`~ezdxf.document.Drawing`
object.

.. important::

    Group entities have to reside in the modelspace or an paperspace layout but not in a
    block definition!

DXFGroup
--------

.. class:: DXFGroup

    The group name is not stored in the GROUP entity, it is stored in the
    :class:`GroupCollection` object.

    .. attribute:: dxf.description

        group description (string)

    .. attribute:: dxf.unnamed

        1 for unnamed, 0 for named group (int)

    .. attribute:: dxf.selectable

        1 for selectable, 0 for not selectable group (int)

    .. automethod:: __iter__

    .. automethod:: __len__

    .. automethod:: __getitem__

    .. automethod:: __contains__

    .. automethod:: handles

    .. automethod:: edit_data

    .. automethod:: set_data

    .. automethod:: extend

    .. automethod:: clear

    .. automethod:: audit

GroupCollection
---------------

Each :class:`~ezdxf.document.Drawing` has one group table, which is accessible
by the attribute :attr:`~ezdxf.document.Drawing.groups`.

.. class:: GroupCollection

    Manages all :class:`DXFGroup` objects of a :class:`~ezdxf.document.Drawing`.

    .. method:: __len__

        Returns the count of DXF groups.

    .. method:: __iter__

        Iterate over all existing groups as (`name`, `group`) tuples. `name` is
        the name of the group as string and `group` is an :class:`DXFGroup`
        object.

    .. method:: __contains__

        Returns ``True`` if a group `name` exist.

    .. method:: get(name: str) -> DXFGroup

        Returns the group `name`. Raises :class:`DXFKeyError` if group `name`
        does not exist.

    .. automethod:: groups

    .. automethod:: new

    .. automethod:: delete

    .. method:: clear

       Delete all groups.

    .. automethod:: audit