
    h.i                    l   S r SSKJr  SSKJrJrJrJr  SSKJ	r	J
r
Jr  SSKJr  SSKJr  SSKJrJrJrJrJrJr  \(       a  SSKJr  SS	KJr  S
rSrS\-  rS\-  rSr " S S\ 5      r! " S S5      r"\"" 5       r# " S S5      r$ " S S\$5      r% " S S\$5      r& " S S\&5      r' " S S\$5      r(SS jr)g) a  Dimension lines as composite entities build up by DXF primitives.

This add-on exist just for an easy transition from `dxfwrite` to `ezdxf`.

Classes
-------

- LinearDimension
- AngularDimension
- ArcDimension
- RadiusDimension
- DimStyle

This code was written long before I had any understanding of the DIMENSION
entity and therefore, the classes have completely different implementations and
styling features than the dimensions based on the DIMENSION entity .

.. warning::

    Try to not use these classes beside porting `dxfwrite` code to `ezdxf`
    and even for that case the usage of the regular DIMENSION entity is to
    prefer because this module will not get much maintenance and may be removed
    in the future.

    )annotations)AnyTYPE_CHECKINGIterableOptional)radiansdegreespi)abstractmethod)TextEntityAlignment)Vec3Vec2distancelerpConstructionRayUVec)Drawing)GenericLayoutType皙?.     f@g      i@      ?c                  L   ^  \ rS rSrSr/ SQrSU 4S jjrS	S jrS
S jrSr	U =r
$ )DimStyle/   zBDimStyle parameter struct, a dumb object just to store values
    ))tickDIMTICK_ARCH)
tickfactorr   )tick2xF)scaleg      Y@)roundvalr   )	roundhalfF)	textcolor   )height      ?)prefix )suffixr(   )stylezOpenSansCondensed-Light)layer
DIMENSIONS)dimlinecolorr$   )
dimlineext333333?)	textabove皙?)
dimextlineT)dimextlinecolor   )dimextlinegapr/   c                j   > [         TU ]  [        R                  5        XS'   U R	                  U5        g )Nname)super__init__r   default_valuesupdate)selfr7   kwargs	__class__s      G/var/www/html/env/lib/python3.13/site-packages/ezdxf/addons/dimlines.pyr9   DimStyle.__init__\   s)    001VF    c                
    X   $ N )r<   attrs     r?   __getattr__DimStyle.__getattr__b   s
    zrA   c                    X U'   g rC   rD   )r<   rE   values      r?   __setattr__DimStyle.__setattr__e   s	    T
rA   rD   )r7   str)rE   rL   returnr   )rE   rL   rI   r   rM   None)__name__
__module____qualname____firstlineno____doc__r:   r9   rF   rJ   __static_attributes____classcell__r>   s   @r?   r   r   /   s$    'NR rA   r   c                  J    \ rS rSrSrS	S jrS
S jrS
S jr\SS j5       r	Sr
g)	DimStylesi   z
DimStyle container

