
    Og                      d dl mZ d dlmZmZmZmZmZ d dlZd dl	Z	d dl
Z
d dlmZ d dlmZmZmZmZ d dlmZmZmZmZmZmZmZmZ d dlmZ d dlmZmZm Z m!Z!m"Z"m#Z#m$Z$ d d	l% d d
l&m'Z' d dl(m)Z) d dl*m+Z+  e	jX                  d      Z-erbd dl.m/Z/ d dl0m1Z1 d dlm2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZV d dlWmXZXmYZY  G d d      ZZh dZ[y)    )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                     e Zd Zd_dZed`d       Zed        ZdadZdbdZdcdddZ	dcdedZ
	 dc	 	 	 	 	 dfd	Zd
ddej                  df	 	 	 	 	 	 	 	 	 	 	 dgdZ	 	 dh	 	 	 	 	 	 	 	 	 	 	 didZdcdjdZdcdkdZdcdldZdddd	 	 	 	 	 	 	 dmdZdcdndZ	 dc	 	 	 	 	 	 	 dodZ	 	 dpdddd	 	 	 	 	 	 	 	 	 	 	 dqdZ	 dcddd	 	 	 	 	 	 	 drdZddd	 	 	 	 	 dsdZ	 dt	 	 	 dudZdcdvdZ	 dc	 	 	 	 	 dwdZedxd       Z	 	 	 dy	 	 	 	 	 	 	 dzdZ	 d{ddd	 	 	 	 	 	 	 d|d Zdcd}d!Z 	 dc	 	 	 	 	 	 	 	 	 d~d"Z!	 dc	 	 	 	 	 	 	 	 	 	 	 dd#Z"	 dc	 	 	 	 	 	 	 	 	 dd$Z#dcdd%Z$	 dc	 	 	 	 	 dd&Z%	 	 	 d	 	 	 	 	 dd'Z&	 	 	 d	 	 	 	 	 	 	 dd(Z'	 	 d	 	 	 	 	 dd)Z(	 	 	 d	 	 	 	 	 	 	 dd*Z)	 	 	 d	 	 	 	 	 	 	 	 	 dd+Z*dcdd,Z+dcdd-Z,dcdd.Z-dcdd/Z.dcdd0Z/dcdd1Z0dcdd2Z1dcdd3Z2dd4Z3ddd5Z4e5jl                  ddf	 	 	 	 	 dd6Z7dcdd7Z8	 	 d	 	 	 	 	 	 	 	 	 dd9Z9dcdd:Z:	 	 	 	 d	 	 	 	 	 	 	 dd;Z;dd<Z<	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd?Z=	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd@Z>	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 ddAZ?dd=ddBdddC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddDZ@dd=ddBdddC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddEZAdd=ddBdddC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddFZBdd=ddBdddC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddGZCdd=ddBdddC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddHZDdd=ddBdddC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddIZEdd=ddBdddC	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddJZF	 	 	 ddd=dKdddL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddMZG	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddNZH	 	 	 ddd=dKdddL	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddOZId=dKdddP	 	 	 	 	 	 	 	 	 	 	 ddQZJd=dKdddP	 	 	 	 	 	 	 	 	 	 	 	 	 ddRZKeLd8d=d>dddS	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddTZMeLd8d=d>dddS	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddUZNeLd8d=d>dddS	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddVZO	 	 	 d	 	 	 	 	 	 	 	 	 ddWZP	 	 	 d	 	 	 	 	 	 	 	 	 ddXZQ	 	 	 d	 	 	 	 	 	 	 ddYZR	 	 d	 	 	 ddZZS	 	 d	 	 	 dd[ZT	 dc	 	 	 dd\ZU	 dcddd	 	 	 	 	 dd]ZV	 	 dh	 	 	 	 	 	 	 dd^ZWy)CreatorInterfacec                    || _         y N)doc)selfrP   s     Z/var/www/html/public_html/myphp/venv/lib/python3.12/site-packages/ezdxf/graphicsfactory.py__init__zCreatorInterface.__init__T   s	        c                .    | j                   j                  S rO   )rP   
dxfversionrQ   s    rR   rV   zCreatorInterface.dxfversionW   s    xx"""rT   c                     y)NF rW   s    rR   is_active_paperspacez%CreatorInterface.is_active_paperspace[   s    rT   c                j    t        j                  ||| j                        }| j                  |       |S )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_entryrP   
add_entity)rQ   type_
dxfattribsentitys       rR   
new_entityzCreatorInterface.new_entity_   s-     ((
DHHErT   c                     y rO   rY   )rQ   r`   s     rR   r]   zCreatorInterface.add_entityl   s    rT   Nc                `    t        |xs i       }t        |      |d<   | j                  d|      S )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   ra   )rQ   rd   r_   s      rR   	add_pointzCreatorInterface.add_pointo   s2     **+
!%h
:w
33rT   c                |    t        |xs i       }t        |      |d<   t        |      |d<   | j                  d|      S )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LINErf   )rQ   rj   rk   r_   s       rR   add_linezCreatorInterface.add_line|   s@     **+
"5k
7 I
5vz22rT   c                |    t        |xs i       }t        |      |d<   t        |      |d<   | j                  d|      S )a"  
        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rg   r   floatra   )rQ   ro   rp   r_   s       rR   
add_circlezCreatorInterface.add_circle   s@     **+
#F|
8$V}
8x44rT   )   r   r   ru   r   c                t   | j                   t        k  rt        d      t        |      }t	        |      dkD  rt        d      t        |      }|j                  rt        d      t        |xs i       }t        |      |d<   ||d<   ||d<   t        |      |d<   t        |      |d	<   | j                  d
|      S )u  
        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)ro   
major_axisratiostart_param	end_paramELLIPSE)
rV   r   r   rs   absr
   r   is_nullrg   ra   )rQ   ro   rx   ry   rz   r{   r_   _major_axiss           rR   add_ellipsezCreatorInterface.add_ellipse   s    2 ??W$!">??eu: :;;:& ?@@**+
#F|
8#.
< #
7$)+$6
=!"'	"2
;y*55rT   c                    t        |xs i       }t        |      |d<   t        |      |d<   |rt        |      |d<   t        |      |d<   nt        |      |d<   t        |      |d<   | j                  d|      S )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

        ro   rp   start_angle	end_angleARCrr   )rQ   ro   rp   r   r   is_counter_clockwiser_   s          rR   add_arczCreatorInterface.add_arc   s    0 **+
#F|
8$V}
8(-k(:J}%&+I&6J{#(-i(8J}%&+K&8J{#uj11rT   c                (    | j                  d||      S )ar  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rQ   pointsr_   s      rR   	add_solidzCreatorInterface.add_solid        &&w
CCrT   c                (    | j                  d||      S )ar  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      rR   	add_tracezCreatorInterface.add_trace   r   rT   c                (    | j                  d||      S )a  
        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      rR   
add_3dfacezCreatorInterface.add_3dface	  s     &&xDDrT   )heightrotationr_   c                   t        |xs i       }t        |      |d<   |t        |      |d<   |t        |      |d<   |j                  dt	                      | j                  d|      S )a5  
        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)rg   strrs   
setdefaultr   ra   )rQ   r   r   r   r_   s        rR   add_textzCreatorInterface.add_text  sl    & **+
 Y
6#(=Jx %*8_Jz"h/vz22rT   c                    t        |t              st        d      t        |xs i       }||d<   t	        |      |d<   | j                  d|      S )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
   rg   r   ra   )rQ   r   r   r_   s       rR   add_blockrefzCreatorInterface.add_blockref6  sR      $$ @AA**+
!
6#F|
8x44rT   c                `  	 t        |t              st        d      dfd	d	fd}t        |xs i       }| j                  j
                  j                         }|j                  |d      | j                  j
                  |    |        | j                  |j                  ||      S )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                v    | j                  d      }j                  |d      }| j                  d      }|||fS )Ntag r   )popget)r_   r   r   rd   valuess       rR   unpackz2CreatorInterface.add_auto_blockref.<locals>.unpackq  s<    ..'C::c2&D!~~h/Hh&&rT   c                     j                         D ]6  } | j                  ddh      } |      \  }}}j                  ||||       8 y )Nprompthandle)drop)attdefsr_   
