
    h                       S SK Jr  S SKJrJrJrJrJr  S SKrS SK	r	S SK
r
S SKJr  S SKJrJrJrJr  S SKJrJrJrJrJrJrJrJr  S SKJr  S SKJrJrJ r J!r!J"r"J#r#J$r$  S S	K%7  S S
K&J'r'  S SK(J)r)  S SK*J+r+  \	RX                  " S5      r-\(       ab  S SK.J/r/  S SK0J1r1  S SKJ2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrLJMrMJNrNJOrOJPrPJQrQJRrRJSrSJTrTJUrUJVrV  S SKWJXrXJYrY   " S S5      rZ1 Skr[g)    )annotations)TYPE_CHECKINGIterableSequencecastOptionalN)const)DXFValueErrorDXFVersionErrorDXF2000DXF2013)Vec3UVecUCSglobal_bspline_interpolationfit_points_to_cad_cvarc_angle_span_degConstructionArcNULLVEC)ARROWS)factoryPointSplineBodySurfaceLineCircle)*)DimStyleOverride)multi_point_linear_dimension)guidezdxf)Drawing)GenericLayoutType)%ArcAttDef	DimensionArcDimension
DXFGraphicEllipseExtrudedSurfaceFace3dHatchImageImageDefInsert
LWPolylineLeaderLoftedSurfaceMLineMTextMPolygonMeshPolyfacePolylinePolymeshRayRegionRevolvedSurfaceShapeSolidSolid3dSweptSurfaceTextTraceUnderlayUnderlayDefinitionWipeoutXLineMultiLeaderHelix)MultiLeaderMTextBuilderMultiLeaderBlockBuilderc                  "
   \ rS rSrSaS jr\SbS j5       r\S 5       rScS jrSdS jr	SeSfS jjr
SeSgS	 jjr Se     ShS
 jjrSSS\R                  S4           SiS jjr  Sj           SkS jjrSeSlS jjrSeSmS jjrSeSnS jjrSSSS.       SoS jjrSeSpS jjr Se       SqS jjr  SrSSSS.           SsS jjjr SeSSS.       StS jjjrSSS.     SuS jjr Sv   SwS jjrSeSxS jjr Se     SyS jjr\SzS j5       r   S{       S|S  jjr S}SSS.       S~S! jjjr SeSS" jjr! Se         SS# jjr" Se           SS$ jjr# Se         SS% jjr$SeSS& jjr% Se     SS' jjr&   S     SS( jjr'   S       SS) jjr(  S     SS* jjr)   S       SS+ jjr*   S         SS, jjr+SeSS- jjr,SeSS. jjr-SeSS/ jjr.SeSS0 jjr/SeSS1 jjr0SeSS2 jjr1SeSS3 jjr2SeSS4 jjr3SS5 jr4SSS6 jjr5\6Rn                  SS4     SS7 jjr8SeSS8 jjr9  S         SS: jjr:SeSS; jjr;    S       SS< jjr<SS= jr=       S                   SS@ jjr>       S               SSA jjr?    S             SSB jjr@SS>SSCSSSD.                 SSE jjrASS>SSCSSSD.                   SSF jjrBSS>SSCSSSD.                     SSG jjrCSS>SSCSSSD.               SSH jjrDSS>SSCSSSD.                   SSI jjrESS>SSCSSSD.                     SSJ jjrFSS>SSCSSSD.               SSK jjrG   SSS>SLSSSM.                 SSN jjjrH    S           SSO jjrI   SSS>SLSSSM.                 SSP jjjrJS>SLSSSQ.           SSR jjrKS>SLSSSQ.             SSS jjrL\MS9S>S?SSST.                 SSU jjrN\MS9S>S?SSST.               SSV jjrO\MS9S>S?SSST.               SSW jjrP   S         SSX jjrQ   S         SSY jjrR   S       SSZ jjrS  S   SS[ jjrT  S   SS\ jjrU Se   SS] jjrV SeSSS.     SS^ jjjrW  Sj       SS_ jjrXS`rYg)CreatorInterfaceS   c                    Xl         g Ndoc)selfrR   s     G/var/www/html/env/lib/python3.13/site-packages/ezdxf/graphicsfactory.py__init__CreatorInterface.__init__T   s        c                .    U R                   R                  $ rP   )rR   
