
    ^j                        U d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
 ddlmZmZmZ ddlmZ ddlmZmZ ddlmZ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! ddl"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6 ddl7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>  G d de-      Z? G d de-      Z@e'e=z  eAeBeBeBf   z  ZCeeDd<   	 e>e:z  eEeC   z  ZFeeDd<   	 e G d d             ZG G d de-      ZH G d de-      ZI G d de-      ZJy) a  
Drafting Objects

name: drafting.py
by:   Gumyr
date: September 16th 2023

desc:
    This python module contains objects using in building technical drawings as Sketches.

license:

    Copyright 2022 Gumyr

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

    )	dataclass)date)copysignfloorgcdlog2pi)castClassVar	TypeAlias)Iterable)INMM)	Align	FontStyleGeomTypeHeadTypeModeNumberDisplayPageSizeSideUnit)	BuildLine)BuildSketch)AxisLocationPlanePosVector
VectorLike)Line
TangentArc)BaseSketchObjectPolygonText)filletmirrorsweep)	make_facetrace)CompoundCurveEdge	ShapeListSketchVertexWirec            	       ~     e Zd ZdZej
                  gZej                  de	j                  fdededede	f fdZ xZS )	ArrowHeada7  Sketch Object: ArrowHead

    Args:
        size (float): tip to tail length
        head_type (HeadType, optional): arrow head shape. Defaults to HeadType.CURVED.
        rotation (float, optional): rotation in degrees. Defaults to 0.
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.
    r   size	head_typerotationmodec           	         t               5 }|t        j                  k(  rit               5  t	        d| |dz  f| |dz  f      }t        |dz  d|z  dz  df       t        t        j                  	       d d d        t                n|t        j                  k(  rt        | |dz  f| | dz  fdd 
       nr|t        j                  k(  r_t        |t        j                         t        |j                         j!                  t"        j$                  d|z  | dz        |dz         d d d        t&        | Q  j*                  |d |       y # 1 sw Y   xY w# 1 sw Y   3xY w)N)r   r         )tangent   i   r   )aboutalign)r5         )radiusr6   r@   r7   )r   r   CURVEDr   r"   r!   r'   r   XZr)   STRAIGHTr$   FILLETEDr3   r&   verticesfilter_by_positionr   Xsuper__init__sketch)selfr4   r5   r6   r7   
arrow_headside	__class__s          K/opt/ringagent/.cad-venv/lib/python3.12/site-packages/build123d/drafting.pyrN   zArrowHead.__init__F   sJ    ] 	jHOO+[ +%$q 1TE4!8;LD BIM1#56*+ h///$q)TED519+=vTRh///$(//:'')<<T	D519  "9		( 	**XTPTU%+ +	 	s$   EAE6B5EE	EE&)__name__
__module____qualname____doc__r   _tag_applies_tor   rF   r   ADDfloatrN   __classcell__rS   s   @rT   r3   r3   :   sa     ##$K
 'ooXXVV V 	V
 V V    r3   c                        e Zd ZdZej
                  gZdej                  e	j                  fdedeez  dededede	f fd	Z xZS )
Arrowa  Sketch Object: Arrow with shaft

    Args:
        arrow_size (float): arrow head tip to tail length
        shaft_path (Edge |  Wire): line describing the shaft shape
        shaft_width (float): line width of shaft
        head_at_start (bool, optional): Defaults to True.
        head_type (HeadType, optional): arrow head shape. Defaults to HeadType.CURVED.
        mode (Mode, optional): _description_. Defaults to Mode.ADD.
    T
arrow_size
shaft_pathshaft_widthhead_at_startr5   r7   c           	      D   |r|j                  d      dz   n|j                  d      }t        |||t        j                        j	                  t        |j                  t        |                         }|dz  |j                  z  }	|r|j                  |	d      }n|j                  dd|	z
        }|j                  |d      }