c                    0 U l         [        S5      U l        U R                  S[        [        S5      SSSSSS	9  U R                  S
[        SSSSSSS	9  U R                  S[        SSSSSSS	9  g )NDefault	angle.deg   °r   DIMTICK_RADIUST        F)r    r)   r!   r   r   r.   r2   z
angle.gradgonz	angle.radrad   )_stylesr   defaultnew	ANGLE_DEGrL   
ANGLE_GRAD	ANGLE_RADr<   s    r?   r9   DimStyles.__init__o   s    ,.	*t9! 	 		
 	! 	 		
 	! 	 		
rA   c                L    U R                   R                  XR                  5      $ )z 
Get DimStyle() object by name.
)rc   getrd   )r<   r7   s     r?   rl   DimStyles.get   s     ||ll33rA   c                :    [        U40 UD6nX0R                  U'   U$ )z
Create a new dimstyle
)r   rc   )r<   r7   r=   r*   s       r?   re   DimStyles.new   s$     (("TrA   c                   [         R                  R                  SS.nSSS.nSSS.nU R                  R	                  S5      nUR                  SSUS9  UR                  S	S
US9  U R                  R	                  S5      nUR                  SSUS9  UR                  SSUS9  U R                  R	                  S5      nUR                  SSUS9  UR                  / SQUS9  U R                  R	                  S5      nUR                  / SQUS9  g)za
Insert necessary definitions into drawing:

    ticks: DIMTICK_ARCH, DIMTICK_DOT, DIMTICK_ARROW
BYBLOCKcolorr+      r$   r   )r_   r&   )r_   g      ࿩startend
dxfattribs)皙ɿry   )r1   r1   DIMTICK_DOTr   r   g?)centerradiusrx   DIMTICK_ARROW)r{   r/   r   r/   g)rx   r^   )r{   r   )g      ?r_   r   N)	dimstylesrd   r3   blocksre   add_line
add_circle	add_solid)drawingdimcolorcolor4color7blocks        r?   setupDimStyles.setup   s   & &&66
 y1y1"">2[khO\{vN""=1Z[XNsvF""?3Z\hO;O""#34< 	 	
rA   )rc   rd   NrM   rN   )r7   rL   rM   r   )r   z	'Drawing')rO   rP   rQ   rR   rS   r9   rl   re   staticmethodr   rT   rD   rA   r?   rX   rX   i   s+    
!
F4 (
 (
rA   rX   c                  J    \ rS rSrSrS	S jrS
S jrSS jr\SS j5       r	Sr
g)_DimensionBase   z+
Abstract base class for dimension lines.

c                P    [         R                  U5      U l        X l        X0l        g rC   )r   rl   dimstyler+   r!   )r<   r   r+   r!   s       r?   r9   _DimensionBase.__init__   s    !h/
 rA   c                    US:X  a/  U R                   b  U R                   $ U R                  R                   $ US:X  a/  U R                  b  U R                  $ U R                  R                  $ U R                  U   $ )zg
Get dimension line properties by `property_name` with the possibility to override several properties.
r+   r!   )r+   r   r!   )r<   property_names     r?   prop_DimensionBase.prop   su     G#!%!74::PT]]=P=PPj( ==,  ]]++ ==//rA   c                    S[        U R                  S5      5      -   S-   nX!-  n[        U;   a&  UR                  S5        UR                  [        5        U R                  S5      U-   U R                  S5      -   $ )z
Format the dimension text.
z%.r!   f0r'   r)   )rL   r   DIMENSIONS_FLOATINGPOINTrstrip)r<   dimvalue
dimtextfmtdimtexts       r?   format_dimtext_DimensionBase.format_dimtext   sl     C		* 566<
'#w.NN3NN34yy"W,tyy/BBBrA   c                    g rC   rD   r<   layouts     r?   render_DimensionBase.render   s    rA   )r   r+   r!   N)r   rL   r+   rL   r!   int)r   rL   rM   r   )r   floatrM   rL   )r   'GenericLayoutType')rO   rP   rQ   rR   rS   r9   r   r   r   r   rT   rD   rA   r?   r   r      s+    
!
0C  rA   r   c                  $  ^  \ rS rSrSr    S           SU 4S jjjrSS jrSS jrSS jrSS jr	SS jr
\SS	 j5       r\SS
 j5       rSS jr\SS j5       rSS jr\S S j5       rSS jrSS jrSS jrS!S jrS"S jrSS jrSrU =r$ )#LinearDimension   z
Simple straight dimension line with two or more measure points, build with basic DXF entities. This is NOT a dxf
dimension entity. And This is a 2D element, so all z-values will be ignored!