dxfversionrS   s    rT   rY   CreatorInterface.dxfversionW   s    xx"""rW   c                    g)NF rZ   s    rT   is_active_paperspace%CreatorInterface.is_active_paperspace[   s    rW   c                j    [         R                  " XU R                  5      nU R                  U5        U$ )z
Create entity in drawing database and add entity to the entity space.

Args:
    type_ : DXF type string, like "LINE", "CIRCLE" or "LWPOLYLINE"
    dxfattribs: DXF attributes for the new entity

)r   create_db_entryrR   
add_entity)rS   type_
dxfattribsentitys       rT   
new_entityCreatorInterface.new_entity_   s+     ((DHHErW   c                    g rP   r]   )rS   re   s     rT   rb   CreatorInterface.add_entityl   s    rW   Nc                j    [        U=(       d    0 5      n[        U5      US'   U R                  SU5      $ )z
Add a :class:`~ezdxf.entities.Point` entity at `location`.

Args:
    location: 2D/3D point in :ref:`WCS`
    dxfattribs: additional DXF attributes

locationPOINTdictr   rf   )rS   rk   rd   s      rT   	add_pointCreatorInterface.add_pointo   s2     **+
!%h
:w
33rW   c                    [        U=(       d    0 5      n[        U5      US'   [        U5      US'   U R                  SU5      $ )z
Add a :class:`~ezdxf.entities.Line` entity from `start` to `end`.

Args:
    start: 2D/3D point in :ref:`WCS`
    end: 2D/3D point in :ref:`WCS`
    dxfattribs: additional DXF attributes

startendLINErm   )rS   rr   rs   rd   s       rT   add_lineCreatorInterface.add_line|   s@     **+
"5k
7 I
5vz22rW   c                    [        U=(       d    0 5      n[        U5      US'   [        U5      US'   U R                  SU5      $ )z
Add a :class:`~ezdxf.entities.Circle` entity. This is an 2D element,
which can be placed in space by using :ref:`OCS`.

Args:
    center: 2D/3D point in :ref:`WCS`
    radius: circle radius
    dxfattribs: additional DXF attributes

centerradiusCIRCLErn   r   floatrf   )rS   rx   ry   rd   s       rT   
add_circleCreatorInterface.add_circle   s@     **+
#F|
8$V}
8x44rW   )   r   r   r   r   c                   U R                   [        :  a  [        S5      e[        U5      n[	        U5      S:  a  [        S5      e[        U5      nUR                  (       a  [        S5      e[        U=(       d    0 5      n[        U5      US'   XvS'   X6S'   [        U5      US'   [        U5      US	'   U R                  S
U5      $ )uN  
Add an :class:`~ezdxf.entities.Ellipse` entity, `ratio` is the ratio of
minor axis to major axis, `start_param` and `end_param` defines start
and end point of the ellipse, a full ellipse goes from 0 to 2π.
The ellipse goes from start to end param in `counter-clockwise`
direction.

Args:
    center: center of ellipse as 2D/3D point in :ref:`WCS`
    major_axis: major axis as vector (x, y, z)
    ratio: ratio of minor axis to major axis in range +/-[1e-6, 1.0]
    start_param: start of ellipse curve
    end_param: end param of ellipse curve
    dxfattribs: additional DXF attributes

zELLIPSE requires DXF R2000      ?zinvalid axis ratio > 1.0zinvalid major axis: (0, 0, 0)rx   
major_axisratiostart_param	end_paramELLIPSE)
rY   r   r   r|   absr
   r   is_nullrn   rf   )rS   rx   r   r   r   r   rd   _major_axiss           rT   add_ellipseCreatorInterface.add_ellipse   s    2 ??W$!">??eu: :;;:& ?@@**+
#F|
8#.< #7$)+$6
=!"'	"2
;y*55rW   c                   [        U=(       d    0 5      n[        U5      US'   [        U5      US'   U(       a  [        U5      US'   [        U5      US'   O[        U5      US'   [        U5      US'   U R                  SU5      $ )a  
Add an :class:`~ezdxf.entities.Arc` entity. The arc goes from
`start_angle` to `end_angle` in counter-clockwise direction by default,
set parameter `is_counter_clockwise` to ``False`` for clockwise
orientation.

Args:
    center: center of arc as 2D/3D point in :ref:`WCS`
    radius: arc radius
    start_angle: start angle in degrees
    end_angle: end angle in degrees
    is_counter_clockwise: ``False`` for clockwise orientation
    dxfattribs: additional DXF attributes

rx   ry   start_angle	end_angleARCr{   )rS   rx   ry   r   r   is_counter_clockwiserd   s          rT   add_arcCreatorInterface.add_arc   s    0 **+
#F|
8$V}
8(-k(:J}%&+I&6J{#(-i(8J}%&+K&8J{#uj11rW   c                &    U R                  SX5      $ )a2  Add a :class:`~ezdxf.entities.Solid` entity, `points` is an iterable
of 3 or 4 points.

.. hint::

        The last two vertices are in reversed order: a square has the
        vertex order 0-1-3-2

Args:
    points: iterable of 3 or 4 2D/3D points in :ref:`WCS`
    dxfattribs: additional DXF attributes

SOLID_add_quadrilateralrS   pointsrd   s      rT   	add_solidCreatorInterface.add_solid        &&wCCrW   c                &    U R                  SX5      $ )a2  Add a :class:`~ezdxf.entities.Trace` entity, `points` is an iterable
of 3 or 4 points.

.. hint::

        The last two vertices are in reversed order: a square has the
        vertex order 0-1-3-2

Args:
    points: iterable of 3 or 4 2D/3D points in :ref:`WCS`
    dxfattribs: additional DXF attributes

TRACEr   r   s      rT   	add_traceCreatorInterface.add_trace   r   rW   c                &    U R                  SX5      $ )aV  
Add a :class:`~ezdxf.entities.3DFace` entity, `points` is an iterable
3 or 4 2D/3D points.

.. hint::

        In contrast to SOLID and TRACE, the last two vertices are in
        regular order: a square has the vertex order 0-1-2-3

Args:
    points: iterable of 3 or 4 2D/3D points in :ref:`WCS`
    dxfattribs: additional DXF attributes

3DFACEr   r   s      rT   
add_3dfaceCreatorInterface.add_3dface	  s     &&xDDrW   )heightrotationrd   c                   [        U=(       d    0 5      n[        U5      US'   Ub  [        U5      US'   Ub  [        U5      US'   UR                  S[	        5       5        U R                  SU5      $ )z
Add a :class:`~ezdxf.entities.Text` entity, see also
:class:`~ezdxf.entities.Textstyle`.

Args:
    text: content string
    height: text height in drawing units
    rotation: text rotation in degrees
    dxfattribs: additional DXF attributes

textr   r   insertTEXT)rn   strr|   
setdefaultr   rf   )rS   r   r   r   rd   s        rT   add_textCreatorInterface.add_text  sl    & **+
 Y
6#(=Jx %*8_Jz"h/vz22rW   c                    [        U[        5      (       d  [        S5      e[        U=(       d    0 5      nXS'   [	        U5      US'   U R                  SU5      $ )a  
Add an :class:`~ezdxf.entities.Insert` entity.

When inserting a block reference into the modelspace or another block
layout with different units, the scaling factor between these units
should be applied as scaling attributes (:attr:`xscale`, ...) e.g.
modelspace in meters and block in centimeters, :attr:`xscale` has to
be 0.01.

Args:
    name: block name as str
    insert: insert location as 2D/3D point in :ref:`WCS`
    dxfattribs: additional DXF attributes

Block name as string required.namer   INSERT)
isinstancer   r
   rn   r   rf   )rS   r   r   rd   s       rT   add_blockrefCreatorInterface.add_blockref6  sS      $$$ @AA**+
!6#F|
8x44rW   c                z  ^^^^	 [        U[        5      (       d  [        S5      eSU4S jjm	SUUU	4S jjn[        U=(       d    0 5      nU R                  R
                  R                  5       nUR                  US5      mU R                  R
                  U   mU" 5         U R                  UR                  X$5      $ )a;  
Add an :class:`~ezdxf.entities.Insert` entity. This method adds for each
:class:`~ezdxf.entities.Attdef` entity, defined in the block definition,
automatically an :class:`Attrib` entity to the block reference and set
(tag, value) DXF attributes of the ATTRIB entities by the (key, value)
pairs (both as strings) of the `values` dict.

The Attrib entities are placed relative to the insert point, which is
equal to the block base point.

This method wraps the INSERT and all the ATTRIB entities into an
anonymous block, which produces the best visual results, especially for
non-uniform scaled block references, because the transformation and
scaling is done by the CAD application. But this makes evaluation of
block references with attributes more complicated, if you prefer INSERT
and ATTRIB entities without a wrapper block use the
:meth:`add_blockref_with_attribs` method.

Args:
    name: block name
    insert: insert location as 2D/3D point in :ref:`WCS`
    values: :class:`~ezdxf.entities.Attrib` tag values as (tag, value) pairs
    dxfattribs: additional DXF attributes

r   c                t   > U R                  S5      nTR                  US5      nU R                  S5      nXU4$ )Ntag r   )popget)rd   r   r   rk   valuess       rT   unpack2CreatorInterface.add_auto_blockref.<locals>.unpackq  s:    ..'C::c2&D!~~h/Hh&&rW   c                    > TR                  5        H1  n U R                  SS1S9nT" U5      u  p#nTR                  X#XA5        M3     g )Nprompthandle)drop)attdefsrd   
add_attrib)attdefrd   r   r   rk   blockdefblockrefr   s        rT   autofill4CreatorInterface.add_auto_blockref.<locals>.autofillw  sM    "**,#..Xx4H.I
&,Z&8#8##CxD -rW   r   r   )returnztuple[str, str, UVec])r   None)	r   r   r
   rn   rR   blocksnew_anonymous_blockr   r   )
rS   r   r   r   rd   r   	autoblockr   r   r   s
      `   @@@rT   add_auto_blockref"CreatorInterface.add_auto_blockrefN  s    @ $$$ @AA	'	E 	E **+
HHOO779	))$788??4(
  DDrW   c                   [        U=(       d    0 5      n[        U5      US'   [        U5      US'   [        U5      US'   Ub  [        U5      US'   Ub  [        U5      US'   U R	                  SU5      $ )a  
Add an :class:`~ezdxf.entities.AttDef` as stand alone DXF entity.

Set position and alignment by the idiom::

    layout.add_attdef("NAME").set_placement(
        (2, 3), align=TextEntityAlignment.MIDDLE_CENTER
    )

Args:
    tag: tag name as string
    insert: insert location as 2D/3D point in :ref:`WCS`
    text: tag value as string
    height: text height in drawing units
    rotation: text rotation in degrees
    dxfattribs: additional DXF attributes

r   r   r   r   r   ATTDEFrn   r   r   r|   rf   )rS   r   r   r   r   r   rd   s          rT   
add_attdefCreatorInterface.add_attdef  sv    8 **+
H
5#F|
8 Y
6#(=Jx %*8_Jz"x44rW   Fcloserd   c                  [        U=(       d    0 5      nSU;   a  [        R                  " S[        5        UR	                  SU5      nU R                  SU5      nUR                  U5        Ub  UR                  XS9  OUR                  U5        U R                  (       a%  UR                  U R                  R                  5        U$ )a  
Add a 2D :class:`~ezdxf.entities.Polyline` entity.

Args:
    points: iterable of 2D points in :ref:`WCS`
    close: ``True`` for a closed polyline
    format: user defined point format like :meth:`add_lwpolyline`,
        default is ``None``
    dxfattribs: additional DXF attributes

closedCdxfattribs key "closed" is deprecated, use keyword argument "close"POLYLINEformat)rn   warningswarnDeprecationWarningr   rf   r   append_formatted_verticesappend_verticesrR   add_sub_entities_to_entitydbentitydb)rS   r   r   r   rd   polylines         rT   add_polyline2dCreatorInterface.add_polyline2d  s    & **+
z!MM/" x/!__ZDu..v.E$$V,8811$((2C2CDrW   c                   [        U=(       d    0 5      nUR                  SS5      [        R                  -  US'   U R	                  XUS9$ )zAdd a 3D :class:`~ezdxf.entities.Polyline` entity.

Args:
    points: iterable of 3D points in :ref:`WCS`
    close: ``True`` for a closed polyline
    dxfattribs: additional DXF attributes

flagsr   r   )rn   r   r	   POLYLINE_3D_POLYLINEr   )rS   r   r   rd   s       rT   add_polyline3dCreatorInterface.add_polyline3d  sN     **+
NN7A&)C)CC 	7 ""6:"NNrW   c                   [        U=(       d    0 5      nUR                  SS5      [        R                  -  US'   [	        US   S5      n[	        US   S5      nX2S'   XBS'   UR                  SS5      nUR                  S	S5      nU R                  S
U5      nS/X4-  -  nUR                  U5        UR                  XV5        U R                  (       a%  UR                  U R                  R                  5        U$ )a%  
Add a :class:`~ezdxf.entities.Polymesh` entity, which is a wrapper class
for the POLYLINE entity. A polymesh is a grid of `mcount` x `ncount`
vertices and every vertex has its own (x, y, z)-coordinates.

Args:
    size: 2-tuple (`mcount`, `ncount`)
    dxfattribs: additional DXF attributes

r   r      r   m_countn_countm_closeFn_closer   r   r   r   )rn   r   r	   POLYLINE_3D_POLYMESHmaxr   rf   r   r   rR   r   r   )	rS   sizerd   m_sizen_sizer   r   polymeshr   s	            rT   add_polymeshCreatorInterface.add_polymesh  s     **+
NN7A&)C)CC 	7 T!WaT!Wa &9 &9..E2..E2!__ZD0  (w(8811$((2C2CDrW   c                t   [        U=(       d    0 5      nUR                  SS5      [        R                  -  US'   UR	                  SS5      nUR	                  SS5      nU R                  SU5      nUR                  X#5        U R                  (       a%  UR                  U R                  R                  5        U$ )zAdd a :class:`~ezdxf.entities.Polyface` entity, which is a wrapper
class for the POLYLINE entity.

Args:
    dxfattribs: additional DXF attributes for
        :class:`~ezdxf.entities.Polyline` entity

r   r   r   Fr   r   )
rn   r   r	   POLYLINE_POLYFACEr   rf   r   rR   r   r   )rS   rd   r   r   polyfaces        rT   add_polyfaceCreatorInterface.add_polyface  s     **+
NN7A&)@)@@ 	7 ..E2..E2!__ZDw(8811$((2C2CDrW   c                    [        U=(       d    0 5      nU R                  X5      n[        U R                  U5      5       H  u  pV[	        U5      XE'   M     U$ rP   )rn   rf   	enumerate_four_pointsr   )rS   rc   r   rd   re   xpoints          rT   r   #CreatorInterface._add_quadrilateral  sM     **+
3!$"3"3F";<HAUFI =rW   c              #     #    [        U 5      n[        U5      S;  a  [        S5      eU H  nUv   M	     [        U5      S:X  a  US   v   g g 7f)N)      z3 or 4 points required.r  )listlenr
   )r   verticesvertexs      rT   r  CreatorInterface._four_points&  sP     <x=& 9::FL x=A2, s   AAc                    [        U=(       d    0 5      n[        U5      US'   [        U5      US'   [        U5      US'   U R	                  SU5      $ )z
Add a :class:`~ezdxf.entities.Shape` reference to an external stored shape.

Args:
    name: shape name as string
    insert: insert location as 2D/3D point in :ref:`WCS`
    size: size factor
    dxfattribs: additional DXF attributes

r   r   r   SHAPEr   )rS   r   r   r   rd   s        rT   	add_shapeCreatorInterface.add_shape0  sN    " **+
 Y
6#F|
8"4[
6w
33rW   c                   U R                   [        :  a  [        S5      e[        U=(       d    0 5      nSU;   a  [        R
                  " S[        5        UR                  SU5      nU R                  SU5      nUR                  XS9  X5l
        U$ )aa  
Add a 2D polyline as :class:`~ezdxf.entities.LWPolyline` entity.
A points are defined as (x, y, [start_width, [end_width, [bulge]]])
tuples, but order can be redefined by the `format` argument. Set
`start_width`, `end_width` to 0 to be ignored like
(x, y, 0, 0, bulge).

The :class:`~ezdxf.entities.LWPolyline` is defined as a single DXF
entity and needs less disk space than a
:class:`~ezdxf.entities.Polyline` entity. (requires DXF R2000)

Format codes:

    - ``x`` = x-coordinate
    - ``y`` = y-coordinate
    - ``s`` = start width
    - ``e`` = end width
    - ``b`` = bulge value
    - ``v`` = (x, y [,z]) tuple (z-axis is ignored)

Args:
    points: iterable of (x, y, [start_width, [end_width, [bulge]]]) tuples
    format: user defined point format, default is "xyseb"
    close: ``True`` for a closed polyline
    dxfattribs: additional DXF attributes

zLWPOLYLINE requires DXF R2000r   r   
LWPOLYLINEr   )rY   r   r   rn   r   r   r   r   rf   
set_pointsr   )rS   r   r   r   rd   
lwpolylines         rT   add_lwpolylineCreatorInterface.add_lwpolylineI  s    F ??W$!"ABB**+
z!MM/"
 x/!%z!J
f4!rW   c                    U R                   [        :  a  [        S5      e[        U=(       d    0 5      nU R	                  SU5      n[        U5      Ul        U$ )z
Add a multiline text entity with automatic text wrapping at boundaries
as :class:`~ezdxf.entities.MText` entity.
(requires DXF R2000)

Args:
    text: content string
    dxfattribs: additional DXF attributes

MTEXT requires DXF R2000MTEXT)rY   r   r   rn   rf   r   r   )rS   r   rd   mtexts       rT   	add_mtextCreatorInterface.add_mtext{  sK     ??W$!"<==**+
w
;Y
rW   c                r   U R                   nU[        :  a  [        S5      e[        U=(       d    0 5      n[	        U5      nU[
        R                  :  a  [        XX4U5      nO[        XX4U5      nU R                  (       a%  U R                  R                  R                  U5        U R                  U5        U$ )a  Add a multiline text entity with static columns as
:class:`~ezdxf.entities.MText` entity. The content is spread
across the columns, the count of content strings determine the count
of columns.

This factory method adds automatically a column break ``"\N"`` at the
end of each column text to force a new column.
The `height` attribute should be big enough to reserve enough space for
the tallest column. Too small values produce valid DXF files, but the
visual result will not be as expected. The `height` attribute also
defines the total height of the MTEXT entity.

(requires DXF R2000)

Args:
    content: iterable of column content
    width: column width
    gutter_width: distance between columns
    height: max. column height
    dxfattribs: additional DXF attributes

r  )rY   r   r   rn   r  r	   DXF2018make_static_columns_r2000make_static_columns_r2018rR   r   addrb   )rS   contentwidthgutter_widthr   rd   rY   r  s           rT   add_mtext_static_columns)CreatorInterface.add_mtext_static_columns  s    < __
!"<==**+
w-%-jE .jE 88HH!!%(rW   c                \   U R                   nU[        :  a  [        S5      e[        U=(       d    0 5      nU[        R
                  :  a  [        XX4XV5      nO[        XX4XV5      nU R                  (       a%  U R                  R                  R                  U5        U R                  U5        U$ )aB  Add a multiline text entity with as many columns as needed for the
given common fixed `height`. The content is spread across the columns
automatically by the CAD application. The `height` argument also defines
the total height of the MTEXT entity. To get the correct column `count`
requires an **exact** MTEXT rendering like AutoCAD, which is
not done by `ezdxf`, therefore passing the expected column `count`
is required to calculate the correct total width.

This current implementation works best for DXF R2018, because the
content is stored as a continuous text in a single MTEXT entity. For
DXF versions prior to R2018 the content should be distributed across
multiple MTEXT entities (one entity per column), which is not done by
`ezdxf`, but the result is correct for advanced DXF viewers and CAD
application, which do the MTEXT content distribution completely by
itself.

Because of the current limitations the use of this method is not
recommend. This situation may improve in future releases, but the exact
rendering of the content will also slow down the processing speed
dramatically.

(requires DXF R2000)

Args:
    content: column content as a single string
    width: column width
    gutter_width: distance between columns
    height: max. column height
    count: expected column count
    dxfattribs: additional DXF attributes

r  )rY   r   r   rn   r	   r!  &make_dynamic_auto_height_columns_r2000&make_dynamic_auto_height_columns_r2018rR   r   r$  rb   )	rS   r%  r&  r'  r   countrd   rY   r  s	            rT   %add_mtext_dynamic_auto_height_columns6CreatorInterface.add_mtext_dynamic_auto_height_columns  s    R __
!"<==**+
%:eE ;eE 88HH!!%(rW   c                \   U R                   nU[        :  a  [        S5      e[        U=(       d    0 5      nU[        R
                  :  a  [        XX4U5      nO[        XX4U5      nU R                  (       a%  U R                  R                  R                  U5        U R                  U5        U$ )a  Add a multiline text entity with dynamic columns as
:class:`~ezdxf.entities.MText` entity. The content is spread
across the columns automatically by the CAD application.
The `heights` sequence determine the height of the columns, except for
the last column, which always takes the remaining content. The height
value for the last column is required but can be 0, because the value
is ignored. The count of `heights` also determines the count of columns,
and :code:`max(heights)` defines the total height of the MTEXT entity,
which may be wrong if the last column requires more space.

This current implementation works best for DXF R2018, because the
content is stored as a continuous text in a single MTEXT entity. For
DXF versions prior to R2018 the content should be distributed across
multiple MTEXT entities (one entity per column), which is not done by
`ezdxf`, but the result is correct for advanced DXF viewers and CAD
application, which do the MTEXT content distribution completely by
itself.

(requires DXF R2000)

Args:
    content: column content as a single string
    width: column width
    gutter_width: distance between columns
    heights: column height for each column
    dxfattribs: additional DXF attributes

r  )rY   r   r   rn   r	   r!  (make_dynamic_manual_height_columns_r2000(make_dynamic_manual_height_columns_r2018rR   r   r$  rb   )rS   r%  r&  r'  heightsrd   rY   r  s           rT   'add_mtext_dynamic_manual_height_columns8CreatorInterface.add_mtext_dynamic_manual_height_columns  s    j __
!"<==**+
%<zE =zE 88HH!!%(rW   c                    U R                   [        :  a  [        S5      e[        U=(       d    0 5      n[	        U5      US'   [	        U5      R                  5       US'   U R                  SU5      $ )a  
Add a :class:`~ezdxf.entities.Ray` that begins at `start` point and
continues to infinity (construction line). (requires DXF R2000)

Args:
    start: location 3D point in :ref:`WCS`
    unit_vector: 3D vector (x, y, z)
    dxfattribs: additional DXF attributes

zRAY requires DXF R2000rr   unit_vectorRAYrY   r   r   rn   r   	normalizerf   rS   rr   r7  rd   s       rT   add_rayCreatorInterface.add_ray=  sb     ??W$!":;;**+
"5k
7$($5$?$?$A
=!uj11rW   c                    U R                   [        :  a  [        S5      e[        U=(       d    0 5      n[	        U5      US'   [	        U5      R                  5       US'   U R                  SU5      $ )zAdd an infinity :class:`~ezdxf.entities.XLine` (construction line).
(requires DXF R2000)

Args:
    start: location 3D point in :ref:`WCS`
    unit_vector: 3D vector (x, y, z)
    dxfattribs: additional DXF attributes

zXLINE requires DXF R2000rr   r7  XLINEr9  r;  s       rT   	add_xlineCreatorInterface.add_xlineO  sb     ??W$!"<==**+
"5k
7$($5$?$?$A
=!w
33rW   c                    U R                   [        :  a  [        S5      e[        U=(       d    0 5      n[	        U5      US'   U R                  SU5      nUb  [        R                  " U5      Ul        U$ )a  Add a B-spline (:class:`~ezdxf.entities.Spline` entity) defined by
the given `fit_points` - the control points and knot values are created
by the CAD application, therefore it is not predictable how the rendered
spline will look like, because for every set of fit points exists an
infinite set of B-splines.

If `fit_points` is ``None``, an "empty" spline will be created, all data
has to be set by the user.

The SPLINE entity requires DXF R2000.

AutoCAD creates a spline through fit points by a global curve
interpolation and an unknown method to estimate the direction of the
start- and end tangent.

.. seealso::

    - :ref:`tut_spline`
    - :func:`ezdxf.math.fit_points_to_cad_cv`

Args:
    fit_points: iterable of fit points as ``(x, y[, z])`` in :ref:`WCS`,
        creates an empty :class:`~ezdxf.entities.Spline` if ``None``
    degree: degree of B-spline, max. degree supported by AutoCAD is 11
    dxfattribs: additional DXF attributes

zSPLINE requires DXF R2000degreeSPLINE)	rY   r   r   rn   intrf   r   generate
fit_points)rS   rG  rC  rd   splines        rT   
add_splineCreatorInterface.add_splineb  sf    B ??W$!"=>>**+
"6{
8:>! $j 9FrW   c                ~    [        XUS9nU R                  UR                  UR                  UR	                  5       US9$ )a  Add a :class:`~ezdxf.entities.Spline` entity passing through the
given `fit_points`, the control points are calculated by a global curve
interpolation without start- and end tangent constrains.
The new SPLINE entity is defined by control points and not by the fit
points, therefore the SPLINE looks always the same, no matter which CAD
application renders the SPLINE.

- "uniform": creates a uniform t vector, from 0 to 1 evenly spaced, see
  `uniform`_ method
- "distance", "chord": creates a t vector with values proportional to
  the fit point distances, see `chord length`_ method
- "centripetal", "sqrt_chord": creates a t vector with values
  proportional to the fit point sqrt(distances), see `centripetal`_
  method
- "arc": creates a t vector with values proportional to the arc length
  between fit points.

Use function :meth:`add_cad_spline_control_frame` to create
SPLINE entities from fit points similar to CAD application including
start- and end tangent constraints.

Args:
    fit_points: iterable of fit points as (x, y[, z]) in :ref:`WCS`
    degree: degree of B-spline, max. degree supported by AutoCAD is 11
    method: calculation method for parameter vector t
    dxfattribs: additional DXF attributes

)rC  method)control_pointsrC  knotsrd   )r   add_open_splinerM  rC  rN  )rS   rG  rC  rL  rd   bsplines         rT   add_spline_control_frame)CreatorInterface.add_spline_control_frame  sJ    F /f
 ##"11>>--/!	 $ 
 	
rW   c                X    [        XS9nU R                  US9nUR                  U5        U$ )aH  Add a :class:`~ezdxf.entities.Spline` entity passing through the
given fit points.  This method creates the same control points as CAD 
applications.

Args:
    fit_points: iterable of fit points as (x, y[, z]) in :ref:`WCS`
    tangents: start- and end tangent, default is autodetect
    dxfattribs: additional DXF attributes

)tangentsrd   )r   rI  apply_construction_tool)rS   rG  rT  rd   srH  s         rT   add_cad_spline_control_frame-CreatorInterface.add_cad_spline_control_frame  s1      !?J7&&q)rW   c                l    U R                  US9nUR                  [        U5      U5        Ub  X5l        U$ )a  
Add an open uniform :class:`~ezdxf.entities.Spline` defined by
`control_points`. (requires DXF R2000)

Open uniform B-splines start and end at your first and last control point.

Args:
    control_points: iterable of 3D points in :ref:`WCS`
    degree: degree of B-spline, max. degree supported by AutoCAD is 11
    knots: knot values as iterable of floats
    dxfattribs: additional DXF attributes

rU  )rI  set_open_uniformr  rN  )rS   rM  rC  rN  rd   rH  s         rT   rO   CreatorInterface.add_open_spline  s9    ( J7^ 4f= LrW   c                l    U R                  US9nUR                  [        U5      X#5        Ub  XFl        U$ )a  
Add an open rational uniform :class:`~ezdxf.entities.Spline` defined by
`control_points`. (requires DXF R2000)

`weights` has to be an iterable of floats, which defines the influence
of the associated control point to the shape of the B-spline, therefore
for each control point is one weight value required.

Open rational uniform B-splines start and end at the first and last
control point.

Args:
    control_points: iterable of 3D points in :ref:`WCS`
    weights: weight values as iterable of floats
    degree: degree of B-spline, max. degree supported by AutoCAD is 11
    knots: knot values as iterable of floats
    dxfattribs: additional DXF attributes

rU  )rI  set_open_rationalr  rN  )rS   rM  weightsrC  rN  rd   rH  s          rT   add_rational_spline$CreatorInterface.add_rational_spline  s9    6 J7  n!5wG LrW   c                &    U R                  SU5      $ )zAdd a :class:`~ezdxf.entities.Body` entity.
(requires DXF R2000 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

BODY_add_acis_entityrS   rd   s     rT   add_bodyCreatorInterface.add_body	  s     $$VZ88rW   c                &    U R                  SU5      $ )zAdd a :class:`~ezdxf.entities.Region` entity.
(requires DXF R2000 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

REGIONrd  rf  s     rT   
add_regionCreatorInterface.add_region  s     $$Xz::rW   c                &    U R                  SU5      $ )zAdd a 3DSOLID entity (:class:`~ezdxf.entities.Solid3d`).
(requires DXF R2000 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

3DSOLIDrd  rf  s     rT   add_3dsolidCreatorInterface.add_3dsolid  s     $$Y
;;rW   c                x    U R                   [        R                  :  a  [        S5      eU R	                  SU5      $ )zAdd a :class:`~ezdxf.entities.Surface` entity.
(requires DXF R2007 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

z#SURFACE requires DXF R2007 or laterSURFACErY   r	   DXF2007r   re  rf  s     rT   add_surfaceCreatorInterface.add_surface$  s3     ??U]]*!"GHH$$Y
;;rW   c                x    U R                   [        R                  :  a  [        S5      eU R	                  SU5      $ )zAdd a :class:`~ezdxf.entities.ExtrudedSurface` entity.
(requires DXF R2007 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

z+EXTRUDEDSURFACE requires DXF R2007 or laterEXTRUDEDSURFACErs  rf  s     rT   add_extruded_surface%CreatorInterface.add_extruded_surface/  s4     ??U]]*!"OPP$$%6
CCrW   c                x    U R                   [        R                  :  a  [        S5      eU R	                  SU5      $ )zAdd a :class:`~ezdxf.entities.LoftedSurface` entity.
(requires DXF R2007 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

z)LOFTEDSURFACE requires DXF R2007 or laterLOFTEDSURFACErs  rf  s     rT   add_lofted_surface#CreatorInterface.add_lofted_surface:  s3     ??U]]*!"MNN$$_jAArW   c                x    U R                   [        R                  :  a  [        S5      eU R	                  SU5      $ )z
Add a :class:`~ezdxf.entities.RevolvedSurface` entity.
(requires DXF R2007 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

z+REVOLVEDSURFACE requires DXF R2007 or laterREVOLVEDSURFACErs  rf  s     rT   add_revolved_surface%CreatorInterface.add_revolved_surfaceE  s4     ??U]]*!"OPP$$%6
CCrW   c                x    U R                   [        R                  :  a  [        S5      eU R	                  SU5      $ )z
Add a :class:`~ezdxf.entities.SweptSurface` entity.
(requires DXF R2007 or later)

The ACIS data has to be set as :term:`SAT` or :term:`SAB`.

z(SWEPTSURFACE requires DXF R2007 or laterSWEPTSURFACErs  rf  s     rT   add_swept_surface"CreatorInterface.add_swept_surfaceQ  s3     ??U]]*!"LMM$$^Z@@rW   c                $   U R                   [        R                  :  a  [        U S35      e[	        U=(       d    0 5      nU R                   [
        :  a,  UR                  SS5        UR                  S[        5       5        U R                  X5      $ )Nz requires DXF R2000 or laterr   r   uid)	rY   r	   r   r   rn   r   r   r!   rf   )rS   r   rd   s      rT   re  !CreatorInterface._add_acis_entity]  sq    ??U]]*!TF*F"GHH**+
??g%!!'1-!!%0t00rW   c                    U R                   [        :  a  [        S5      e[        U=(       d    0 5      nSUS'   [	        U5      US'   SUS'   U R                  SU5      $ )zAdd a :class:`~ezdxf.entities.Hatch` entity. (requires DXF R2000)

Args:
    color: fill color as :ref`ACI`, default is 7 (black/white).
    dxfattribs: additional DXF attributes

zHATCH requires DXF R2000r   
solid_fillcolorr   pattern_nameHATCH)rY   r   r   rn   rE  rf   )rS   r  rd   s      rT   	add_hatchCreatorInterface.add_hatchf  s^     ??W$!"<==**+
#$
< !%j
7%,
>"w
33rW   c                    U R                   [        :  a  [        S5      e[        U=(       d    0 5      nUc  SUS'   O	SUS'   X#S'   SUS'   [        R
                  US'   [        U5      US	'   U R                  S
U5      $ )a  Add a :class:`~ezdxf.entities.MPolygon` entity. (requires DXF R2000)

The MPOLYGON entity is not a core DXF entity and is not supported by
every CAD application or DXF library.

DXF version R2004+ is required to use a fill color different from
BYLAYER. For R2000 the fill color is always BYLAYER, set any ACI value
to create a filled MPOLYGON entity.

Args:
    color: boundary color as :ref:`ACI`, default is BYLAYER.
    fill_color: fill color as :ref:`ACI`, default is ``None``
    dxfattribs: additional DXF attributes

zMPOLYGON requires DXF R2000r   r  r   
fill_colorr   r  pattern_typer  MPOLYGON)rY   r   r   rn   r	   HATCH_TYPE_PREDEFINEDrE  rf   )rS   r  r  rd   s       rT   add_mpolygonCreatorInterface.add_mpolygonv  s    * ??W$!"?@@**+
'(J|$'(J|$'1|$%,
>"%*%@%@
>"!%j
7z:66rW   c                    U R                   [        :  a  [        S5      e[        U=(       d    0 5      nU R	                  SU5      $ )zt
Add a :class:`~ezdxf.entities.Mesh` entity. (requires DXF R2007)

Args:
    dxfattribs: additional DXF attributes

zMESH requires DXF R2000MESH)rY   r   r   rn   rf   rf  s     rT   add_meshCreatorInterface.add_mesh  s<     ??W$!";<<**+
vz22rW           c                   U R                   [        :  a  [        S5      e[        U=(       d    0 5      nUR                  R
                  R                  u  pgUu  pX-  n
X-  n[        R                  " U5      nU[        R                  S-  -   n[        U5      US'   [        R                  " X5      US'   [        R                  " X5      US'   XS'   U R                  SU5      $ )a  
Add an :class:`~ezdxf.entities.Image` entity, requires a
:class:`~ezdxf.entities.ImageDef` entity, see :ref:`tut_image`.
(requires DXF R2000)

Args:
    image_def: required image definition as :class:`~ezdxf.entities.ImageDef`
    insert: insertion point as 3D point in :ref:`WCS`
    size_in_units: size as (x, y) tuple in drawing units
    rotation: rotation angle around the extrusion axis, default is the
        z-axis, in degrees
    dxfattribs: additional DXF attributes

zIMAGE requires DXF R2000       @r   u_pixelv_pixel	image_defIMAGE)rY   r   r   rn   dxf
image_sizevec2mathradianspir   
from_anglerf   )rS   r  r   size_in_unitsr   rd   x_pixelsy_pixelsx_unitsy_unitsx_units_per_pixely_units_per_pixelx_angle_rady_angle_rads                 rT   	add_imageCreatorInterface.add_image  s    , ??W$!"<==**+
&]]55::(#.#.ll8,!TWWs]3#F|
8 $ O
9 $ O
9"+;w
33rW   c                    [        U=(       d    0 5      nU R                  SUS9nUR                  U5        U R                  nU(       a  SUR                  ;  a  UR                  SS9  U$ )zAdd a :class:`ezdxf.entities.Wipeout` entity, the masking area is
defined by WCS `vertices`.

This method creates only a 2D entity in the xy-plane of the layout,
the z-axis of the input vertices are ignored.

WIPEOUTrU  ACAD_WIPEOUT_VARSr   )frame)rn   rf   set_masking_arearR   rootdictset_wipeout_variables)rS   r  rd   wipeoutrR   s        rT   add_wipeoutCreatorInterface.add_wipeout  sa     **+
??9?L  *hh's||;%%A%.rW   c                <   U R                   [        :  a  [        S5      e[        U=(       d    0 5      n[	        U5      US'   UR
                  R                  US'   [        U5      US'   U R                  UR                  U5      nX6l
        UR                  U5        U$ )a=  
Add an :class:`~ezdxf.entities.Underlay` entity, requires a
:class:`~ezdxf.entities.UnderlayDefinition` entity,
see :ref:`tut_underlay`.  (requires DXF R2000)

Args:
    underlay_def: required underlay definition as :class:`~ezdxf.entities.UnderlayDefinition`
    insert: insertion point as 3D point in :ref:`WCS`
    scale:  underlay scaling factor as (x, y, z) tuple or as single
        value for uniform scaling for x, y and z
    rotation: rotation angle around the extrusion axis, default is the
        z-axis, in degrees
    dxfattribs: additional DXF attributes

zUNDERLAY requires DXF R2000r   underlay_def_handler   )rY   r   r   rn   r   r  r   r|   rf   entity_namescalingset_underlay_def)rS   underlay_defr   scaler   rd   underlays          rT   add_underlayCreatorInterface.add_underlay  s    . ??W$!"?@@**+
#F|
8,8,<,<,C,C
()!&x
:!__$$j
 !!!,/rW   c                    U R                   (       a,  U R                   R                  R                  U5      (       a  U$ [        R	                  SU S35        g)NzReplacing undefined DIMSTYLE "z" by "Standard" DIMSTYLE.Standard)rR   	dimstyles	has_entryloggerdebug)rS   r   s     rT   _safe_dimstyleCreatorInterface._safe_dimstyle  sF    88**44T::K,TF2KL	
 rW   <>EZDXFc                   S[         R                  [         R                  -  0nU R                  SUS9n[	        U
=(       d    0 5      n
U R                  U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S	'   Ub  [        U5      U
S
'   UR                  U
5        [        XS9nUb  UR                  USSS9  U$ )a  
Add horizontal, vertical and rotated :class:`~ezdxf.entities.Dimension`
line. If an :class:`~ezdxf.math.UCS` is used for dimension line rendering,
all point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default.
See also: :ref:`tut_linear_dimension`

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object -
to create the necessary dimension geometry, you have to call
:meth:`~ezdxf.entities.DimStyleOverride.render` manually, this two-step
process allows additional processing steps on the
:class:`~ezdxf.entities.Dimension` entity between creation and rendering.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    base: location of dimension line, any point on the dimension line or
        its extension will do (in UCS)
    p1: measurement point 1 and start point of extension line 1 (in UCS)
    p2: measurement point 2 and start point of extension line 2 (in UCS)
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text, everything
        else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZDXF"
    angle: angle from ucs/wcs x-axis to dimension line in degrees
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

dimtype	DIMENSIONrU  dimstyledefpointr   	defpoint2	defpoint3angletext_rotationoverrideF)leaderrelative)r	   
DIM_LINEARDIM_BLOCK_EXCLUSIVErf   rn   r  r   r   r|   update_dxf_attribsr   set_location)rS   basep1p2rk   r   r  r  r  r  rd   rc   dimlinestyles                 rT   add_linear_dimCreatorInterface.add_linear_dim	  s    j E,,u/H/HHI!__[U_K**+
!%!4!4X!>
:!%d
: Y
6"&r(
;"&r(
;#El
7 $*/*>J'"":. <xFrW   c
                d    [        U=(       d    0 5      n[        [        SU 5      UUUUUUUUU	S9
  g)a   
Add multiple linear dimensions for iterable `points`. If an
:class:`~ezdxf.math.UCS` is used for dimension line rendering, all point
definitions in UCS coordinates, translation into :ref:`WCS` and
:ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default. See also:
:ref:`tut_linear_dimension`

This method sets many design decisions by itself, the necessary geometry
will be generated automatically, no required nor possible
:meth:`~ezdxf.entities.DimStyleOverride.render` call.
This method is easy to use, but you get what you get.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    base: location of dimension line, any point on the dimension line
        or its extension will do (in UCS)
    points: iterable of measurement points (in UCS)
    angle: angle from ucs/wcs x-axis to dimension line in degrees
        (0 = horizontal, 90 = vertical)
    ucs: user defined coordinate system
    avoid_double_rendering: suppresses the first extension line and the
        first arrow if possible for continued dimension entities
    dimstyle: dimension style name (DimStyle table entry),
        default is "EZDXF"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity
    discard: discard rendering result for friendly CAD applications like
        BricsCAD to get a native and likely better rendering result.
        (does not work with AutoCAD)

r$   )	r  r   r  ucsavoid_double_renderingr  r  rd   discardN)rn   r    r   )
rS   r  r   r  r  r  r  r  rd   r  s
             rT   add_multi_point_linear_dim+CreatorInterface.add_multi_point_linear_dimT  sB    ` **+
$$d+#9!	
rW   c                    [        U5      n[        U5      n	X-
  n
U
R                  nU
R                  5       R                  U5      U-   nU R	                  UUU	UUUUUS9$ )a  
Add linear dimension aligned with measurement points `p1` and `p2`. If
an :class:`~ezdxf.math.UCS` is used for dimension line rendering, all
point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector
is defined by UCS or (0, 0, 1) by default.
See also: :ref:`tut_linear_dimension`

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object,
to create the necessary dimension geometry, you have to call
:meth:`DimStyleOverride.render` manually, this two-step process allows
additional processing steps on the  :class:`~ezdxf.entities.Dimension`
entity between creation and rendering.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    p1: measurement point 1 and start point of extension line 1 (in UCS)
    p2: measurement point 2 and start point of extension line 2 (in UCS)
    distance: distance of dimension line from measurement points
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZDXF"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs:  additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

)r  r  r  r  r   r  r  rd   )r   	angle_deg
orthogonalr:  r  )rS   r  r  distancer   r  r  rd   _p1_p2	directionr  r  s                rT   add_aligned_dim CreatorInterface.add_aligned_dim  sw    X 2h2hI	####%//9C?""! # 	
 		
rW   	EZ_CURVED)rk   r   r  r  r  rd   c                  S[         R                  [         R                  -  0n
U R                  SU
S9n[	        U	=(       d    0 5      n	U R                  U5      U	S'   [        U5      U	S'   [        US   5      U	S'   [        US   5      U	S	'   [        US   5      U	S
'   [        US   5      U	S'   [        U5      U	S'   Ub  [        U5      U	S'   UR                  U	5        [        XS9nUb  UR                  U5        U$ )a  
Add angular :class:`~ezdxf.entities.Dimension` from two lines. The
measurement is always done from `line1` to `line2` in counter-clockwise
orientation. This does not always match the result in CAD applications!

If an :class:`~ezdxf.math.UCS` is used for angular dimension rendering,
all point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default.

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object -
to create the necessary dimension geometry, you have to call
:meth:`~ezdxf.entities.DimStyleOverride.render` manually, this two-step
process allows additional processing steps on the
:class:`~ezdxf.entities.Dimension` entity between creation and rendering.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    base: location of dimension line, any point on the dimension line or
        its extension is valid (in UCS)
    line1: specifies start leg of the angle (start point, end point) and
        determines extension line 1 (in UCS)
    line2: specifies end leg of the angle (start point, end point) and
        determines extension line 2 (in UCS)
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_CURVED"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs:  additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  r  rU  r  r   r   r  r   r  	defpoint4r  	defpoint5r  r  )r	   DIM_ANGULARr  rf   rn   r  r   r   r|   r  r   user_location_override)rS   r  line1line2rk   r   r  r  r  rd   rc   r  r  s                rT   add_angular_dim_2l#CreatorInterface.add_angular_dim_2l  s   n E--0I0IIJ!__[U_K**+
!%!4!4X!>
: Y
6"&uQx.
;"&uQx.
;"&uQx.
;!%eAh
:"&t*
; $*/*>J'"":. <((2rW   c                  S[         R                  [         R                  -  0n[        SU R	                  SUS95      n[        U
=(       d    0 5      n
U R                  U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S	'   [        U5      U
S
'   Ub  [        U5      U
S'   UR                  U
5        [        XS9nUb  UR                  U5        U$ )a  
Add angular :class:`~ezdxf.entities.Dimension` from three points
(center, p1, p2). The measurement is always done from `p1` to `p2` in
counter-clockwise orientation. This does not always match the result in
CAD applications!

If an :class:`~ezdxf.math.UCS` is used for angular dimension rendering,
all point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default.

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object -
to create the necessary dimension geometry, you have to call
:meth:`~ezdxf.entities.DimStyleOverride.render` manually, this two-step
process allows additional processing steps on the
:class:`~ezdxf.entities.Dimension` entity between creation and rendering.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    base: location of dimension line, any point on the dimension line
        or its extension is valid (in UCS)
    center: specifies the vertex of the angle
    p1: specifies start leg of the angle (center -> p1) and end-point
        of extension line 1 (in UCS)
    p2: specifies end leg of the  angle (center -> p2) and end-point
        of extension line 2 (in UCS)
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_CURVED"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  r'   r  rU  r  r   r  r  r  r  r  r  )r	   DIM_ANGULAR_3Pr  r   rf   rn   r  r   r   r|   r  r   r  rS   r  rx   r  r  rk   r   r  r  r  rd   rc   r  r  s                 rT   add_angular_dim_3p#CreatorInterface.add_angular_dim_3p  s    t E0053L3LLMG
 **+
!%!4!4X!>
: Y
6!%d
:"&r(
;"&r(
;"&v,
; $*/*>J'"":. <((2rW   c               n   [        U5      n[        U5      n[        U5      n[        U5      n[        U5      nU[        X5      S-  -   nU[        R                  " U5      X-   -  -   nU[        R                  " U5      U-  -   nU[        R                  " U5      U-  -   nU R	                  UUUUUUUU	U
US9
$ )a  
Shortcut method to create an angular dimension by (c)enter point,
(r)adius and start- and end (a)ngles, the measurement text is placed at
the default location defined by the associated `dimstyle`.
The measurement is always done from `start_angle` to `end_angle` in
counter-clockwise orientation. This does not always match the result in
CAD applications!
For further information see the more generic factory method
:func:`add_angular_dim_3p`.

Args:
    center: center point of the angle (in UCS)
    radius: the distance from `center` to the start of the extension
        lines in drawing units
    start_angle: start angle in degrees (in UCS)
    end_angle: end angle in degrees (in UCS)
    distance: distance from start of the extension lines to the
        dimension line in drawing units
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_CURVED"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  
r  rx   r  r  rk   r   r  r  r  rd   )r|   r   r   from_deg_angler  rS   rx   ry   r   r   r  rk   r   r  r  r  rd   saeaext_line_startdim_line_offsetcenter_center_angler  r  r  s                        rT   add_angular_dim_cra$CreatorInterface.add_angular_dim_cram  s    ^ ;9v/v,.r6<< ,,\:,
 
 t**2.??t**2.??&&'! ' 
 	
rW   c                   U R                  UR                  UR                  UR                  UR                  UUUUUUUS9$ )ai  
Shortcut method to create an angular dimension from a
:class:`~ezdxf.math.ConstructionArc`. This construction tool can
be created from ARC entities and the tool itself provides various
construction class methods.
The measurement text is placed at the default location defined by the
associated `dimstyle`.
The measurement is always done from `start_angle` to `end_angle` of the
arc in counter-clockwise orientation.
This does not always match the result in CAD applications!
For further information see the more generic factory method
:func:`add_angular_dim_3p`.

Args:
    arc: :class:`~ezdxf.math.ConstructionArc`
    distance: distance from start of the extension lines to the
        dimension line in drawing units
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_CURVED"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs:  additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

rx   ry   r   r   r  rk   r   r  r  r  rd   )r  rx   ry   r   r   	rS   arcr  rk   r   r  r  r  rd   s	            rT   add_angular_dim_arc$CreatorInterface.add_angular_dim_arc  sN    V ''::::mm'! ( 
 	
rW   c                  S[         R                  [         R                  -  0nU R                  SUS9n[	        U
=(       d    0 5      n
U R                  U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S'   [        U5      U
S	'   S
U
S'   S
U
S'   SU
S'   SU
S'   [        U
S'   [        U
S'   Ub  [        U5      U
S'   UR                  U
5        [        XS9nUb  UR                  U5        U$ )a4  
Add :class:`~ezdxf.entities.ArcDimension` from three points
(center, p1, p2). Point `p1` defines the radius and the start-angle of
the arc, point `p2` only defines the end-angle of the arc.

If an :class:`~ezdxf.math.UCS` is used for arc dimension rendering,
all point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default.

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object -
to create the necessary dimension geometry, you have to call
:meth:`~ezdxf.entities.DimStyleOverride.render` manually, this two-step
process allows additional processing steps on the
:class:`~ezdxf.entities.ArcDimension` entity between creation and
rendering.

.. note::

    `Ezdxf` does not render the arc dimension like CAD applications and
    does not consider all DIMSTYLE variables, so the rendering results
    are **very** different from CAD applications.

Args:
    base: location of dimension line, any point on the dimension line
        or its extension is valid (in UCS)
    center: specifies the vertex of the angle
    p1: specifies the radius (center -> p1) and the star angle of the
        arc, this is also the start point for the 1st extension line (in UCS)
    p2: specifies the end angle of the arc. The start 2nd extension line
        is defined by this angle and the radius defined by p1 (in UCS)
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_CURVED"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  ARC_DIMENSIONrU  r  r   r  r  r  r  r  r   r   r   
is_partial
has_leaderleader_point1leader_point2r  r  )r	   DIM_ARCr  rf   rn   r  r   r   r   r|   r  r   r  r  s                 rT   add_arc_dim_3pCreatorInterface.add_arc_dim_3p  s&   z EMME,E,EEF $ !0 !
 **+
!%!4!4X!>
: Y
6!%d
:"&r(
;"&r(
;"&v,
;$'
=!"%
;#$
< #$
< &-
?#&-
?# $*/*>J'"":. <((2rW   c               n   [        U5      n[        U5      n[        U5      n[        U5      n[        U5      nU[        X5      S-  -   nU[        R                  " U5      X-   -  -   nU[        R                  " U5      U-  -   nU[        R                  " U5      U-  -   nU R	                  UUUUUUUU	U
US9
$ )a  
Shortcut method to create an arc dimension by (c)enter point,
(r)adius and start- and end (a)ngles, the measurement text is placed at
the default location defined by the associated `dimstyle`.

.. note::

    `Ezdxf` does not render the arc dimension like CAD applications and
    does not consider all DIMSTYLE variables, so the rendering results
    are **very** different from CAD applications.

Args:
    center: center point of the angle (in UCS)
    radius: the distance from `center` to the start of the extension
        lines in drawing units
    start_angle: start-angle in degrees (in UCS)
    end_angle: end-angle in degrees (in UCS)
    distance: distance from start of the extension lines to the
        dimension line in drawing units
    location: user defined location for text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_CURVED"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  r
  )r|   r   r   r  r"  r  s                        rT   add_arc_dim_cra CreatorInterface.add_arc_dim_craJ  s    ` ;9v/v,.r6<< ,,\:,
 
 t**2.??t**2.??""'! # 
 	
rW   c                   U R                  UR                  UR                  UR                  UR                  UUUUUUUS9$ )a0  
Shortcut method to create an arc dimension from a
:class:`~ezdxf.math.ConstructionArc`. This construction tool can
be created from ARC entities and the tool itself provides various
construction class methods.
The measurement text is placed at the default location defined by the
associated `dimstyle`.

.. note::

    `Ezdxf` does not render the arc dimension like CAD applications and
    does not consider all DIMSTYLE variables, so the rendering results
    are **very** different from CAD applications.

Args:
    arc: :class:`~ezdxf.math.ConstructionArc`
    distance: distance from start of the extension lines to the
        dimension line in drawing units
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    text_rotation: rotation angle of the dimension text as absolute
        angle (x-axis=0, y-axis=90) in degrees
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_CURVED"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  )r%  rx   ry   r   r   r  s	            rT   add_arc_dim_arc CreatorInterface.add_arc_dim_arc  sN    X ##::::mm'! $ 
 	
rW   	EZ_RADIUS)rk   r   r  r  rd   c                  S[         R                  [         R                  -  0n
[        SU R	                  SU
S95      n[        U5      nUb+  Uc  [        S5      e[        U5      nX-
  R                  US9nODUc3  Uc  [        S5      eUc  [        S5      e[
        R                  " XC5      nO[        U5      U-
  nX-   nX-
  n[        U	=(       d    0 5      n	U R                  U5      U	S	'   [        U5      U	S
'   [        U5      U	S'   [        U5      U	S'   UR                  U	5        [        XS9nUb  UR                  U5        U$ )a  
Add a diameter :class:`~ezdxf.entities.Dimension` line. The diameter
dimension line requires a `center` point and a point `mpoint` on the
circle or as an alternative a `radius` and a dimension line `angle` in
degrees.

If an :class:`~ezdxf.math.UCS` is used for dimension line rendering,
all point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default.

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object -
to create the necessary dimension geometry, you have to call
:meth:`~ezdxf.entities.DimStyleOverride.render` manually, this two-step
process allows additional processing steps on the :class:`~ezdxf.entities.Dimension`
entity between creation and rendering.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    center: specifies the center of the circle (in UCS)
    mpoint: specifies the measurement point on the circle (in UCS)
    radius: specify radius, requires argument `angle`, overrides `p1` argument
    angle: specify angle of dimension line in degrees, requires argument
        `radius`, overrides `p1` argument
    location: user defined location for the text midpoint (in UCS)
    text: ``None`` or ``"<>"`` the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_RADIUS"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  r'   r  rU  Argument radius is required.length"Argument angle or mpoint required.#Argument radius or mpoint required.r  r  r  r   r  )r	   DIM_DIAMETERr  r   rf   r   
ValueErrorr:  r  rn   r  r   r  r   r  )rS   rx   mpointry   r  rk   r   r  r  rd   rc   r  
radius_vecr  r  r  s                   rT   add_diameter_dim!CreatorInterface.add_diameter_dim  sS   j E..1J1JJKG
 f~ !?@@H~H !+66f6EJ~=$%IJJ>$%JKK!00?
!&\F2
  **+
!%!4!4X!>
:!%b
:"&r(
; Y
6"":. <((2rW   c           	     b    [        U5      nUR                  U5      nU R                  UUUUUUS9$ )a  
Shortcut method to create a diameter dimension by two points on the
circle and the measurement text at the default location defined by the
associated `dimstyle`, for further information see general method
:func:`add_diameter_dim`. Center point of the virtual circle is the
midpoint between `p1` and `p2`.

- dimstyle "EZ_RADIUS": places the dimension text outside
- dimstyle "EZ_RADIUS_INSIDE": places the dimension text inside

Args:
    p1: first point of the circle (in UCS)
    p2: second point on the opposite side of the center point of the
        circle (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_RADIUS"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r   r  r  rd   )r   lerpr5  )	rS   r  r  r   r  r  rd   r3  rx   s	            rT   add_diameter_dim_2p$CreatorInterface.add_diameter_dim_2p*  sE    D bR$$! % 
 	
rW   c               j   S[         R                  [         R                  -  0n
[        SU R	                  SU
S95      n[        U5      nUb/  Uc  [        S5      e[        U5      nXQ-
  R                  US9nX-   nO8Uc5  Uc  [        S5      eUc  [        S5      eU[
        R                  " XC5      -   n[        U	=(       d    0 5      n	U R                  U5      U	S	'   [        U5      U	S
'   [        U5      U	S'   [        U5      U	S'   UR                  U	5        [        XS9nUb  UR                  U5        U$ )a  
Add a radius :class:`~ezdxf.entities.Dimension` line. The radius
dimension line requires a `center` point and a point `mpoint` on the
circle or as an alternative a `radius` and a dimension line `angle` in
degrees. See also: :ref:`tut_radius_dimension`

If a :class:`~ezdxf.math.UCS` is used for dimension line rendering,
all point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default.

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object -
to create the necessary dimension geometry, you have to call
:meth:`~ezdxf.entities.DimStyleOverride.render` manually, this two-step
process allows additional processing steps on the
:class:`~ezdxf.entities.Dimension` entity between creation and rendering.

Following render types are supported:

- Default text location outside: text aligned with dimension line;
  dimension style: "EZ_RADIUS"
- Default text location outside horizontal: "EZ_RADIUS" + dimtoh=1
- Default text location inside: text aligned with dimension line;
  dimension style: "EZ_RADIUS_INSIDE"
- Default text location inside horizontal: "EZ_RADIUS_INSIDE" + dimtih=1
- User defined text location: argument `location` != ``None``, text
  aligned with dimension line; dimension style: "EZ_RADIUS"
- User defined text location horizontal: argument `location` != ``None``,
  "EZ_RADIUS" + dimtoh=1 for text outside horizontal, "EZ_RADIUS"
  + dimtih=1 for text inside horizontal

Placing the dimension text at a user defined `location`, overrides the
`mpoint` and the `angle` argument, but requires a given `radius`
argument. The `location` argument does not define the exact text
location, instead it defines the dimension line starting at `center`
and the measurement text midpoint projected on this dimension line
going through `location`, if text is aligned to the dimension line.
If text is horizontal, `location` is the kink point of the dimension
line from radial to horizontal direction.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    center: center point of the circle (in UCS)
    mpoint: measurement point on the circle, overrides `angle` and
        `radius` (in UCS)
    radius: radius in drawing units, requires argument `angle`
    angle: specify angle of dimension line in degrees, requires
        argument `radius`
    location: user defined dimension text location, overrides `mpoint`
        and `angle`, but requires `radius` (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_RADIUS"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r  r'   r  rU  r,  r-  r/  r0  r  r  r  r   r  )r	   
DIM_RADIUSr  r   rf   r   r2  r:  r  rn   r  r   r  r   r  )rS   rx   r3  ry   r  rk   r   r  r  rd   rc   r  r4  r  s                 rT   add_radius_dimCreatorInterface.add_radius_dimW  s@   \ E,,u/H/HHIG
 f~ !?@@H~H"+66f6EJ(F~=$%IJJ>$%JKK$"5"5e"DD**+
!%!4!4X!>
:"&v,
;!%f
: Y
6"":. <((2rW   r8  c          	     *    U R                  UUUUUUS9$ )a  
Shortcut method to create a radius dimension by center point,
measurement point on the circle and the measurement text at the default
location defined by the associated `dimstyle`, for further information
see general method :func:`add_radius_dim`.

- dimstyle "EZ_RADIUS": places the dimension text outside
- dimstyle "EZ_RADIUS_INSIDE": places the dimension text inside

Args:
    center: center point of the circle (in UCS)
    mpoint: measurement point on the circle (in UCS)
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_RADIUS"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

r8  r>  )rS   rx   r3  r   r  r  rd   s          rT   add_radius_dim_2p"CreatorInterface.add_radius_dim_2p  s/    B ""! # 
 	
rW   c          
     ,    U R                  UUUUUUUS9$ )a  
Shortcut method to create a radius dimension by (c)enter point,
(r)adius and (a)ngle, the measurement text is placed at the default
location defined by the associated `dimstyle`, for further information
see general method :func:`add_radius_dim`.

- dimstyle "EZ_RADIUS": places the dimension text outside
- dimstyle "EZ_RADIUS_INSIDE": places the dimension text inside

Args:
    center: center point of the circle (in UCS)
    radius: radius in drawing units
    angle: angle of dimension line in degrees
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZ_RADIUS"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

)ry   r  r   r  r  rd   rA  )rS   rx   ry   r  r   r  r  rd   s           rT   add_radius_dim_cra#CreatorInterface.add_radius_dim_cra  s2    F ""! # 
 	
rW   )originr   r   r  r  rd   c               \   [        U5      nUS;  a  [        S5      eS[        R                  [        R                  -  [        R
                  U-  -  0n
[        SU R                  SU
S95      n[        U5      n[        U5      nU[        U5      -   n[        U	=(       d    0 5      n	U R                  U5      U	S'   XS'   [        U5      nU(       a  U* U	S	'   X-
  nXR                  U5      -   U	S
'   UR                  U5      U	S'   [        U5      U	S'   UR                  U	5        [        XS9nU$ )a  
Add an ordinate type :class:`~ezdxf.entities.Dimension` line. The
feature location is defined in the global coordinate system, which is
set as render UCS, which is the :ref:`WCS` by default.

If an :class:`~ezdxf.math.UCS` is used for dimension line rendering,
all point definitions in UCS coordinates, translation into :ref:`WCS`
and :ref:`OCS` is done by the rendering function. Extrusion vector is
defined by UCS or (0, 0, 1) by default.

This method returns a :class:`~ezdxf.entities.DimStyleOverride` object -
to create the necessary dimension geometry, you have to call
:meth:`~ezdxf.entities.DimStyleOverride.render` manually, this two-step
process allows additional processing steps on the
:class:`~ezdxf.entities.Dimension` entity between creation and rendering.

.. note::

    `Ezdxf` does not consider all DIMSTYLE variables, so the
    rendering results are different from CAD applications.

Args:
    feature_location: feature location in the global coordinate system (UCS)
    offset: offset vector of leader end point from the feature location
        in the local coordinate system
    dtype: 1 = x-type, 0 = y-type
    origin: specifies the origin (0, 0) of the local coordinate
        system in UCS
    rotation: rotation angle of the local coordinate system in degrees
    text: ``None`` or "<>" the measurement is drawn as text,
        " " (a single space) suppresses the dimension text,
        everything else `text` is drawn as dimension text
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZDXF"
    override: :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes for the DIMENSION entity

Returns: :class:`~ezdxf.entities.DimStyleOverride`

)r   r   zinvalid dtype (0, 1)r  r'   r  rU  r  r  horizontal_directionr  r  r   r  )rE  r
   r	   DIM_ORDINATEr  DIM_ORDINATE_TYPEr   rf   r   rn   r  r|   
rotate_degr   r  r   )rS   feature_locationoffsetdtyperG  r   r   r  r  rd   rc   r  origin_feature_location_
end_point_relative_feature_locationr  s                    rT   add_ordinate_dim!CreatorInterface.add_ordinate_dim	  sL   j E
 677 u))''(&&.0
 G
 v, !12&f5
**+
!%!4!4X!>
:!(:? 3;J-.$5$?! ::8DD 		
 #-"7"7"A
; Y
6"":. <rW   c               0    U R                  UUSUUUUUUS9	$ )zjShortcut to add an x-type feature ordinate DIMENSION, for more
information see :meth:`add_ordinate_dim`.

r   	rM  rN  rO  rG  r   r   r  r  rd   rT  	rS   rM  rN  rG  r   r   r  r  rd   s	            rT   add_ordinate_x_dim#CreatorInterface.add_ordinate_x_dimv	  7      $$-! % 

 
	
rW   c               0    U R                  UUSUUUUUUS9	$ )ziShortcut to add a y-type feature ordinate DIMENSION, for more
information see :meth:`add_ordinate_dim`.

r   rW  rX  rY  s	            rT   add_ordinate_y_dim#CreatorInterface.add_ordinate_y_dim	  r\  rW   c           	     H    [         R                  " U UUUUUS9R                  $ N)r   r   r   r   rd   )r   render_arrowvec3rS   r   r   r   r   rd   s         rT   	add_arrowCreatorInterface.add_arrow	  0     ""!
 $	rW   c           	     H    [         R                  " U UUUUUS9R                  $ ra  )r   insert_arrowrc  rd  s         rT   add_arrow_blockref#CreatorInterface.add_arrow_blockref	  rg  rW   c                   SS jnU R                   [        :  a  [        S5      e[        U=(       d    0 5      nU R	                  U5      US'   UR                  SS5        [        SU R                  SU5      5      nUR                  U5        U(       aN  U" U5      nSU;   a  U R                  R                  US   5        [        [        S	U5      US
9R                  5         U$ )a  
The :class:`~ezdxf.entities.Leader` entity represents an arrow, made up
of one or more vertices (or spline fit points) and an arrowhead.
The label or other content to which the :class:`~ezdxf.entities.Leader`
is attached is stored as a separate entity, and is not part of the
:class:`~ezdxf.entities.Leader` itself. (requires DXF R2000)

:class:`~ezdxf.entities.Leader` shares its styling infrastructure with
:class:`~ezdxf.entities.Dimension`.

By default a :class:`~ezdxf.entities.Leader` without any annotation is
created. For creating more fancy leaders and annotations see
documentation provided by Autodesk or `Demystifying DXF: LEADER and MULTILEADER
implementation notes <https://atlight.github.io/formats/dxf-leader.html>`_  .


Args:
    vertices: leader vertices (in :ref:`WCS`)
    dimstyle: dimension style name (:class:`~ezdxf.entities.DimStyle`
        table entry), default is "EZDXF"
    override: override :class:`~ezdxf.entities.DimStyleOverride` attributes
    dxfattribs: additional DXF attributes

c                p    U R                  5        VVs0 s H  u  pU[        ;  d  M  X_M     snn$ s  snnf rP   )items#LEADER_UNSUPPORTED_DIMSTYLE_ATTRIBS)attribskvs      rT   &filter_unsupported_dimstyle_attributesKCreatorInterface.add_leader.<locals>.filter_unsupported_dimstyle_attributes	  s>     $MMO+DA?? +  s   22zLEADER requires DXF R2000r  annotation_typer  r2   LEADER	dimldrblkr'   r  )rp  rn   r   rn   )rY   r   r   rn   r  r   r   rf   set_verticesrR   acquire_arrowr   commit)rS   r  r  r  rd   rs  r  s          rT   
add_leaderCreatorInterface.add_leader	  s    @	 ??W$!"=>>**+
!%!4!4X!>
:/3h* EFH%=hGHh&&&x'<=[&)HfhrW   c                @    SSK Jn  U R                  X5      nU" U5      $ )zqAdd a :class:`~ezdxf.entities.MultiLeader` entity but returns
a :class:`~ezdxf.render.MultiLeaderMTextBuilder`.

r   )rJ   )ezdxf.render.mleaderrJ   _make_multileader)rS   r  rd   rJ   multileaders        rT   add_multileader_mtext&CreatorInterface.add_multileader_mtext	
  #     	A,,U?&{33rW   c                @    SSK Jn  U R                  X5      nU" U5      $ )zqAdd a :class:`~ezdxf.entities.MultiLeader` entity but returns
a :class:`~ezdxf.render.MultiLeaderBlockBuilder`.

r   )rK   )r~  rK   r  )rS   r  rd   rK   r  s        rT   add_multileader_block&CreatorInterface.add_multileader_block
  r  rW   c                (   U R                   [        :  a  [        S5      e[        U=(       d    0 5      nU R                  R
                  R                  U5      nUc  [        SU S35      eUR                  R                  US'   U R                  SUS9$ )NzMULTILEADER requires DXF R2000zMLEADERSTYLE 'z' does not existstyle_handleMULTILEADERrU  )rY   r   r   rn   rR   mleader_stylesr   r
   r  r   rf   )rS   r  rd   mleader_styles       rT   r  "CreatorInterface._make_multileader%
  s    
 ??W$!"BCC**+
//33E: .7G HII%2%6%6%=%=
>"}DDrW   c               >   U R                   [        :  a  [        S5      e[        U=(       d    0 5      nUR	                  SS5      nU R                  SU5      nUR                  UR                  U5        UR                  U5        U(       a  UR                  U5        U$ )zAdd a :class:`~ezdxf.entities.MLine` entity

Args:
    vertices: MLINE vertices (in :ref:`WCS`)
    close: ``True`` to add a closed MLINE
    dxfattribs: additional DXF attributes

zMLine requires DXF R2000
style_namer  MLINE)
rY   r   r   rn   r   rf   set_flag_stateCLOSED	set_styleextend)rS   r  r   rd   r  mlines         rT   	add_mlineCreatorInterface.add_mline3
  s     ??W$!"<==**+
^^L*=
w
;U\\51
#LL"rW   c                   SSK Jn  U R                  [        :  a  [	        S5      e[        U=(       d    0 5      nU R                  SU5      n[        SSS5      nXR                  l	        [        U5      UR                  l        XSS4-   UR                  l        [        SSUS:  a  SOS5      UR                  l        X7R                  l        X'R                  l        [!        U5      UR                  l        SUR                  l        UR'                  XX45      n	[)        UR+                  U	5      5      n
U
(       a  UR-                  U
S   5        U$ )a  
Add a :class:`~ezdxf.entities.Helix` entity.

The center of the helix is always (0, 0, 0) and the helix axis direction
is the +z-axis.

Transform the new HELIX by the :meth:`~ezdxf.entities.DXFGraphic.transform`
method to your needs.

Args:
    radius: helix radius
    pitch: the height of one complete helix turn
    turns: count of turns
    ccw: creates a counter-clockwise turning (right-handed) helix if ``True``
    dxfattribs: additional DXF attributes

r   )pathzHelix requires DXF R2000HELIXr   r
  )r"   r  rY   r   r   rn   rf   r   r  axis_base_pointr|   ry   start_pointaxis_vectorturnsturn_heightrE  
handedness	constrainhelixr  to_bsplines_and_verticesrV  )rS   ry   pitchr  ccwrd   r  r  r  pspliness              rT   	add_helixCreatorInterface.add_helixN
  s   2 	??W$!"<==**+
w
;Aq!}$(		! =		 $1~ 5		 $Q	1r B				 %		"3x				JJve1t44Q78))'!*5rW   rQ   )rR   r#   )r   r   )rc   r   rd   rn   r   r)   )re   r)   r   r   rP   )rk   r   r   r   )rr   r   rs   r   r   r   )rx   r   ry   r|   r   r   )rx   r   r   r   r   r|   r   r|   r   r|   r   r*   )TN)rx   r   ry   r|   r   r|   r   r|   r   boolr   r%   )r   Iterable[UVec]r   r?   )r   r  r   rC   )r   r  r   r,   )r   r   r   Optional[float]r   r  r   rB   )r   r   r   r   r   r0   )r   r   r   r   r   zdict[str, str]r   r0   )r   r   )r   r   r   r   r   r   r   r  r   r  r   r&   )r   r  r   zOptional[str]r   r  r   r9   )r   r  r   r  r   r9   ))r  r  N)r   ztuple[int, int]r   r:   )r   r8   )rc   r   r   r  r   r)   )r   r  r   r  )r   r   N)r   r   r   r   r   r|   r   r>   )xyseb)r   r  r   r   r   r  r   r1   )r   r   r   r5   )
r%  zIterable[str]r&  r|   r'  r|   r   r|   r   r5   )r%  r   r&  r|   r'  r|   r   r|   r-  rE  r   r5   )
r%  r   r&  r|   r'  r|   r3  Sequence[float]r   r5   )rr   r   r7  r   r   r;   )rr   r   r7  r   r   rG   )Nr  N)rG  Optional[Iterable[UVec]]rC  rE  r   r   )r  chordN)rG  r  rC  rE  rL  r   r   r   )NN)rG  r  rT  r  r   r   )r  NN)rM  r  rC  rE  rN  Optional[Iterable[float]]r   r   )
rM  r  r_  r  rC  rE  rN  r  r   r   )r   r   )r   r<   )r   r@   )r   r   )r   r+   )r   r3   )r   r=   )r   rA   )   N)r  rE  r   r-   )r  rE  r  zOptional[int]r   r6   )r   r7   )r  N)
r  r/   r   r   r  ztuple[float, float]r   r|   r   r.   )r  r  r   rF   )r   )r   r   r   r  N)r  rE   r   r   r   r|   r   rD   )r   r   r   r   )Nr  r   Nr  NN)r  r   r  r   r  r   rk   Optional[UVec]r   r   r  r|   r  r  r  r   r  Optional[dict]r   r   )r   NTr  NNF)r  r   r   r  r  r|   r  zOptional[UCS]r  r  r  r   r  r  r   r   )r  r  NN)r  r   r  r   r  r|   r   r   r  r   r  r  r   r   )r  r   r   tuple[UVec, UVec]r  r  rk   r  r   r   r  r  r  r   r  r  r   r   )r  r   rx   r   r  r   r  r   rk   r  r   r   r  r  r  r   r  r  r   r   )rx   r   ry   r|   r   r|   r   r|   r  r|   rk   r  r   r   r  r  r  r   r  r  r   r   )r  r   r  r|   rk   r  r   r   r  r  r  r   r  r  r   r   )NNN)rx   r   r3  r  ry   r  r  r  rk   r  r   r   r  r   r  r  r   r   )r  r*  NN)r  r   r  r   r   r   r  r   r  r  r   r   )rx   r   r3  r   r   r   r  r   r  r  r   r   )rx   r   ry   r|   r  r|   r   r   r  r   r  r  r   r   )rM  r   rN  r   rO  rE  rG  r   r   r|   r   r   r  r   r  r  r   r   )rM  r   rN  r   rG  r   r   r|   r   r   r  r   r  r  r   r   )r   r   N)
r   r   r   r   r   r|   r   r|   r   r   )r  NN)r  r  r  r   r  r  r   r2   )r  N)r  r   r   rJ   )r  r   r   rK   )r  r   r   rH   )r  r  r   r  r   r4   )ry   r|   r  r|   r  r|   r   rI   )Z__name__
__module____qualname____firstlineno__rU   propertyrY   r^   rf   rb   ro   ru   r}   r  taur   r   r   r   r   r   r   r   r   r   r   r   r   r   staticmethodr  r  r  r  r(  r.  r4  r<  r@  rI  rQ  rX  rO  r`  rg  rk  ro  ru  ry  r}  r  r  re  r  r	   BYLAYERr  r  r  r  r  r  r  r  r  r  r  r  r  r"  r%  r(  r5  r:  r>  rB  rE  r   rT  rZ  r^  re  rj  r{  r  r  r  r  r  __static_attributes__r]   rW   rT   rM   rM   S   s    # #  43  7;55$)5	5* %88'6'6 '6 	'6
 '6 '6 
'6^ &*!2!2 !2 	!2
 !2 #!2 
!2FD D E* #'$(33  	3
 "3 
385: 5E5E 5E 	5E 
5Et 	$5 #'$($5$5 $5 	$5  $5 "$5 
$5R !%$
 $$ $
 $ 
$T OO 	O 
O, :>#	B. >B"0	   44 4 	4 
48 0
 00 0
 0 
0d0 .. . 	.
 . 
.n 88 8 	8
 8 8 
8@ DD D 	D
 !D 
DL2& :>44(,4	4* 04	(,( (
 
(Z +
"+
 +
 	+
 
+
` .2	" +
 
0 +/&  )	 
< +/& ! 	
 ) 
B9;<	<	D	B
D
A14$ ]]$(	!7!7 "!7
 
!7F3$ $4$4 $4 +	$4
 $4 
$4L& !#(# #
 # 
#J $()-#'II I 	I
 !I I I 'I I !I 
I^ !'+#'<
<
 <
 	<

 <
 !%<
 <
 !<
 
<
F #':
:
 :
 	:

 :
 :
 !:
 
:
D $()-##'LL !L !	L !L L 'L L !L 
Lj $()-##'OO O 	O
 O !O O 'O O !O 
Or $()-##'H
H
 H
 	H

 H
 H
 !H
 H
 'H
 H
 !H
 
H
^ $()-##'7
7
 7

 !7
 7
 '7
 7
 !7
 
7
@ $()-##'XX X 	X
 X !X X 'X X !X 
XD $()-##'I
I
 I
 	I

 I
 I
 !I
 I
 'I
 I
 !I
 
I
` $()-##'8
8
 8

 !8
 8
 '8
 8
 !8
 
8
z "&"&!%Y $(##'YY Y  	Y
 Y !Y Y Y !Y 
Y~ ##'+
+
 +
 	+

 +
 !+
 
+
` "&"&!%m $(##'mm m  	m
 m !m m m !m 
mh ##'(
(
 (

 (
 (
 !(
 
(
` ##'+
+
 +
 	+
 +
 +
 !+
 
+
f #'WW W 	W W W W W !W 
W| #'

 

 
 
 
 
 !
 

B #'

 

 
 
 
 
 !
 

@   	
  
*   	
  
(  #'7 7 7 !	7 
7v  44 
!	4   44 
!	4" EE 
	E  .2 * 	 
@ ,, , 	, 
, ,rW   rM   >   dimblkdimblk1dimblk2)\
__future__r   typingr   r   r   r   r   r  loggingr   ezdxf.lldxfr	   ezdxf.lldxf.constr
   r   r   r   
ezdxf.mathr   r   r   r   r   r   r   r   ezdxf.render.arrowsr   ezdxf.entitiesr   r   r   r   r   r   r   ezdxf.entities.mtext_columnsezdxf.entities.dimstyleoverrider   ezdxf.render.dim_linearr    ezdxf.toolsr!   	getLoggerr  ezdxf.documentr#   ezdxf.eztypesr$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   r~  rJ   rK   rM   ro  r]   rW   rT   <module>r     s    #      N N	 	 	 ' N N N * < @ 			7	#&/& & & & & & & & & &Ng( g(TQ 'G #rW   