t        |
|t        j                        }t        t        |j                  |            j                         }t         | E  |dd |	       y )
Nr      r<   )r4   r6   r5   r7            ?        r7   rE   )tangent_angle_atr3   r   PRIVATEmovedr   position_atintlengthtrimperpendicular_liner(   r
   r+   fusecleanrM   rN   )rP   rb   rc   rd   re   r5   r7   anglerQ   trim_amount	shaft_penshaftarrowrS   s                rT   rN   zArrow.__init__r   s     ''*S0,,Q/ 	 eyt||

%//4E0FGH
I 	
 "A~):)::#c:J#cK.?@J 11+qA	i$,,?Xzu56<<>$TBr_   )rU   rV   rW   rX   r   rY   rZ   r   rF   r   r[   r\   r-   r1   boolrN   r]   r^   s   @rT   ra   ra   d   s{    	 ##$K #&ooXX C C 4K C 	 C
  C  C  C  Cr_   ra   	PointLikePathDescriptorc                      e Zd ZU dZdddZee   ed<   dZe	ed<   dZ
eed	<   ej                  Zeed
<   ej                   Zeed<   dZe	ed<   dZe	ed<   dZe	ed<   ej,                  Zeed<   ej2                  Zeed<   dZeed<   dZeed<   dZeed<   dZ e	ed<   e!defd       Z"d Z#de	defdZ$	 	 d,de	d!e	e%e	e	f   z  d z  ded z  defd"Z&e'd#e(de)e*z  fd$       Z+d%ed z  d&e*d'ed!e	e%e	e	f   z  d z  def
d(Z,e'	 d-d#e)e*z  d)e	d*ede-fd+       Z.y ).Drafta  Draft

    Documenting build123d designs with dimension and extension lines as well as callouts.


    Args:
        font_size (float): size of the text in dimension lines and callouts. Defaults to 5.0.
        font (str): font to use for text. Defaults to "Arial".
        font_style: text style. Defaults to FontStyle.REGULAR.
        head_type (HeadType, optional): arrow head shape. Defaults to HeadType.CURVED.
        arrow_length (float): arrow head length. Defaults to 3.0.
        line_width (float): thickness of all lines. Defaults to 0.5.
        pad_around_text (float): amount of padding around text. Defaults to 2.0.
        unit (Unit): measurement unit. Defaults to Unit.MM.
        number_display (NumberDisplay): numbers as decimal or fractions.
            Default to NumberDisplay.DECIMAL.
        display_units (bool): control the display of units with numbers. Defaults to True.
        decimal_precision (int): number of decimal places when displaying numbers. Defaults to 2.
        fractional_precision (int): maximum fraction denominator - must be a factor of 2.
            Defaults to 64.
        extension_gap (float): gap between the point and start of extension line in extension_line.
            Defaults to 2.0.

    mm"TFunit_LUTg      @	font_sizeArialfont
font_styler5   g      @arrow_length      ?
line_widthg       @pad_around_textunitnumber_displayTdisplay_unitsrh   decimal_precision@   fractional_precisionextension_gapreturnc                     | j                   t        j                  t        j                  t        j                  t        j
                  fv S )zAre metric units being used)r   r   r   CMMMCrP   s    rT   	is_metriczDraft.is_metric   s,     yyTWWdggtvvtww???r_   c                 z    t        | j                        j                         st        d| j                         y)zValidate inputsz6fractional_precision values must be a factor of 2 not N)r   r   
is_integer
ValueErrorr   s    rT   __post_init__zDraft.__post_init__   s<    D--.99;HIbIbHcd  <r_   numberc                     | j                   dkD  r&t        || j                         d| j                    dS t        t        t        || j                                     S )zBRound a float but remove decimal if appropriate and convert to strr   .f)r   roundstrrp   )rP   r   s     rT   _round_to_strzDraft._round_to_str   s_     %%) VT334Qt7M7M6Na4OP	
 Svt'='=>?@	