add_attrib)attdefr_   r   r   rd   blockdefblockrefr   s        rR   autofillz4CreatorInterface.add_auto_blockref.<locals>.autofillw  sZ    "**, E#..Xx4H.I
&,Z&8#T8##CxDErT   r   r   )returnztuple[str, str, UVec])r   None)	r   r   r
   rg   rP   blocksnew_anonymous_blockr   r   )
rQ   r   r   r   r_   r   	autoblockr   r   r   s
      `   @@@rR   add_auto_blockrefz"CreatorInterface.add_auto_blockrefN  s    @ $$ @AA	'	E **+
HHOO779	))$788??4(
  DDrT   c                   t        |xs i       }t        |      |d<   t        |      |d<   t        |      |d<   |t        |      |d<   |t        |      |d<   | j	                  d|      S )a7  
        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rg   r   r   rs   ra   )rQ   r   r   r   r   r   r_   s          rR   
add_attdefzCreatorInterface.add_attdef  sv    8 **+
H
5#F|
8 Y
6#(=Jx %*8_Jz"x44rT   Fcloser_   c               z   t        |xs i       }d|v rt        j                  dt               |j	                  d|      }| j                  d|      }|j                  |       ||j                  ||       n|j                  |       | j                  r%|j                  | j                  j                         |S )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)rg   warningswarnDeprecationWarningr   ra   r   append_formatted_verticesappend_verticesrP   add_sub_entities_to_entitydbentitydb)rQ   r   r   r   r_   polylines         rR   add_polyline2dzCreatorInterface.add_polyline2d  s    & **+
z!MM/" x/!__ZDu..vf.E$$V,8811$((2C2CDrT   c                   t        |xs i       }|j                  dd      t        j                  z  |d<   | j	                  |||      S )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   )rg   r   r	   POLYLINE_3D_POLYLINEr   )rQ   r   r   r_   s       rR   add_polyline3dzCreatorInterface.add_polyline3d  sP     **+
NN7A&)C)CC 	7 ""6:"NNrT   c                   t        |xs i       }|j                  dd      t        j                  z  |d<   t	        |d   d      }t	        |d   d      }||d<   ||d<   |j                  dd      }|j                  d	d      }| j                  d
|      }dg||z  z  }|j                  |       |j                  ||       | j                  r%|j                  | j                  j                         |S )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      ru   m_countn_countm_closeFn_closer   r   r   r   )rg   r   r	   POLYLINE_3D_POLYMESHmaxr   ra   r   r   rP   r   r   )	rQ   sizer_   m_sizen_sizer   r   polymeshr   s	            rR   add_polymeshz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rT   c                b   t        |xs i       }|j                  dd      t        j                  z  |d<   |j	                  dd      }|j	                  dd      }| j                  d|      }|j                  ||       | j                  r%|j                  | j                  j                         |S )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   )
rg   r   r	   POLYLINE_POLYFACEr   ra   r   rP   r   r   )rQ   r_   r   r   polyfaces        rR   add_polyfacezCreatorInterface.add_polyface  s     **+
NN7A&)@)@@ 	7 ..E2..E2!__ZDw(8811$((2C2CDrT   c                    t        |xs i       }| j                  ||      }t        | j                  |            D ]  \  }}t	        |      ||<    |S rO   )rg   ra   	enumerate_four_pointsr   )rQ   r^   r   r_   r`   xpoints          rR   r   z#CreatorInterface._add_quadrilateral  sX     **+