c                   > [         TU ]  XEU5        X0l        [        U5      U l        S/U R
                  -  U l        [        U5      U l        SU l	        g)a  
LinearDimension Constructor.

Args:
    pos: location as (x, y) tuple of dimension line, line goes through this point
    measure_points: list of points as (x, y) tuples to dimension (two or more)
    angle: angle (in degree) of dimension line
    dimstyle: dimstyle name, 'Default' - style is the default value
    layer: dimension line layer, override the default value of dimstyle
    roundval: count of decimal places

r(   N)
r8   r9   anglelistmeasure_pointssection_counttext_overrider   
dimlineposr   )r<   posr   r   r   r+   r!   r>   s          r?   r9   LinearDimension.__init__  sM    * 	(3
">2 TD$6$66s)rA   c                     X R                   U'   g)zW
Set and override the text of the dimension text for the given dimension line section.
N)r   )r<   sectiontexts      r?   set_textLinearDimension.set_text  s     '+7#rA   c                ~   U R                    Vs/ s H  n[        U5      PM     snU l         [        U R                  [	        U R
                  5      S9nU R                    Vs/ s H  nU R                  X5      PM     snU l        U R                  U R                  5      U l	        U R                  5         gs  snf s  snf )zP
Calc setup values and determines the point order of the dimension line points.
)r   N)r   r   r   r   r   r   _get_point_on_dimlinedimline_points_indices_of_sorted_pointspoint_order_build_vectors)r<   point
dimlinerays      r?   _setupLinearDimension._setup$  s     9=8K8KL8KutE{8KL$T__GDJJ<OP
 ,,
, &&u9,
  99$:M:MN M
s   B5!B:c                :    U R                   U R                  U      $ )z<
Get point on the dimension line, index runs left to right.
)r   r   )r<   indexs     r?   _get_dimline_point"LinearDimension._get_dimline_point1  s      ""4#3#3E#:;;rA   c                L    U R                  U5      U R                  US-   5      4$ )zE
Get start and end point on the dimension line of dimension section.
   r   )r<   r   s     r?   _get_section_points#LinearDimension._get_section_points7  s0     &&w/1H1HaK2
 
 	
rA   c                F    U R                  S5      U R                  S5      4$ )z5
Get the first and the last point of dimension line.
r   r   ri   s    r?   _get_dimline_bounds#LinearDimension._get_dimline_bounds?  s%     &&q)4+B+B2+FFFrA   c                2    [        U R                  5      S-
  $ )zcount of dimline sectionsr   lenr   ri   s    r?   r   LinearDimension.section_countE  s     4&&'!++rA   c                ,    [        U R                  5      $ )zcount of dimline pointsr   ri   s    r?   point_countLinearDimension.point_countJ  s     4&&''rA   c                    U R                  5         U R                  U5        U R                  S5      (       a  U R                  U5        U R	                  U5        U R                  U5        g3build dimension line object with basic dxf entitiesr2   N)r   _draw_dimliner   _draw_extension_lines
_draw_text_draw_ticksr   s     r?   r   LinearDimension.renderO  sP    6"99\""&&v. rA   c                    [        U 5       VVs/ s H  u  pX!4PM
     nnnUR                  5         U VVs/ s H  u  p!UPM	     snn$ s  snnf s  snnf )z7get indices of points, for points sorted by x, y values)	enumeratesort)pointsidxr   indexed_pointss       r?   r   )LinearDimension._indices_of_sorted_pointsX  sP     :C69JK9J:35,9JK&45n
n55 L5s
   AAc                    U R                  5       u  p[        U5      [        U5      -
  R                  5       U l        U R                  R	                  5       U l        g)z9build unit vectors, parallel and normal to dimension lineN)r   r   	normalizeparallel_vector
orthogonalnormal_vector)r<   point1point2s      r?   r   LinearDimension._build_vectors_  sG    113 $VtF| ;FFH!11<<>rA   c                B    UR                  UR                  U 5      5      $ )z=get the measure target point projection on the dimension line)	intersectr   )r   dimrays     r?   r   %LinearDimension._get_point_on_dimlinee  s       1 1% 899rA   c                   U R                  5       u  p#U R                  S5      nUS:  a"  X R                  U-  -
  nX0R                  U-  -   nU R                  S5      U R                  S5      S.nUR                  UUUS9  g)zbuild dimension line entityr.   r   r-   r+   rr   ru   N)r   r   r   r   )r<   r   start_point	end_pointr.   attribss         r?   r   LinearDimension._draw_dimlinej  s    !%!9!9!;YY|,
>%)=)=
)JKK!%9%9J%FGI YY~.YYw'
 	 	 	