r_   N	tolerancec                    dt         dt         dt        t         t         f   fd}||| j                  }nd}n|}|rt        j                  | j
                     nd}|d}nSt        |t              rd| j                  |       }n.d| j                  |d	   d
       d| j                  |d          }| j
                  s| j                  t        j                  k(  r8t        t        d}| j                  ||| j
                     z        }	|	 | | }
|
S t        |t        z        } |t!        |t        z  |z
  | j"                  z        | j"                        \  }}|d	k(  r| d| | | }
|
S | d| d| | | }
|
S )zPConvert a raw number to a unit of measurement string based on the class settings	numeratordenominatorr   c                 R    t        | |      }t        | |z        t        ||z        fS )zDMathematically simplify a fraction given a numerator and denominator)r   rp   )r   r   greatest_common_denominators      rT   simplify_fractionz3Draft._number_with_units.<locals>.simplify_fraction   s5    *-i*E'I ;;<K"==> r_   F u    ±z +r   )r   z -r<   r   / )rp   tupler   r   r   r   
isinstancer\   _number_with_unitsr   r   DECIMALr   r   r   r   r   r   )rP   r   r   r   r   qualified_display_unitsunit_strtolerance_strunit_lutmeasurementreturn_value
whole_partr   r   s                 rT   r   zDraft._number_with_units   s   	 	3 	5c? 	   *.*<*<'*/'&3#5L5>>$..1RTM	5)!$"9"9)"D!EFM T,,Yq\,NOT,,Yq\:;=  >>T00M4I4II ,H,,Vht~~6N-NOK)]8*]ODL  v{+J%6v{Z/43L3LLM))&"I{ Q"+Ak]8*]OT  "l!I;a}XJ}oV  r_   pathc                    t        | t        t        f      r| }|S t        | t              rS| D cg c]  }t	        |       }}t        |      dk(  rt        j                  | }|S t        j                  |d      }|S t        d      c c}w )z)Convert a PathDescriptor into a Edge/Wirerh   FclosezUnsupported patch descriptor)	r   r-   r1   r   r   len	make_linemake_polygonr   )r   processed_pathppntss       rT   _process_pathzDraft._process_path  s     dT4L)!N  h''+,!F1I,D,4yA~!%!6  "&!2!24u!E
  ;<< -s   B	label	line_wirelabel_anglec                 L   |j                   }||}|S |r}|j                         j                  t        j                        }t        |      dk(  rt        d      |d   }d|z  dt        z  |j                  z  z  }	| j                  |	       d}|S | j                  ||      }|S )z'Create the str to use as the label textr   z:label_angle requested but the path is not part of a circleih  rh      °)rq   edges	filter_byr   CIRCLEr   r   r	   rD   r   r   )
rP   r   r   r   r   line_length	label_str	arc_edgesarc_edgearc_sizes
             rT   _label_to_strzDraft._label_to_str#  s      &&I  !)33HOODI9~" P  !|H[(AFX__,DEH--h78;I  //YGIr_   u_valueflipc                 z    | j                  |      t        |      dz  z   }t        | j                  |      d|      S )zEGiven a path on Plane.XY, determine the Location for object placementrg   )r   r   r<   )rl   rp   r   ro   )r   r   r   rv   s       rT   _sketch_locationzDraft._sketch_location;  s;    
 %%g.TS@((19eDDr_   )NN)F)/rU   rV   rW   rX   r   r   dict__annotations__r   r\   r   r   r   REGULARr   r   rF   r5   r   r   r   r   r   r   r   r   r   r   r{   r   rp   r   r   propertyr   r   r   r   r   staticmethodr}   r-   r1   r   r   r   r    r_   rT   r   r      s   8 '+37Hhtn7IuD#%--J	-"//Ix)L%J OU D$$1$9$9NM9M4s "#"M5@4 @ @
