File: mpolygon.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 (126 lines) | stat: -rw-r--r-- 4,178 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
MPolygon
========

.. module:: ezdxf.entities
    :noindex:

The MPOLYGON entity is not a core DXF entity and is not supported by all CAD
applications and DXF libraries.
The :class:`MPolygon` class is very similar to the :class:`Hatch` class with
small differences in the supported features and DXF attributes.

The boundary paths of the MPOLYGON are visible and use the graphical DXF
attributes of the main entity like :attr:`dxf.color`, :attr:`dxf.linetype` and so on.
The solid filling is only visible if the attribute :attr:`dxf.solid_fill` is 1,
the color of the solid fill is defined by :attr:`dxf.fill_color` as :ref:`ACI`.
The MPOLYGON supports :class:`ezdxf.entities.Gradient` settings like HATCH
for DXF R2004 and newer. This feature is used by method :meth:`MPolygon.set_solid_fill`
to set a solid RGB fill color as linear gradient, this disables pattern fill
automatically.
The MPOLYGON does not support associated source path entities, because the
MPOLYGON also represents the boundary paths as visible graphical objects.
Hatch patterns are supported, but the hatch style tag is not supported, the
default hatch style is :attr:`ezdxf.const.HATCH_STYLE_NESTED` and the style
flags of the boundary paths are ignored.
Background color for pattern fillings is supported, set background color
by property :attr:`MPolygon.bgcolor` as RGB tuple.

.. note::

    Background RGB fill color for solid fill and pattern fill is set
    differently!

Autodesk products do support polyline paths including bulges.
An example for edge paths as boundary paths is not available or edge paths
are not supported. `Ezdxf` does **not** export MPOLYGON entities including
edge paths! The :meth:`BoundaryPaths.edge_to_polyline_paths` method converts
all edge paths to simple polyline paths with approximated curves, this
conversion has to be done explicit.

.. seealso::

    For more information see the :class:`ezdxf.entities.Hatch` documentation.

======================== ==========================================
Subclass of              :class:`ezdxf.entities.DXFGraphic`
DXF type                 ``'MPOLYGON'``
Factory function         :meth:`ezdxf.layouts.BaseLayout.add_mpolygon`
Inherited DXF attributes :ref:`Common graphical DXF attributes`
Required DXF version     DXF R2000 (``'AC1015'``)
======================== ==========================================

.. class:: MPolygon

    .. attribute:: dxf.pattern_name

        Pattern name as string

    .. attribute:: dxf.solid_fill

        === ==========================================================
        1   solid fill, better use: :meth:`MPolygon.set_solid_fill`
        0   pattern fill, better use: :meth:`MPolygon.set_pattern_fill`
        === ==========================================================

        (search AutoCAD help for more information)

    .. attribute:: dxf.pattern_type

        === ===================
        0   user
        1   predefined
        2   custom
        === ===================

    .. attribute:: dxf.pattern_angle

        Actual pattern angle in degrees (float). Changing this value does not
        rotate the pattern, use :meth:`~MPolygon.set_pattern_angle` for this task.

    .. attribute:: dxf.pattern_scale

        Actual pattern scaling factor (float). Changing this value does not
        scale the pattern use :meth:`~MPolygon.set_pattern_scale` for this task.

    .. attribute:: dxf.pattern_double

        1 = double pattern size else 0. (int)

    .. attribute:: dxf.elevation

       Z value represents the elevation height of the :ref:`OCS`. (float)

    .. attribute:: paths

        :class:`BoundaryPaths` object.

    .. attribute:: pattern

        :class:`Pattern` object.

    .. attribute:: gradient

        :class:`Gradient` object.

    .. autoproperty:: has_solid_fill

    .. autoproperty:: has_pattern_fill

    .. autoproperty:: has_gradient_data

    .. autoproperty:: bgcolor

    .. automethod:: set_pattern_definition

    .. automethod:: set_pattern_scale

    .. automethod:: set_pattern_angle

    .. automethod:: set_solid_fill

    .. automethod:: set_pattern_fill

    .. automethod:: set_gradient

    .. automethod:: transform