rA   c                P   U R                  S5      nU R                  S5      U R                  S5      S.n[        U R                  U R                  5       HN  u  pE[	        XE5      [        U[        5      :  d  M$  XT-
  R                  5       nXVU-  -
  nUR                  UUUS9  MP     g)"build the extension lines entitiesr5   r-   r+   rr   ru   N)	r   zipr   r   r   maxDIMENSIONS_MIN_DISTANCEr   r   )r<   r   r5   r   dimline_pointtarget_pointdirection_vectors          r?   r   %LinearDimension._draw_extension_lines}  s    		/2YY~.YYw'

 ,/!4!4,
'M 4s68  %1$@#K#K#M +-/OP'$&   ,
rA   c                t   U R                  S5      U R                  S5      U R                  S5      U R                  U R                  S5      S.n[        U R                  5       HQ  nU R	                  U5      nU R                  U5      nUR                  UUS9R                  U[        R                  S9  MS     g)	z%build the dimension value text entityr%   r#   r+   r*   )r%   rs   r+   rotationr*   r   rx   alignN)
r   r   ranger   _get_dimvalue_text_get_text_insert_pointadd_textset_placementr   MIDDLE_CENTER)r<   r   r   r   dimvalue_textinsert_points         r?   r   LinearDimension._draw_text  s     ii)YY{+YYw'

YYw'
 T//0G 33G<M66w?LOO""   m$7$E$E   1rA   c                    U R                   U   n[        U5      (       a  U$ U R                  U5      u  p4[        X45      U R	                  S5      -  nU R                  U5      $ )z?get the dimension value as text, distance from point1 to point2r    )r   r   r   r   r   r   )r<   r   overrider   r   r   s         r?   r	  "LinearDimension._get_dimvalue_text  s[    %%g.x==O11':F+dii.@@""8,,rA   c                    U R                  U5      u  p#U R                  S5      S-  U R                  S5      -   n[        X#5      U R                  U-  -   $ )z)get the dimension value text insert pointr%          @r0   )r   r   r   r   )r<   r   r   r   dists        r?   r
  &LinearDimension._get_text_insert_point  sP    11':yy"S(499[+AAF#t'9'9D'@AArA   c                  ^ ^^ T R                  S5      T R                  S5      T R                  S5      S.mSSUUU 4S jjjnT R                  S5      (       aP  [        ST R                  S-
  5       H  nU" US5        M     [        ST R                  5       H  nU" US	5        M     g
[        T R                  5       H  nU" US5        M     g
)z@insert the dimension line ticks, (markers on the dimension line)r   r+   xscaleyscaler+   Fc                   > TR                   U(       a  SOS-   TS'   TR                  TR                  U 5      TR                  S5      TS9  g)z*build the insert-entity for the tick blockr   r_   r  r   insertr7   rx   N)r   add_blockrefr   r   )r   rotater   r   r<   s     r?   add_tick-LinearDimension._draw_ticks.<locals>.add_tick  sJ    "&**S"IGJ..u5YYv&"   rA   r   r   r   TN)F)r   r   r   boolrM   rN   )r   r  r   )r<   r   r!  r   r   s   ``  @r?   r   LinearDimension._draw_ticks  s     ii-ii-YYw'
	 	 99Xq$"2"2Q"67& 8q$"2"23% 4 t//0& 1rA   )	r   r   r   r   r   r   r   r   r   )r_   r[   NN)r   r   r   Iterable[UVec]r   r   r   rL   r+   Optional[str]r!   Optional[int])r   r   r   rL   rM   rN   r   )r   r   rM   r   )r   r   rM   tuple[Vec3, Vec3])rM   r(  )rM   r   r   r   rM   rN   )r   r%  rM   z	list[int])r   r   r   r   rM   r   )r   r   rM   rL   )r   r   rM   r   )rO   rP   rQ   rR   rS   r9   r   r   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r	  r
  r   rT   rU   rV   s   @r?   r   r      s     !#"& ' 	
     8+<
G , , ( (! 6 6? : :
&,&-B' 'rA   r   c                     ^  \ rS rSrSr\r\r\	r
   S             SU 4S jjjrSS jrSS jrSS jrSS jrSS jrSS	 jrSS
 jrSS jrSS jrSS jrSrU =r$ )AngularDimensioni  z
Draw an angle dimensioning line at dimline pos from start to end, dimension text is the angle build of the three
points start-center-end.

c                   > [         TU ]  XVU5        [        U5      U l        [        U5      U l        [        U5      U l        [        U5      U l        g)a  
AngularDimension constructor.

Args:
    pos: location as (x, y) tuple of dimension line, line goes through this point
    center: center point as (x, y) tuple of angle
    start: line from center to start is the first side of the angle
    end: line from center to end is the second side of the angle
    dimstyle: dimstyle name, 'Default' - style is the default value
    layer: dimension line layer, override the default value of dimstyle
    roundval: count of decimal places

N)r8   r9   r   r   r|   rv   rw   )	r<   r   r|   rv   rw   r   r+   r!   r>   s	           r?   r9   AngularDimension.__init__  s@    . 	(3s)6l%[
9rA   c                   [        U R                  U R                  5      U l        [        U R                  U R                  5      U l        U R                  U R                  -
  R                  5       U l        U R                  U R                  -
  R                  5       U l	        U R                  R                  U l        U R                  R                  U l        g)zsetup calculation valuesN)r   r|   r   
pos_radiusrv   r}   r   start_vectorrw   
end_vectorr   start_angle	end_angleri   s    r?   r   AngularDimension._setup  s    "4;;@t{{DJJ7!ZZ$++5@@B88dkk1<<>,,22..rA   c                    U R                  5         U R                  U5        U R                  S5      (       a  U R                  U5        U R	                  U5        U R                  U5        gr   )r   _draw_dimension_liner   r   _draw_dimension_textr   r   s     r?   r   AngularDimension.render  sT     	!!&)99\""&&v.!!&) rA   c           
         UR                  U R                  U R                  [        U R                  5      [        U R
                  5      U R                  S5      U R                  S5      S.S9  g)z0draw the dimension line from start- to endangle.r+   r-   r+   rs   )r}   r|   r3  r4  rx   N)add_arcr0  r|   r	   r3  r4  r   r   s     r?   r7  %AngularDimension._draw_dimension_line  sX    ??;; 0 01dnn-7+>2 	 		
rA   c           	         U R                   U R                  4 HS  nUR                  U R                  U5      U R	                  U5      U R                  S5      U R                  S5      S.S9  MU     g)r   r+   r3   r;  ru   N)r1  r2  r   _get_extline_start_get_extline_endr   )r<   r   vectors      r?   r   &AngularDimension._draw_extension_lines  sf    (($//:FOO--f5))&1!YYw/!YY'89   ;rA   c                B    U R                   XR                  S5      -  -   $ Nr5   )r|   r   r<   rA  s     r?   r?  #AngularDimension._get_extline_start%  s    {{fyy'AABBrA   c                8    U R                   XR                  -  -   $ rC   r|   r0  rE  s     r?   r@  !AngularDimension._get_extline_end(      {{f677rA   c                v   U R                  S5      [        U R                  U R                  -   S-  [        S-  -
  5      U R                  S5      U R                  S5      U R                  S5      S.nUR                  U R                  5       US9R                  U R                  5       [        R                  S	9  g )
Nr%      r  r+   r*   r#   r%   r  r+   r*   rs   r  r  )r   r	   r3  r4  r
   r  _get_dimtextr  r
  r   r  )r<   r   r   s      r?   r8  %AngularDimension._draw_dimension_text+  s    ii)!!DNN2a7"s(B YYw'YYw'YY{+
 	""$ 	 	
 -'')%33  
rA   c                    U R                   U R                  -   S-  R                  5       nU R                  U R	                  S5      -   U R	                  S5      S-  -   nU R
                  X-  -   $ )Nr  r0   r%   )r1  r2  r   r0  r   r|   )r<   	midvectorlengths      r?   r
  'AngularDimension._get_text_insert_point=  se    ''$//9S@KKM	OOdii44tyy7JS7PP 	 {{i011rA   c                   U R                  S5      U R                  S5      U R                  S5      S.nU R                  S4U R                  U R                  S5      44 Hs  u  p4U R                  X0R                  -  -   nUR
                  [        S-  -   n[        Xd(       a  [        OS-   5      US'   UR                  UU R                  S	5      US
9  Mu     g )Nr   r+   r  Fr   r  r_   r  r   r  )	r   r1  r2  r|   r0  r   r
   r	   r  )r<   r   r   rA  mirrorr  r  s          r?   r   AngularDimension._draw_ticksD  s    ii-ii-YYw'
 &__dii12
NF  ;;&??*BCL||b3h.H")(Fb*L"MGJ#YYv&"   
rA   c                z    U R                   U R                  -
  U R                  S5      -  nU R                  U5      $ Nr    )r4  r3  r   r   )r<   r   s     r?   rN  AngularDimension._get_dimtextW  s7     $"2"22dii6HH""5))rA   )