E 
c 
 9=%)	33 5..53 d{	3
 
3j N td{   Tz  	
 5..5 
0 8=ETkE$)E15E	E Er_   r   c                        e Zd ZdZdddddej
                  fdedededz  de	dz  d	e
eef   d
ee
eef   z  dz  dedef fdZ xZS )DimensionLineu=  Sketch Object: DimensionLine

    Create a dimension line typically for internal measurements.
    Typically used for (but not restricted to) inside dimensions, a dimension line often
    as arrows on either side of a dimension or label.

    There are three options depending on the size of the text and length
    of the dimension line:
    Type 1) The label and arrows fit within the length of the path
    Type 2) The text fit within the path and the arrows go outside
    Type 3) Neither the text nor the arrows fit within the path

    Args:
        path (PathDescriptor): a very general type of input used to describe the path the
            dimension line will follow.
        draft (Draft): instance of Draft dataclass
        sketch (Sketch): the Sketch being created to check for possible overlaps. In builder
            mode the active Sketch will be used if None is provided.
        label (str, optional): a text string which will replace the length (or
            arc length) that would otherwise be extracted from the provided path. Providing
            a label is useful when illustrating a parameterized input where the name of an
            argument is desired not an actual measurement. Defaults to None.
        arrows (tuple[bool, bool], optional): a pair of boolean values controlling the placement
            of the start and end arrows. Defaults to (True, True).
        tolerance (float | tuple[float, float], optional): an optional tolerance
            value to add to the extracted length value. If a single tolerance value is provided
            it is shown as ± the provided value while a pair of values are shown as
            separate + and - values. Defaults to None.
        label_angle (bool, optional): a flag indicating that instead of an extracted length value,
            the size of the circular arc extracted from the path should be displayed in degrees.
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.

    Raises:
        ValueError: Only 2 points allowed for dimension lines
        ValueError: No output - no arrows selected

    NTTFr   draftrO   r   arrowsr   r   r7   c	                    t        j                  |       }	||	|	j                  |	j                  }t        |t              rt        |      dkD  rt        d      t        j                  |      }
|
j                  }|| _
        |j                  ||
||      }t        ||j                  |j                  |j                  t         j"                  t$        j&                        }|j)                         j*                  j,                  }|j/                  d      dk(  rt        d      ||j/                  d      |j0                  z  z   |k  rC||z
  dz  |j2                  z
  }|
j5                  d||z        |
j5                  d||z  z
  d      g}nsd|j0                  z  }t7        j8                  |
dz  |
dz  |
dz  dz  |j0                  z  z
        t7        j8                  |
d	z  |
d	z  dz  |j0                  z  z   |
d	z        g}g }t;        |      D ]  \  }}|j=                  |      |
j=                  |      k7  t?        |      k(  }|jA                  tC        |j0                  ||jD                  ||jF                  t$        j&                  
              ||j2                  z   |dz  z   }d| |z  d	||z  z   g}i }|D ]_  }tI        ||      D cg c]	  \  }}|r| }}}tK        |      }|