3!$"3"3F";< 	$HAuUF1I	$rT   c              #     K   t        |       }t        |      dvrt        d      |D ]  }|  t        |      dk(  r|d    y y w)N)      z3 or 4 points required.r   )listlenr
   )r   verticesvertexs      rR   r   zCreatorInterface._four_points&  sV     <x=& 9:: 	FL	x=A2, s   AAc                    t        |xs i       }t        |      |d<   t        |      |d<   t        |      |d<   | j	                  d|      S )a%  
        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   )rQ   r   r   r   r_   s        rR   	add_shapezCreatorInterface.add_shape0  sN    " **+
 Y
6#F|
8"4[
6w
33rT   c                  | j                   t        k  rt        d      t        |xs i       }d|v rt	        j
                  dt               |j                  d|      }| j                  d|      }|j                  ||       ||_
        |S )a	  
        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   )rV   r   r   rg   r   r   r   r   ra   
set_pointsr   )rQ   r   r   r   r_   
lwpolylines         rR   add_lwpolylinezCreatorInterface.add_lwpolylineI  s    F ??W$!"ABB**+
z!MM/"
 x/!%z!J
fV4!
rT   c                    | j                   t        k  rt        d      t        |xs i       }| j	                  d|      }t        |      |_        |S )a
  
        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)rV   r   r   rg   ra   r   r   )rQ   r   r_   mtexts       rR   	add_mtextzCreatorInterface.add_mtext{  sK     ??W$!"<==**+
w
;Y
rT   c                b   | j                   }|t        k  rt        d      t        |xs i       }t	        |      }|t
        j                  k  rt        |||||      }nt        |||||      }| j                  r%| j                  j                  j                  |       | j                  |       |S )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   )rV   r   r   rg   r   r	   DXF2018make_static_columns_r2000make_static_columns_r2018rP   r   addr]   )rQ   contentwidthgutter_widthr   r_   rV   r   s           rR   add_mtext_static_columnsz)CreatorInterface.add_mtext_static_columns  s    < __
!"<==**+
w-%-fjE .fjE 88HH!!%(rT   c                P   | j                   }|t        k  rt        d      t        |xs i       }|t        j
                  k  rt        ||||||      }nt        ||||||      }| j                  r%| j                  j                  j                  |       | j                  |       |S )a  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   )rV   r   r   rg   r	   r  &make_dynamic_auto_height_columns_r2000&make_dynamic_auto_height_columns_r2018rP   r   r  r]   )	rQ   r  r  r	  r   countr_   rV   r   s	            rR   %add_mtext_dynamic_auto_height_columnsz6CreatorInterface.add_mtext_dynamic_auto_height_columns  s    R __
!"<==**+
%:feZE ;feZE 88HH!!%(rT   c                L   | j                   }|t        k  rt        d      t        |xs i       }|t        j
                  k  rt        |||||      }nt        |||||      }| j                  r%| j                  j                  j                  |       | j                  |       |S )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   )rV   r   r   rg   r	   r  (make_dynamic_manual_height_columns_r2000(make_dynamic_manual_height_columns_r2018rP   r   r  r]   )rQ   r  r  r	  heightsr_   rV   r   s           rR   'add_mtext_dynamic_manual_height_columnsz8CreatorInterface.add_mtext_dynamic_manual_height_columns  s    j __
!"<==**+
%<gzE =gzE 88HH!!%(rT   c                    | j                   t        k  rt        d      t        |xs i       }t	        |      |d<   t	        |      j                         |d<   | j                  d|      S )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 R2000rj   unit_vectorRAYrV   r   r   rg   r   	normalizera   rQ   rj   r  r_   s       rR   add_rayzCreatorInterface.add_ray=  sb     ??W$!":;;**+
"5k
7$($5$?$?$A
=!uj11rT   c                    | j                   t        k  rt        d      t        |xs i       }t	        |      |d<   t	        |      j                         |d<   | j                  d|      S )a  Add 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 R2000rj   r  XLINEr  r  s       rR   	add_xlinezCreatorInterface.add_xlineO  sb     ??W$!"<==**+
"5k
7$($5$?$?$A
=!w
33rT   c                    | j                   t        k  rt        d      t        |xs i       }t	        |      |d<   | j                  d|      }|t        j                  |      |_        |S )aP  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)	rV   r   r   rg   intra   r   generate
fit_points)rQ   r$  r   r_   splines        rR   
add_splinezCreatorInterface.add_splineb  sf    B ??W$!"=>>**+
"6{
8:>! $j 9FrT   c                    t        |||      }| j                  |j                  |j                  |j	                         |      S )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

        )r   method)control_pointsr   knotsr_   )r   add_open_spliner)  r   r*  )rQ   r$  r   r(  r_   bsplines         rR   add_spline_control_framez)CreatorInterface.add_spline_control_frame  sL    F /vf
 ##"11>>--/!	 $ 
 	