r|   r   rw   r4  r2  r0  r}   rv   r3  r1  )r\   NN)r   r   r|   r   rv   r   rw   r   r   rL   r+   r&  r!   r'  r   r)  rA  r   rM   r   rM   r   rM   rL   )rO   rP   rQ   rR   rS   rf   DEGrg   GRADrh   RADr9   r   r   r7  r   r?  r@  r8  r
  r   rN  rT   rU   rV   s   @r?   r,  r,    s     CD
C $#"&  	
      :/!

C8
$2&* *rA   r,  c                     ^  \ rS rSrSr    S	               S
U 4S jjjrSU 4S jjrSS jrSS jrSS jr	Sr
U =r$ )ArcDimensioni_  z
Arc is defined by start- and endpoint on arc and the center point, or by three points lying on the arc if acr3points
is True. Measured length goes from start- to endpoint. The dimension line goes through the dimlinepos.

c	           	     6   > [         T	U ]  XX4XgU5        XPl        g)a  
Args:
    pos: location as (x, y) tuple of dimension line, line goes through this point
    center: center point of arc
    start: start point of arc
    end: end point of arc
    arc3points: if **True** arc is defined by three points on the arc (center, start, end)
    dimstyle: dimstyle name, 'Default' - style is the default value
    layer: dimension line layer, override the default value of dimstyle
    roundval: count of decimal places

