File: lwpolyline.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 (144 lines) | stat: -rw-r--r-- 4,005 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
LWPolyline
==========

.. module:: ezdxf.entities
    :noindex:

The LWPOLYLINE entity (Lightweight POLYLINE, `DXF Reference`_) is defined as 
a single graphic entity, which differs from the old-style :class:`Polyline` 
entity, which is defined as a group of sub-entities. :class:`LWPolyline` 
display faster (in AutoCAD) and consume less disk space, it is a planar 
element, therefore all points are located in the :ref:`OCS` as (x, y)-tuples
(:attr:`LWPolyline.dxf.elevation` is the z-axis value).


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

.. _DXF Reference: http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-748FC305-F3F2-4F74-825A-61F04D757A50

.. _bulge value:

.. rubric:: Bulge value

The bulge value is used to create arc shaped line segments for :class:`Polyline`
and :class:`LWPolyline` entities. The arc starts at the vertex which includes
the bulge value and ends at the following vertex. The bulge value defines the
ratio of the arc sagitta (versine) to half line segment length, a bulge value
of 1 defines a semicircle.

The sign of the bulge value defines the side of the bulge:

    - positive value (> 0): bulge is right of line (counter clockwise)
    - negative value (< 0): bulge is left of line (clockwise)
    - 0 = no bulge

.. image:: ../tutorials/gfx/bulge.png

.. rubric:: Start- and end width

The start width and end width values defines the width in drawing units for the
following line segment. To use the default width value for a line segment set
value to 0.

.. rubric:: Width and bulge values at last point

The width and bulge values of the last point has only a meaning if the polyline
is closed, and they apply to the last line segment from the last to the first
point.

.. seealso::

    :ref:`tut_lwpolyline` and :ref:`bulge_related_functions`


.. _format codes:

User Defined Point Format Codes
-------------------------------


    ==== =====================
    Code Point Component
    ==== =====================
       x x-coordinate
       y y-coordinate
       s start width
       e end width
       b bulge value
       v (x, y [, z]) as tuple
    ==== =====================

.. class:: LWPolyline

    .. attribute:: dxf.elevation

        :ref:`OCS` z-axis value for all polyline points, default=0

    .. attribute:: dxf.flags

        Constants defined in :mod:`ezdxf.lldxf.const`:

        ============================== ======= ===========
        dxf.flags                      Value   Description
        ============================== ======= ===========
        LWPOLYLINE_CLOSED              1       polyline is closed
        LWPOLYLINE_PLINEGEN            128     linetype is generated across the points
        ============================== ======= ===========

    .. attribute:: dxf.const_width

        Constant line width (float), default value is 0.

    .. attribute:: dxf.count

        Count of polyline points (read only), same as :code:`len(polyline)`

    .. autoproperty:: closed

    .. autoproperty:: is_closed

    .. automethod:: close

    .. autoproperty:: has_arc

    .. autoproperty:: has_width

    .. automethod:: __len__

    .. automethod:: __getitem__

    .. automethod:: __setitem__

    .. automethod:: __delitem__

    .. automethod:: __iter__

    .. automethod:: vertices

    .. automethod:: vertices_in_wcs

    .. automethod:: append

    .. automethod:: append_points

    .. automethod:: insert

    .. automethod:: clear

    .. automethod:: get_points

    .. automethod:: set_points

    .. automethod:: points

    .. automethod:: transform

    .. automethod:: virtual_entities

    .. automethod:: explode