rT   c                f    t        ||      }| j                  |      }|j                  |       |S )a  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r_   )r   r&  apply_construction_tool)rQ   r$  r/  r_   sr%  s         rR   add_cad_spline_control_framez-CreatorInterface.add_cad_spline_control_frame  s3      !h?J7&&q)rT   c                r    | j                  |      }|j                  t        |      |       |||_        |S )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

        r0  )r&  set_open_uniformr   r*  )rQ   r)  r   r*  r_   r%  s         rR   r+  z CreatorInterface.add_open_spline  s;    ( J7^ 4f= FLrT   c                t    | j                  |      }|j                  t        |      ||       |||_        |S )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

        r0  )r&  set_open_rationalr   r*  )rQ   r)  weightsr   r*  r_   r%  s          rR   add_rational_splinez$CreatorInterface.add_rational_spline  s=    6 J7  n!5wG FLrT   c                &    | j                  d|      S )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rQ   r_   s     rR   add_bodyzCreatorInterface.add_body	  s     $$VZ88rT   c                &    | j                  d|      S )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`.

        REGIONr<  r>  s     rR   
add_regionzCreatorInterface.add_region  s     $$Xz::rT   c                &    | j                  d|      S )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`.

        3DSOLIDr<  r>  s     rR   add_3dsolidzCreatorInterface.add_3dsolid  s     $$Y
;;rT   c                v    | j                   t        j                  k  rt        d      | j	                  d|      S )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rV   r	   DXF2007r   r=  r>  s     rR   add_surfacezCreatorInterface.add_surface$  s3     ??U]]*!"GHH$$Y
;;rT   c                v    | j                   t        j                  k  rt        d      | j	                  d|      S )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EXTRUDEDSURFACErH  r>  s     rR   add_extruded_surfacez%CreatorInterface.add_extruded_surface/  s4     ??U]]*!"OPP$$%6
CCrT   c                v    | j                   t        j                  k  rt        d      | j	                  d|      S )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LOFTEDSURFACErH  r>  s     rR   add_lofted_surfacez#CreatorInterface.add_lofted_surface:  s3     ??U]]*!"MNN$$_jAArT   c                v    | j                   t        j                  k  rt        d      | j	                  d|      S )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REVOLVEDSURFACErH  r>  s     rR   add_revolved_surfacez%CreatorInterface.add_revolved_surfaceE  s4     ??U]]*!"OPP$$%6
CCrT   c                v    | j                   t        j                  k  rt        d      | j	                  d|      S )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SWEPTSURFACErH  r>  s     rR   add_swept_surfacez"CreatorInterface.add_swept_surfaceQ  s3     ??U]]*!"LMM$$^Z@@rT   c                   | j                   t        j                  k  rt        | d      t	        |xs i       }| j                   t
        k\  r,|j                  dd       |j                  dt                      | j                  ||      S )Nz requires DXF R2000 or laterr   ru   uid)	rV   r	   r   r   rg   r   r   r!   ra   )rQ   r   r_   s      rR   r=  z!CreatorInterface._add_acis_entity]  ss    ??U]]*!TF*F"GHH**+
??g%!!'1-!!%0tZ00rT   c                    | j                   t        k  rt        d      t        |xs i       }d|d<   t	        |      |d<   d|d<   | j                  d|      S )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 R2000ru   
solid_fillcolorr   pattern_nameHATCH)rV   r   r   rg   r"  ra   )rQ   r[  r_   s      rR   	add_hatchzCreatorInterface.add_hatchf  s^     ??W$!"<==**+
#$
< !%j
7%,
>"w
33rT   c                    | j                   t        k  rt        d      t        |xs i       }|d|d<   n
d|d<   ||d<   d|d<   t        j
                  |d<   t        |      |d	<   | j                  d
|      S )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   rZ  ru   
fill_colorr   r\  pattern_typer[  MPOLYGON)rV   r   r   rg   r	   HATCH_TYPE_PREDEFINEDr"  ra   )rQ   r[  r`  r_   s       rR   add_mpolygonzCreatorInterface.add_mpolygonv  s    * ??W$!"?@@**+
'(J|$'(J|$'1J|$%,
>"%*%@%@
>"!%j
7z:66rT   c                    | j                   t        k  rt        d      t        |xs i       }| j	                  d|      S )z
        Add a :class:`~ezdxf.entities.Mesh` entity. (requires DXF R2007)

        Args:
            dxfattribs: additional DXF attributes

        zMESH requires DXF R2000MESH)rV   r   r   rg   ra   r>  s     rR   add_meshzCreatorInterface.add_mesh  s<     ??W$!";<<**+
vz22rT           c                   | j                   t        k  rt        d      t        |xs i       }|j                  j
                  j                  \  }}|\  }}	||z  }
|	|z  }t        j                  |      }|t        j                  dz  z   }t        |      |d<   t        j                  ||
      |d<   t        j                  ||      |d<   ||d<   | j                  d|      S )a8  
        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)rV   r   r   rg   dxf