N)r8   r9   
arc3points)
r<   r   r|   rv   rw   rc  r   r+   r!   r>   s
            r?   r9   ArcDimension.__init__f  s    . 	e(8L$rA   c                   > [         TU ]  5         U R                  (       a1  [        U R                  U R
                  U R                  5      U l        g g rC   )r8   r   rc  center_of_3points_arcr|   rv   rw   )r<   r>   s    r?   r   ArcDimension._setup  s8    ??/TZZDK rA   c                \    U R                   XR                  U R                  S5      -   -  -   $ rD  )r|   r}   r   rE  s     r?   r?  ArcDimension._get_extline_start  s+    {{kkDIIo$>>?
 	
rA   c                8    U R                   XR                  -  -   $ rC   rH  rE  s     r?   r@  ArcDimension._get_extline_end  rJ  rA   c                    U R                   U R                  -
  U R                  -  U R                  S5      -  nU R	                  U5      $ rX  )r4  r3  r}   r   r   )r<   
arc_lengths     r?   rN  ArcDimension._get_dimtext  sI    ^^d...kkii ! 	
 "":..rA   )rc  r|   )Fr[   NN)r   r   r|   r   rv   r   rw   r   rc  r#  r   rL   r+   r&  r!   r'  r   rZ  r\  )rO   rP   rQ   rR   rS   r9   r   r?  r@  rN  rT   rU   rV   s   @r?   ra  ra  _  s     !!#"&%% % 	%
 % % % %  % %4