jM                  |      jO                  tQ        d	dd            dk\  }t        jS                  |
||      }|jU                  |      }tW        tJ        d z  tK        jX                  ||            } | d}!n t[        d | j]                         D              }!||z  }|j)                         j^                  }"|d}#nLtW        tJ        d z  tK        jX                  ||            }$|$d}#n t[        d |$j]                         D              }#|#|!z  }#|j`                  d|#z  z
  |"z  }%|%||<   b tc        |je                         d       }&tf        '|   |&d   d   dd |       y c c}}w )Nrh   z/Only two points are allowed for dimension lines)txtr   r   r   r@   r7   Tr   zNo output - no arrows selectedrj   ri   r<   rk   r   rg   c              3   4   K   | ]  }|j                     y wNarea.0r   s     rT   	<genexpr>z)DimensionLine.__init__.<locals>.<genexpr>  s     ,WQVV,W   c              3   4   K   | ]  }|j                     y wr   r   r   s     rT   r   z)DimensionLine.__init__.<locals>.<genexpr>  s     %Paff%Pr   
   c                     | d   S )Nr<   r   )xs    rT   <lambda>z(DimensionLine.__init__.<locals>.<lambda>  s
    qt r_   )keyobjr6   r@   r7   )5r   _get_contextrO   r   r   r   r   r   r   rq   	dimensionr   r%   r   r   r   r   CENTERr   rm   bounding_boxr4   rL   countr   r   rr   r-   r   	enumeratero   r{   appendra   r   r5   zipr/   
tangent_at	get_angler   r   locatedr
   	intersectsumfacesdiagonalr   sorteditemsrM   rN   )(rP   r   r   rO   r   r   r   r   r7   contextpath_objpath_lengthr   label_shapelabel_lengthshaft_length
shaft_pairarrow_shapesiry   	flip_headoveragelabel_u_valuesd_linesr   	add_arrowarrow_shapeselect_arrow_shapesd_line
flip_labellocplaced_labelself_intersectionself_intersection_area	bbox_sizecommon_arealine_intersectionscoresorted_d_linesrS   s(                                          rT   rN   zDimensionLine.__init__k  sd    **40>7?gnn6L^^F dH%#d)a-NOO&&t,oo$ ''xiP	oo'',,
 #//16688 <<"=>>&,,t,u/A/AAAKO',6!;e>S>SSLc<+#=>cL;$>>DJ
 u111LqLqLHqLA#58J8J#JJ qLHqLA#58J8J#JJqL	J !*- 	HAu**1-1E1Ea1HHTRSWTI&&$$OO		 !6!669IIx+5q7[;P7PQ% !	$G /2&,.G#*I{ # #
 /0F!,,W5??q!QPTWWJ((7JGC&..s3L $v//E! !(),&),,W=N=T=T=V,W)W&l"F++-66I ~!$(TM6#3#3FF#C%! %,"%K"%%P6G6M6M6O%P"PK11K[[2#33y@E#GFOC!	$H  ^D^B/2QdQUVK#s   Q)rU   rV   rW   rX   r   r[   r}   r   r/   r   r   r{   r\   rN   r]   r^   s   @rT   r   r   D  s    $T !% $08<!XXsWsW sW 	sW
 TzsW dDj!sW 5..5sW sW sW sWr_   r   c                        e Zd ZdZddddddej
                  fdededede	dz  d	e
dz  d
eeef   deeeef   z  dz  dededz  def fdZ xZS )ExtensionLineu  Sketch Object: Extension Line

    Create a dimension line with two lines extending outward from the part to dimension.
    Typically used for (but not restricted to) outside dimensions, with a pair of lines
    extending from the edge of a part to a dimension line.

    Args:
        border (PathDescriptor): a very general type of input defining the object to
            be dimensioned. Typically this value would be extracted from the part but is
            not restricted to this use.
        offset (float): a distance to displace the dimension line from the edge of the object
        draft (Draft): instance of Draft dataclass
        label (str, optional): a text string which will replace the length (or arc length)
            that would otherwise be extracted from the provided path. Providing a label is
            useful when illustrating a parameterized input where the name of an argument
            is desired not an actual measurement. Defaults to None.
        arrows (tuple[bool, bool], optional): a pair of boolean values controlling the placement
            of the start and end arrows. Defaults to (True, True).
        tolerance (float | tuple[float, float], optional): an optional tolerance
            value to add to the extracted length value. If a single tolerance value is provided
            it is shown as ± the provided value while a pair of values are shown as
            separate + and - values. Defaults to None.
        label_angle (bool, optional): a flag indicating that instead of an extracted length
            value, the size of the circular arc extracted from the path should be displayed
            in degrees. Defaults to False.
        measurement_direction (VectorLike, optional): Vector line which to project the dimension
            against. Offset start point is the position of the start of border.
            Defaults to None.
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.

    Nr   Fborderoffsetr   rO   r   r   r   r   measurement_directionr7   c           
      N   t        j                  |       }|||j                  |j                  }|dk(  rt        d      t        j                  |      }|j                  d      |j                  d      k(  rt        d      |	t        |	t              rt        |	      }	|j                  d      |j                  d      z
  }|j                  |	      }t        j                  |j                  d      |j                  d      |z         }n|}t        j                  t        j                  d}|j!                  ||t#        t%        d|               d      }||n|j'                  ||||      }dD cg c]6  }t        j                  |j                  |      |j                  |            8 }}t)        |d   j*                  t)        |      z
        d	kD  rDdD cg c]9  }t        j                  |j                  |      |j                  d|z
              ; }}|D cg c]8  }|j-                  t/        |j1                  d      |j2                  z              : }}g }|D ]K  }|j5                  |j6                  d      }t9        ||t:        j<                  
      }|j?                  |       M tA        |||||||t:        j<                  
      }|jB                  | _!        tE        ||jG                         z         }tH        |   |dd |
       y c c}w c c}w c c}w )Nr   z.A dimension line should be used if offset is 0r<   z1Start and end points of border must be different.)r<   r   F)distancerR   closed)r   r<   g-C6?rk   childrenr   )&r   r   rO   r   r   r   ro   r   r   r   project_to_liner-   r   r   RIGHTLEFT	offset_2drp   r   r   absrq   rn   r   r   r   rs   r   r(   r   rm   r   r   r   r/   r  rM   rN   )rP   r#  r$  r   rO   r   r   r   r   r%  r7   r  object_to_measuremeasure_object_spanextent_along_wireobject_to_dimensionside_lutdimension_pathdimension_label_streextension_linesextension_linee_linesline_pene_line_shaper  e_line_sketchrS   s                              rT   rN   zExtensionLine.__init__  s8    **40>7?gnn6L^^FQ;MNN "//7((+/@/L/LQ/OOPQQ ,/:(./D(E%"3"?"?#!--a0#1 !4 C C%! #'..!--a0!--a03DD#
 #4zztyy1,66(3x6/B+C"DU 7 

   $$U,?iX 	 	
  NN!--a0.2L2LQ2O
 
 q!((3v;67$>
  	  %11!4n6P6PQRUVQV6WO  #2	
    22158K8KKL
 
 - 	)N%889I9I1MH >MLNN<(	) 	
  ))&,,.(@A]QdNW