image_sizevec2mathradianspir   
from_anglera   )rQ   rm  r   size_in_unitsr   r_   x_pixelsy_pixelsx_unitsy_unitsx_units_per_pixely_units_per_pixelx_angle_rady_angle_rads                 rR   	add_imagezCreatorInterface.add_image  s    , ??W$!"<==**+
&]]55::((#h.#h.ll8,!TWWs]3#F|
8 $=N O
9 $=N O
9"+
;w
33rT   c                    t        |xs i       }| j                  d|      }|j                  |       | j                  }|r d|j                  vr|j                  d       |S )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.

        WIPEOUTr0  ACAD_WIPEOUT_VARSr   )frame)rg   ra   set_masking_arearP   rootdictset_wipeout_variables)rQ   r   r_   wipeoutrP   s        rR   add_wipeoutzCreatorInterface.add_wipeout  sa     **+
??9?L  *hh's||;%%A%.rT   c                2   | j                   t        k  rt        d      t        |xs i       }t	        |      |d<   |j
                  j                  |d<   t        |      |d<   | j                  |j                  |      }||_
        |j                  |       |S )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   )rV   r   r   rg   r   ro  r   rs   ra   entity_namescalingset_underlay_def)rQ   underlay_defr   scaler   r_   underlays          rR   add_underlayzCreatorInterface.add_underlay  s    . ??W$!"?@@**+
#F|
8,8,<,<,C,C
()!&x
:!__$$j
 !!!,/rT   c                    | j                   r'| j                   j                  j                  |      r|S t        j	                  d| d       y)NzReplacing undefined DIMSTYLE "z" by "Standard" DIMSTYLE.Standard)rP   	dimstyles	has_entryloggerdebug)rQ   r   s     rR   _safe_dimstylezCreatorInterface._safe_dimstyle  sC    88**44T:K,TF2KL	
 rT   <>EZDXFc                   dt         j                  t         j                  z  i}| j                  d|      }t	        |
xs i       }
| j                  |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d	<   |t        |      |
d
<   |j                  |
       t        ||	      }||j                  |dd       |S )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	DIMENSIONr0  dimstyledefpointr   	defpoint2	defpoint3angletext_rotationoverrideF)leaderrelative)r	   
DIM_LINEARDIM_BLOCK_EXCLUSIVEra   rg   r  r   r   rs   update_dxf_attribsr   set_location)rQ   basep1p2rd   r   r  r  r  r  r_   r^   dimlinestyles                 rR   add_linear_dimzCreatorInterface.add_linear_dim	  s    j E,,u/H/HHI!__[U_K**+
!%!4!4X!>
:!%d
: Y
6"&r(
;"&r(
;#El
7 $*/*>J'"":. 8<xFrT   c
                `    t        |xs i       }t        t        d|       |||||||||	
       y)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  r_   discardN)rg   r    r   )
rQ   r  r   r  r  r  r  r  r_   r  s
             rR   add_multi_point_linear_dimz+CreatorInterface.add_multi_point_linear_dimT  sB    ` **+
$$d+#9!	
rT   c           
         t        |      }t        |      }	|	|z
  }
|
j                  }|
j                         j                  |      |z   }| j	                  |||	|||||      S )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  r_   )r   	angle_deg
orthogonalr  r  )rQ   r  r  distancer   r  r  r_   _p1_p2	directionr  r  s                rR   add_aligned_dimz CreatorInterface.add_aligned_dim  sy    X 2h2h#I	####%//9C?""! # 	
 		
rT   	EZ_CURVED)rd   r   r  r  r  r_   c                  dt         j                  t         j                  z  i}
| j                  d|
      }t	        |	xs i       }	| j                  |      |	d<   t        |      |	d<   t        |d         |	d<   t        |d         |	d	<   t        |d         |	d
<   t        |d         |	d<   t        |      |	d<   |t        |      |	d<   |j                  |	       t        ||      }||j                  |       |S )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  r0  r  r   r   r  ru   r  	defpoint4r  	defpoint5r  r  )r	   DIM_ANGULARr  ra   rg   r  r   r   rs   r  r   user_location_override)rQ   r  line1line2rd   r   r  r  r  r_   r^   r  r  s                rR   add_angular_dim_2lz#CreatorInterface.add_angular_dim_2l  s   n E--0I0IIJ!__[U_K**+
!%!4!4X!>
: Y
6"&uQx.
;"&uQx.
;"&uQx.
;!%eAh
:"&t*
; $*/*>J'"":. 8<((2rT   c                  dt         j                  t         j                  z  i}t        d| j	                  d|            }t        |
xs i       }
| j                  |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d	<   t        |      |
d
<   |t        |      |
d<   |j                  |
       t        ||	      }||j                  |       |S )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  r0  r  r   r  r  r  r  r  r  )r	   DIM_ANGULAR_3Pr  r   ra   rg   r  r   r   rs   r  r   r  rQ   r  ro   r  r  rd   r   r  r  r  r_   r^   r  r  s                 rR   add_angular_dim_3pz#CreatorInterface.add_angular_dim_3p  s    t E0053L3LLMG
 **+