8/ /rA   ra  c                     ^  \ rS rSrSr    S           SU 4S jjjrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSrU =r$ )RadialDimensioni  z
Draw a radius dimension line from `target` in direction of `center` with length drawing units. RadiusDimension has
a special tick!!
c                   > [         TU ]  XEU5        [        U5      U l        [        U5      U l        [        U5      U l        g)a4  
Args:
    center: center point of radius
    target: target point of radius
    length: length of radius arrow (drawing length)
    dimstyle: dimstyle name, 'Default' - style is the default value
    layer: dimension line layer, override the default value of dimstyle
    roundval: count of decimal places

N)r8   r9   r   r|   targetr   rR  )r<   r|   rr  rR  r   r+   r!   r>   s          r?   r9   RadialDimension.__init__  s5    & 	(36l6lFmrA   c                    U R                   U R                  -
  R                  5       U l        [	        U R                  U R                   5      U l        g rC   )rr  r|   r   target_vectorr   r}   ri   s    r?   r   RadialDimension._setup  s9    KK$++%
)+ 	 t{{DKK8rA   c                    U R                  5         U R                  U5        U R                  U5        U R                  U5        g)r   N)r   r7  r8  r   r   s     r?   r   RadialDimension.render  s5    !!&)!!&) rA   c                    U R                   U R                  U R                  U R                  -
  -  -   nUR	                  UU R
                  U R                  S5      U R                  S5      S.S9  g )Nr-   r+   rr   ru   )r|   ru  r}   rR  r   rr  r   )r<   r   r   s      r?   r7  $RadialDimension._draw_dimension_line  se    kk$++";<
 	>27+ 	 	
rA   c           
     @   UR                  U R                  5       U R                  S5      U R                  R                  U R                  S5      U R                  S5      U R                  S5      S.S9R                  U R                  5       [        R                  S9  g )Nr%   r+   r*   r#   rM  r  r  )	r  rN  r   ru  	angle_degr  _get_insert_pointr   MIDDLE_RIGHTr   s     r?   r8  $RadialDimension._draw_dimension_text  s    ""$))H- ..887+7+;/ 	 		
 -""$,?,L,L  
rA   c                r    U R                   U R                  U R                  U R                  S5      -   -  -
  $ )Nr0   )rr  ru  rR  r   ri   s    r?   r}  !RadialDimension._get_insert_point  s3    {{$++		+0F"FG
 	
rA   c                \    U R                  U R                  U R                  S5      -  5      $ rX  )r   r}   r   ri   s    r?   rN  RadialDimension._get_dimtext  s%    ""4;;71C#CDDrA   c           
         UR                  U R                  SU R                  R                  S-   U R	                  S5      U R	                  S5      U R	                  S5      S.S9  g )Nr^      r   r+   )r  r  r  r+   r  )r  rr  ru  r|  r   r   s     r?   r   RadialDimension._draw_ticks  s\    ;;! ..883>))L1))L17+	 	 		
rA   )r|   rR  r}   rr  ru  )r   r[   NN)r|   r   rr  r   rR  r   r   rL   r+   r&  r!   r'  r   r)  r[  r\  )rO   rP   rQ   rR   rS   r9   r   r   r7  r8  r}  rN  r   rT   rU   rV   s   @r?   rp  rp    s     !#"&$$ $ 	$
 $ $  $ $09!



E

 

rA   rp  c                    [        X5      n[        X5      n[        X5      n[        X5      nUR                  U5      nUR                  U5      nUR                  U5      $ )zw
Calc center point of 3 point arc. ConstructionCircle is defined by 3 points
on the circle: point1, point2 and point3.
)r   r   r   r   )	r   r   point3ray1ray2	midpoint1	midpoint2center_ray1center_ray2s	            r?   rf  rf    sY    
 6*D6*DV$IV$I//),K//),K  --rA   N)r   r   r   r   r  r   rM   r   )*rS   
__future__r   typingr   r   r   r   mathr   r	   r
   abcr   ezdxf.enumsr   
ezdxf.mathr   r   r   r   r   r   ezdxf.documentr   ezdxf.eztypesr   r   r   rf   rg   rh   dictr   rX   r   r   r   r,  ra  rp  rf  rD   rA   r?   <module>r     s   2 # 9 9 % %  + H H&/  BJ	RZ
	7t 7t`
 `
F K	) )XS'n S'lK*~ K*\6/# 6/rX
n X
v.rA   