s   8;L >L$=L")rU   rV   rW   rX   r   r[   r}   r\   r   r/   r   r   r{   r    rN   r]   r^   s   @rT   r"  r"    s    N !% $08<!37XX`O`O `O 	`O
 `O Tz`O dDj!`O 5..5`O `O  *D0`O `O `Or_   r"  c                       e Zd ZdZej
                  dez  dez  fej                  dez  dez  fej                  dez  dez  fej                  dez  dez  fej                  dez  dez  fej                  dez  dez  fej                  dez  d	ez  fej                  d	ez  d
ez  fej                  d
ez  dez  fej                  dez  dez  fej                   dez  dez  fej"                  dez  dez  fej&                  dez  dez  fej(                  dez  dez  fiZdez  Zddej                  dddddddej0                  fdededz  dededed ed!edz  d"ed#ed$ed%ef fd&Z xZS )'TechnicalDrawinga^  Sketch Object: TechnicalDrawing

    The border of a technical drawing with external frame and text box.

    Args:
        designed_by (str, optional): Defaults to "build123d".
        design_date (date, optional): Defaults to date.today().
        page_size (PageSize, optional): Defaults to PageSize.A4.
        title (str, optional): drawing title. Defaults to "Title".
        sub_title (str, optional): drawing sub title. Defaults to "Sub Title".
        drawing_number (str, optional): Defaults to "B3D-1".
        sheet_number (int, optional): Defaults to None.
        drawing_scale (float, optional): displays as 1:value. Defaults to 1.0.
        nominal_text_size (float, optional): size of title text. Defaults to 10.0.
        line_width (float, optional): Defaults to 0.5.
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.
    i  iI  iR  i  i)     g     b@i   J   4   %         g      !@      rB   	build123dNTitlez	Sub TitlezB3D-1ri   g      $@r   designed_bydesign_date	page_sizetitle	sub_titledrawing_numbersheet_numberdrawing_scalenominal_text_sizer   r7   c                    |t        j                         }t        j                  |   }|d   dt        j                  z  z
  d|	z  z
  }d|z  dz  }t        j                  | dz  |dz  f|dz  |dz  f|dz  | dz  f| dz  | dz  fg      }t        ||