!%!4!4X!>
: Y
6!%d
:"&r(
;"&r(
;"&v,
; $*/*>J'"":. 8<((2rT   c               r   t        |      }t        |      }t        |      }t        |      }t        |      }|t        ||      dz  z   }|t        j                  |      ||z   z  z   }|t        j                  |      |z  z   }|t        j                  |      |z  z   }| j	                  ||||||||	|
|
      S )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`

        rj  
r  ro   r  r  rd   r   r  r  r  r_   )rs   r   r   from_deg_angler  rQ   ro   rp   r   r   r  rd   r   r  r  r  r_   saeaext_line_startdim_line_offsetcenter_center_angler  r  r  s                        rR   add_angular_dim_craz$CreatorInterface.add_angular_dim_cram  s    ^ ;9v/v,.r26<< ,,\:_,
 
 t**2.??t**2.??&&'! ' 
 	
rT   c                   | j                  |j                  |j                  |j                  |j                  |||||||      S )aA  
        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`

        ro   rp   r   r   r  rd   r   r  r  r  r_   )r  ro   rp   r   r   	rQ   arcr  rd   r   r  r  r  r_   s	            rR   add_angular_dim_arcz$CreatorInterface.add_angular_dim_arc  sN    V ''::::mm'! ( 
 	
rT   c                  dt         j                  t         j                  z  i}| j                  d|      }t	        |
xs i       }
| j                  |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d<   t        |      |
d	<   d
|
d<   d
|
d<   d|
d<   d|
d<   t        |
d<   t        |
d<   |t        |      |
d<   |j                  |
       t        ||	      }||j                  |       |S )a\	  
        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_DIMENSIONr0  r  r   r  r  r  r  rh  r   r   r   
is_partial
has_leaderleader_point1leader_point2r  r  )r	   DIM_ARCr  ra   rg   r  r   r   r   rs   r  r   r  r  s                 rR   add_arc_dim_3pzCreatorInterface.add_arc_dim_3p  s(   z EMME,E,EEF $ !0 !
 **+
!%!4!4X!>
: Y
6!%d
:"&r(
;"&r(
;"&v,
;$'
=!"%
;#$
< #$
< &-
?#&-
?# $*/*>J'"":. 8<((2rT   c               r   t        |      }t        |      }t        |      }t        |      }t        |      }|t        ||      dz  z   }|t        j                  |      ||z   z  z   }|t        j                  |      |z  z   }|t        j                  |      |z  z   }| j	                  ||||||||	|
|
      S )aZ  
        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`

        rj  r  )rs   r   r   r  r  r  s                        rR   add_arc_dim_craz CreatorInterface.add_arc_dim_craJ  s    ` ;9v/v,.r26<< ,,\:_,
 
 t**2.??t**2.??""'! # 
 	
rT   c                   | j                  |j                  |j                  |j                  |j                  |||||||      S )a   
        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  ro   rp   r   r   r  s	            rR   add_arc_dim_arcz CreatorInterface.add_arc_dim_arc  sN    X ##::::mm'! $ 
 	
rT   	EZ_RADIUS)rd   r   r  r  r_   c                  dt         j                  t         j                  z  i}
t        d| j	                  d|
            }t        |      }|.|t        d      t        |      }||z
  j                  |      }nA|1|t        d      |t        d      t        j                  ||      }nt        |      |z
  }||z   }||z
  }t        |	xs i       }	| j                  |      |	d	<   t        |      |	d
<   t        |      |	d<   t        |      |	d<   |j                  |	       t        ||      }||j                  |       |S )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  r0  Argument radius is required.length"Argument angle or mpoint required.#Argument radius or mpoint required.r  r  r  r   r  )r	   DIM_DIAMETERr  r   ra   r   
ValueErrorr  r  rg   r  r   r  r   r  )rQ   ro   mpointrp   r  rd   r   r  r  r_   r^   r  
radius_vecr  r  r  s                   rR   add_diameter_dimz!CreatorInterface.add_diameter_dim  s]   j E..1J1JJKG
 f~ !?@@H~H !8+66f6EJ~=$%IJJ>$%JKK!00?
!&\F2
j j **+
!%!4!4X!>
:!%b
:"&r(
; Y
6"":. 8<((2rT   c                h    t        |      }|j                  |      }| j                  ||||||      S )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  r_   )r   lerpr  )	rQ   r  r  r   r  r  r_   r  ro   s	            rR   add_diameter_dim_2pz$CreatorInterface.add_diameter_dim_2p*  sE    D bR$$! % 
 	
rT   c               l   dt         j                  t         j                  z  i}
t        d| j	                  d|
            }t        |      }|3|t        d      t        |      }||z
  j                  |      }||z   }n5|3|t        d      |t        d      |t        j                  ||      z   }t        |	xs i       }	| j                  |      |	d	<   t        |      |	d
<   t        |      |	d<   t        |      |	d<   |j                  |	       t        ||      }||j                  |       |S )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  r0  r  r  r  r  r  r  r  r   r  )r	   
DIM_RADIUSr  r   ra   r   r  r  r  rg   r  r   r  r   r  )rQ   ro   r  rp   r  rd   r   r  r  r_   r^   r  r  r  s                 rR   add_radius_dimzCreatorInterface.add_radius_dimW  sH   \ E,,u/H/HHIG
 f~ !?@@H~H"V+66f6EJj(F~=$%IJJ>$%JKK$"5"5eV"DD**+
!%!4!4X!>
:"&v,
;!%f
: Y
6"":. 8<((2rT   r  c               0    | j                  ||||||      S )aQ  
        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`

        r  r  )rQ   ro   r  r   r  r  r_   s          rR   add_radius_dim_2pz"CreatorInterface.add_radius_dim_2p  s/    B ""! # 
 	
rT   c          	     2    | j                  |||||||      S )at  
        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`

        )rp   r  r   r  r  r_   r  )rQ   ro   rp   r  r   r  r  r_   s           rR   add_radius_dim_craz#CreatorInterface.add_radius_dim_cra  s2    F ""! # 
 	