t        j                        }g }t        d      D ]  }|dv r|dz  }|j                  |      }|j                  t        j                  ||t        |	d      j!                  t"        j$                  |j'                  |      dz         z                 t        ||
t        j                        }t)               }dd	d
dd}t        d      D ]]  }dD ]V  }|t+        ||d|	z  z   z  ||   |z        t)        t-        j.                  t1        |dz         |	      j2                        z  z  }X _ ddddddd}t5        g d      D ]T  \  }}dD ]J  }|t+        ||   |z  ||d|	z  z   z        t)        t-        j.                  ||	      j2                        z  z  }L V |j7                         j9                  t"        j:                        d   dz  }|j7                         j9                  t"        j<                        d   dz  }t        j                  ||j<                  |j:                  f|gd      }|j7                         j9                  t"        j<                        d   dz  } |j7                         j9                  t"        j<                        d   dz  }!t?               |t        j                  | |j<                  | j:                  f      gz   }|t        j                  |!|j<                  |!j:                  f      z  }|j7                         j9                  t"        j:                        d   dz  }"|j7                         j9                  t"        j:                        d   dz  }#|t        j                  |"|"j<                  |j:                  f      z  }t        |#j<                  |j:                        }$|t        j                  |$|$t        d|j:                  |j:                  z
  dz        z         z  }t        ||
t        j                        }%t)               }&t        j                  ||j<                  |j:                  f      jA                  tC        |	d z  df            }'|'jA                  tC        |d!z  df            }(|'jA                  tC        d|z  d!z  df            })|&t+        |'d"z        t)        t-        j.                  d#|	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |'dz        t)        t-        j.                  ||	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |'d%z        t)        t-        j.                  d&|	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |'dz        t)        t-        j.                  |jK                         |	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |'dz        t)        t-        j.                  d'|	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |'dz        t)        t-        j.                  d(t1        |      z   |	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |(d)z        t)        t-        j.                  ||	tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |(dz        t)        t-        j.                  ||	tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |(dz        t)        t-        j.                  d*|	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |(dz        t)        t-        j.                  ||	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|&t+        |)dz        t)        t-        j.                  d+|	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&|g|&t+        |)dz        t)        t-        j.                  t1        |      |	dz  tD        jF                  tD        jH                  f$      j2                        z  z  }&t-        ||||%|&g,      }*tL        +|   |*dd |-       y ).Nr   rh   r9   rk   rC   )r   r:   r      Z   g      ؿg      g      ?g      ?)r   r<   rh   r9      )g      r   g      ?r<   gڿg      пgUUUUUUgUUUUUU?g      ?g?)r   r<   rh   r9   rW  rB   )FEDCBAr   r   g      ?Fr   gUUUUUU?gUUUUUU?rB   r:   gUUUUUU?zDESIGNED BY:r?   g?zDATE:zSCALE:z1:g?zDRAWING NUMBER:zSHEET:r)  r   )(r   todayr?  
page_sizesmarginr1   r   r*   r   rm   rangero   r   r-   r   r   rotater   Zrl   r/   r   r+   	make_textr   wrappedr   r   sort_byYrL   r,   rn   r   r   MINr   	isoformatrM   rN   ),rP   rK  rL  rM  rN  rO  rP  rQ  rR  rS  r   r7   page_dimframe_widthframe_height
frame_wireframe
tick_linesr  r   posticksgrid_labels	y_centersr   x_index	x_centers
grid_labely_indexbf_pnt1bf_pnt2box_frame_curvebf_pnt3bf_pnt4bf_pnt5bf_pnt6start	box_framelabelst_base_line1t_base_line2t_base_line3technical_drawingrS   s,                                              rT   rN   zTechnicalDrawing.__init__  s7	     **,K#..y9qkA(8(?(?$??!FWBWW;*&&!<!#34q,"23q<-!"34!L=1#45	

 j*4<<@