rT   )originr   r   r  r  r_   c               X   t        |      }|dvrt        d      dt        j                  t        j                  z  t        j
                  |z  z  i}
t        d| j                  d|
            }t        |      }t        |      }|t        |      z   }t        |	xs i       }	| j                  |      |	d<   ||	d<   t        |      }|r| |	d	<   ||z
  }||j                  |      z   |	d
<   |j                  |      |	d<   t        |      |	d<   |j                  |	       t        ||      }|S )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   ru   zinvalid dtype (0, 1)r  r'   r  r0  r  r  horizontal_directionr  r  r   r  )r"  r
   r	   DIM_ORDINATEr  DIM_ORDINATE_TYPEr   ra   r   rg   r  rs   
rotate_degr   r  r   )rQ   feature_locationoffsetdtyper   r   r   r  r  r_   r^   r  origin_feature_location_
end_point_relative_feature_locationr  s                    rR   add_ordinate_dimz!CreatorInterface.add_ordinate_dim	  sU   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"":. 8<rT   c               6    | j                  ||d||||||	      S )zzShortcut to add an x-type feature ordinate DIMENSION, for more
        information see :meth:`add_ordinate_dim`.

        ru   	r  r  r  r   r   r   r  r  r_   r  	rQ   r  r  r   r   r   r  r  r_   s	            rR   add_ordinate_x_dimz#CreatorInterface.add_ordinate_x_dimv	  7      $$-! % 

 
	
rT   c               6    | j                  ||d||||||	      S )zyShortcut to add a y-type feature ordinate DIMENSION, for more
        information see :meth:`add_ordinate_dim`.

        r   r  r  r  s	            rR   add_ordinate_y_dimz#CreatorInterface.add_ordinate_y_dim	  r  rT   c                L    t        j                  | |||||      j                  S N)r   r   r   r   r_   )r   render_arrowvec3rQ   r   r   r   r   r_   s         rR   	add_arrowzCreatorInterface.add_arrow	  0     ""!
 $	rT   c                L    t        j                  | |||||      j                  S r  )r   insert_arrowr  r  s         rR   add_arrow_blockrefz#CreatorInterface.add_arrow_blockref	  r  rT   c                   dd}| j                   t        k  rt        d      t        |xs i       }| j	                  |      |d<   |j                  dd       t        d| j                  d|            }|j                  |       |rO ||      }d|v r| j                  j                  |d          t        t        d	|      |
      j                          |S )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                f    | j                         D ci c]  \  }}|t        vr|| c}}S c c}}w rO   )items#LEADER_UNSUPPORTED_DIMSTYLE_ATTRIBS)attribskvs      rR   &filter_unsupported_dimstyle_attributeszKCreatorInterface.add_leader.<locals>.filter_unsupported_dimstyle_attributes	  s;     $MMOAq?? 1  s   -zLEADER requires DXF R2000r  annotation_typer   r2   LEADER	dimldrblkr'   r  )r$  rg   r   rg   )rV   r   r   rg   r  r   r   ra   set_verticesrP   acquire_arrowr   commit)rQ   r   r  r  r_   r'  r  s          rR   
add_leaderzCreatorInterface.add_leader	  s    @	 ??W$!"=>>**+
!%!4!4X!>
:/3h* EFH%=hGHh&&&x'<=[&)HfhrT   c                B    ddl m} | j                  ||      } ||      S )zAdd a :class:`~ezdxf.entities.MultiLeader` entity but returns
        a :class:`~ezdxf.render.MultiLeaderMTextBuilder`.

        r   )rJ   )ezdxf.render.mleaderrJ   _make_multileader)rQ   r  r_   rJ   multileaders        rR   add_multileader_mtextz&CreatorInterface.add_multileader_mtext	
  %     	A,,UJ?&{33rT   c                B    ddl m} | j                  ||      } ||      S )zAdd a :class:`~ezdxf.entities.MultiLeader` entity but returns
        a :class:`~ezdxf.render.MultiLeaderBlockBuilder`.

        r   )rK   )r0  rK   r1  )rQ   r  r_   rK   r2  s        rR   add_multileader_blockz&CreatorInterface.add_multileader_block
  r4  rT   c                    | j                   t        k  rt        d      t        |xs i       }| j                  j
                  j                  |      }|t        d| d      |j                  j                  |d<   | j                  d|      S )NzMULTILEADER requires DXF R2000zMLEADERSTYLE 'z' does not existstyle_handleMULTILEADERr0  )rV   r   r   rg   rP   mleader_stylesr   r
   ro  r   ra   )rQ   r  r_   mleader_styles       rR   r1  z"CreatorInterface._make_multileader%
  s    
 ??W$!"BCC**+
//33E: .7G HII%2%6%6%=%=
>"}DDrT   c               (   | j                   t        k  rt        d      t        |xs i       }|j	                  dd      }| j                  d|      }|j                  |j                  |       |j                  |       |r|j                  |       |S )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)
rV   r   r   rg   r   ra   set_flag_stateCLOSED	set_styleextend)rQ   r   r   r_   r=  mlines         rR   	add_mlinezCreatorInterface.add_mline3
  s     ??W$!"<==**+