r 	AN""fG((1C.299
 ; ;G Dr I	 j*4<<@h6e>	1X 	E& s{S3D-DDEe$|3  &&s519~7HIQQ  	 
	 ''EF 	VMAz& VsaL;.|c4E.EEF  8--j:KLTTU V VV	V ""$,,TVV4Q7#=""$,,TVV4R84?9=9J9Jwyy')),g6e:
 "'')11$&&9!<F!'')11$&&9!<F'NN7WYY		$:;%
 
 	4>>'GIIwyy3IJJ!'')11$&&9"=G!'')11$&&9"=G4>>'GIIwyy3IJJwyy')),4>>56!gii'))&;q%@AA
 	
 /:DLLI	~~g		799/EFLL'!+Q/0
 $))(K!OQ3G*HI#))(AOa4G3K*LM#lg./& 1A 5eii=Vg3
 
 	

 	#lf-..2599ell:Sg2
 
 	

 	#lf-.*Q.uyy%,,6Og2
 
 	

 	#lf-.%%'!A%yy%,,/ g2
 
 	
 	#lf-.+a/		5<<7Pg2
 
 	

 	#lf-.s=))!A%yy%,,/ g2
 
 	
 	#lg./&(ELL0Ig3
 
 	

 	#lf-.,UYY4Mg2
 
 	

 	#lf-.!!A%yy%,,/ g2
 
 	
 	#lf-. 1A 5eii=Vg2
 
 	

 	#lf-.+a/		5<<7Pg2
 
 	

 #c,&12V""%%) 99ell3 '6  F %UKFC
 	.$TRr_   )rU   rV   rW   rX   r   A0r   A1A2A3A4A5A6A7A8A9A10LETTERr   LEGALLEDGERr_  r`  r   r[   r   r   rp   r\   rN   r]   r^   s   @rT   r?  r?  g  s   & 	dRir*cBhb)cBhb)cBhb)cBhb)cBh
+ebj#(+cBhR(b2grBw'b2grBw'rBwR("r'38,b#(+"r'27+J  VF '#'&kk$%#'"#'XXsSsS D[sS 	sS
 sS sS sS DjsS sS !sS sS sS sSr_   r?  N)KrX   dataclassesr   datetimer   mathr   r   r   r   r	   typingr
   r   r   collections.abcr   build123d.build_commonr   r   build123d.build_enumsr   r   r   r   r   r   r   r   r   build123d.build_liner   build123d.build_sketchr   build123d.geometryr   r   r   r   r   r    build123d.objects_curver!   r"   build123d.objects_sketchr#   r$   r%   build123d.operations_genericr&   r'   r(   build123d.operations_sketchr)   r*   build123d.topologyr+   r,   r-   r.   r/   r0   r1   r3   ra   r   r\   r|   r   listr}   r   r   r"  r?  r   r_   rT   <module>r     s  8 "  / / , , $ )
 
 
 + . M M 4 D D > > 8 U U U'V  'VT.C .Cb ueU/B)CC	9 C ) 4K$y/9	 9 ) eE eE eEPZW$ ZWzCO$ COLZS' ZSr_   