^^L*=
w
;U\\51
#LL"rT   c                   ddl m} | j                  t        k  rt	        d      t        |xs i       }| j                  d|      }t        ddd      }||j                  _	        t        |      |j                  _        ||ddfz   |j                  _        t        dd|dkD  rdnd      |j                  _        ||j                  _        ||j                  _        t!        |      |j                  _        d|j                  _        |j'                  ||||      }	t)        |j+                  |	            }
|
r|j-                  |
d          |S )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HELIXru   r   )r"   rF  rV   r   r   rg   ra   r   ro  axis_base_pointrs   rp   start_pointaxis_vectorturnsturn_heightr"  
handedness	constrainhelixr   to_bsplines_and_verticesr1  )rQ   rp   pitchrK  ccwr_   rF  rO  r  pspliness              rR   	add_helixzCreatorInterface.add_helixN
  s   2 	??W$!"<==**+
w
;Aq!}$(		! =		 $1~ 5		 $Q	1r B				 %		"3x				JJvueS1t44Q78))'!*5rT   )rP   r#   )r   r   )r^   r   r_   rg   r   r)   )r`   r)   r   r   rO   )rd   r   r   r   )rj   r   rk   r   r   r   )ro   r   rp   rs   r   r   )ro   r   rx   r   ry   rs   rz   rs   r{   rs   r   r*   )TN)ro   r   rp   rs   r   rs   r   rs   r   boolr   r%   )r   Iterable[UVec]r   r?   )r   rW  r   rC   )r   rW  r   r,   )r   r   r   Optional[float]r   rX  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   rX  r   rX  r   r&   )r   rW  r   zOptional[str]r   rV  r   r9   )r   rW  r   rV  r   r9   ))r   r   N)r   ztuple[int, int]r   r:   )r   r8   )r^   r   r   rW  r   r)   )r   rW  r   rW  )r   rw   N)r   r   r   r   r   rs   r   r>   )xyseb)r   rW  r   r   r   rV  r   r1   )r   r   r   r5   )
r  zIterable[str]r  rs   r	  rs   r   rs   r   r5   )r  r   r  rs   r	  rs   r   rs   r  r"  r   r5   )
r  r   r  rs   r	  rs   r  Sequence[float]r   r5   )rj   r   r  r   r   r;   )rj   r   r  r   r   rG   )Nr   N)r$  Optional[Iterable[UVec]]r   r"  r   r   )r   chordN)r$  rW  r   r"  r(  r   r   r   )NN)r$  rW  r/  r[  r   r   )r   NN)r)  rW  r   r"  r*  Optional[Iterable[float]]r   r   )
r)  rW  r8  rZ  r   r"  r*  r]  r   r   )r   r   )r   r<   )r   r@   )r   r   )r   r+   )r   r3   )r   r=   )r   rA   )   N)r[  r"  r   r-   )r[  r"  r`  zOptional[int]r   r6   )r   r7   )rh  N)
rm  r/   r   r   rv  ztuple[float, float]r   rs   r   r.   )r   rW  r   rF   )r   )ru   ru   ru   rh  N)r  rE   r   r   r   rs   r   rD   )r   r   r   r   )Nr  r   Nr  NN)r  r   r  r   r  r   rd   Optional[UVec]r   r   r  rs   r  rX  r  r   r  Optional[dict]r   r   )r   NTr  NNF)r  r   r   rW  r  rs   r  zOptional[UCS]r  rV  r  r   r  r`  r   r   )r  r  NN)r  r   r  r   r  rs   r   r   r  r   r  r`  r   r   )r  r   r  tuple[UVec, UVec]r  ra  rd   r_  r   r   r  rX  r  r   r  r`  r   r   )r  r   ro   r   r  r   r  r   rd   r_  r   r   r  rX  r  r   r  r`  r   r   )ro   r   rp   rs   r   rs   r   rs   r  rs   rd   r_  r   r   r  rX  r  r   r  r`  r   r   )r  r   r  rs   rd   r_  r   r   r  rX  r  r   r  r`  r   r   )NNN)ro   r   r  r_  rp   rX  r  rX  rd   r_  r   r   r  r   r  r`  r   r   )r  r  NN)r  r   r  r   r   r   r  r   r  r`  r   r   )ro   r   r  r   r   r   r  r   r  r`  r   r   )ro   r   rp   rs   r  rs   r   r   r  r   r  r`  r   r   )r  r   r  r   r  r"  r   r   r   rs   r   r   r  r   r  r`  r   r   )r  r   r  r   r   r   r   rs   r   r   r  r   r  r`  r   r   )rw   r   N)
r   r   r   r   r   rs   r   rs   r   r   )r  NN)r   rW  r  r   r  r`  r   r2   )r  N)r  r   r   rJ   )r  r   r   rK   )r  r   r   rH   )r   r[  r   rV  r   r4   )rp   rs   rQ  rs   rK  rs   r   rI   )X__name__
__module____qualname__rS   propertyrV   rZ   ra   r]   rh   rm   rt   rr  taur   r   r   r   r   r   r   r   r   r   r   r   r   r   staticmethodr   r   r   r  r
  r  r  r  r  r&  r-  r3  r+  r9  r?  rB  rE  rJ  rM  rP  rS  rV  r=  r^  r	   BYLAYERrd  rg  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r.  r3  r6  r1  rD  rU  rY   rT   rR   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 * 	 
@ ,, , 	, 
,rT   rM   >   dimblkdimblk1dimblk2)\
__future__r   typingr   r   r   r   r   rr  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   r0  rJ   rK   rM   r#  rY   rT   rR   <module>r{     s    #      N N	 	 	 ' N N N * < @ 			7	#&/& & & & & & & & & &Ng( g(TQ 'G #rT   