Ë
    Jÿi}ž  ã                   ó  — U d Z ddlZddlZddlmZmZ ddlmZ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mZmZmZ ddl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%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<  ejz                  d«      j}                   ej~                  «       «        ejz                  d«      Z@e1e;z  e2z  e9z  e/z  ez  ZAe	eBd<   	 ddej†                  fdeAeeA   z  deDe%z  dz  deEdede/f
d„ZFdejŽ                  fde5ee5   z  dz  dede8e4z  fd„ZHe1e:z  ZIe	eBd<   	 	 	 	 dBdeIeeI   z  deDdeDdz  deDdz  de1e2z  dz  de8e4z  fd„ZJdeIeeI   z  d eDde8e4z  e0z  fd!„ZKe1e;z  e2z  e/z  e0z  e8z  e4z  ZLe	eBd"<   	 de#jš                  ej†                  fdeLeeL   z  dz  d#e#dede0e8z  e4z  e/z  fd$„ZNe1e2z  e9z  e/z  ZOe	eBd%<   	 dddej                   ej¢                  ddej¤                  fdeOeeO   z  dz  d&eDd'e2eSe2   z  dz  d(ed)ed*eEd+eDdz  dede0e8z  e4z  e/z  fd,„ZTe1e2z  e;z  e&z  e:z  ZUe	eBd-<   	 dddej†                  fdeUeeU   z  dz  d.e#dz  d/e9e/z  e4z  dz  dede0e8z  e/z  e6e&   z  f
d0„ZVdd1ej¤                  fde5ee5   z  dz  d2eDeWeDeDeDf   z  dede0e8z  e4z  e/z  fd3„ZXe1e;z  e2z  e9z  ZYe	eBd4<   	 de#jš                  ej´                  ej¤                  fdeYeeY   z  dz  d5e#e2z  e7z  d6edefd7„Z[e/e1z  e;z  e2z  e9z  Z\e	eBd8<   	 ddd9d9ejº                  dddej†                  f	d:e\ee\   z  dz  d;e0e1z  e;z  ee1   z  dz  d<eEd=eEd>ed?e'dz  d@e1e;z  dz  deEdede4e8z  fdA„Z^y)Ca$  
Generic Operations

name: operations_generic.py
by:   Gumyr
date: March 21th 2023

desc:
    This python module contains operations (functions) that work on combinations
    of Curves, Sketches and Parts.

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.

é    N)ÚradiansÚtan)ÚcastÚ	TypeAlias)ÚIterable)ÚBuilderÚLocationListÚWorkplaneListÚflatten_sequenceÚvalidate_inputs)ÚKeepÚKindÚModeÚSideÚ
TransitionÚGeomType)Ú	BuildLine)Ú	BuildPart)ÚBuildSketch)ÚAxisÚLocationÚMatrixÚPlaneÚRotationÚRotationLikeÚVectorÚ
VectorLike)ÚBasePartObject)ÚBaseSketchObject)ÚBaseLineObject)ÚCompoundÚCurveÚEdgeÚFaceÚGroupByÚPartÚShapeÚ	ShapeListÚShellÚSketchÚSolidÚVertexÚWireÚ	isclose_bÚ	build123dÚAddTypeTÚobjectsÚrotationÚcleanÚmodeÚreturnc           
      ó*  — t        j                  d«      }|€t        d«      ‚t        | t        «      rt        | t
        «      st        | «      }n| g}|D �cg c]B  }t        |t
        «      r|j                  d¬«      nt        |t         «      r|j                  n|‘ŒD }}t        |d|«       t        |t        «      �r|€t        ddd«      }n$t        |t        «      r	t        |Ž }nt        d«      ‚|D �cg c]  }|j                  |«      ‘Œ }}|D �cg c]  }t        |t        «      sŒ|‘Œ }}|D �cg c]  }t        |t         «      sŒ|‘Œ }	}|D �cg c]  }t        |t"        «      sŒ|‘Œ }
}|D �cg c]  }t        |t$        «      sŒ|‘Œ }}t'        d„ |«      D ]’  }|j)                  |j+                  t        «      «       |	j)                  |j+                  t         «      «       |
j)                  |j+                  t"        «      «       |j)                  |j+                  t$        «      «       Œ” |	D ]!  }|j)                  |j-                  «       «       Œ# t/        j                  «       st        d	«      ‚|D ��cg c]6  }t/        j                  «       j0                  D ]  }|j                  |«      ‘Œ Œ8 }}} |j2                  |Ž  |}t5        j                  «       j6                  D ]q  }g }t/        j                  «       j0                  D ])  }|
D ]"  }|j9                  |j                  |«      «       Œ$ Œ+  |j2                  |d
|iŽ |j)                  |«       Œs |D ��cg c]6  }t/        j                  «       j0                  D ]  }|j                  |«      ‘Œ Œ8 }}} |j:                  |||dœŽ |j)                  |«       t        |«      S t        |t<        «      r¨t        |t>        t@        f«      r|nd}g }|D ]j  }|j)                  t/        j                  «       jB                  D �cg c]1  }|jE                  tF        jH                  |«      j                  |«      ‘Œ3 c}«       Œl  |j:                  |d|iŽ t        |«      S t        |tJ        «      r¨t        |t>        t@        f«      r|nd}g }|D ]j  }|j)                  t/        j                  «       jB                  D �cg c]1  }|jE                  tF        jH                  |«      j                  |«      ‘Œ3 c}«       Œl  |j:                  |d|iŽ t        |«      S t        d|jL                  jN                  › d�«      ‚c c}w c c}w c c}w c c}w c c}w c c}w c c}}w c c}}w c c}w c c}w )a<  Generic Object: Add Object to Part or Sketch

    Add an object to a builder.

    BuildPart:
        Edges and Wires are added to pending_edges. Compounds of Face are added to
        pending_faces. Solids or Compounds of Solid are combined into the part.
    BuildSketch:
        Edges and Wires are added to pending_edges. Compounds of Face are added to sketch.
    BuildLine:
        Edges and Wires are added to line.

    Args:
        objects (Edge |  Wire |  Face |  Solid |  Compound  or Iterable of): objects to add
        rotation (float |  RotationLike, optional): rotation angle for sketch,
            rotation about each axis for part. Defaults to None.
        clean (bool, optional): Remove extraneous internal structure. Defaults to True.
       mode (Mode, optional): combine mode. Defaults to Mode.ADD.
    Nz'Add must have an active builder contextF©ÚfullyÚaddr   zInvalid rotation valuec                 ó"   — t        | t        «      S ©N)Ú
isinstancer!   )Úos    úm/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/build123d/operations_generic.pyÚ<lambda>zadd.<locals>.<lambda>Ž   s   € ¬°A´xÔ)@ó    z$There is no active Locations contextÚ
face_plane©r3   r4   ç        r4   zBuilder z is unsupported)(r   Ú_get_contextÚRuntimeErrorr<   r   r!   ÚlistÚunwrapÚ_objr   r   r   ÚtupleÚ
ValueErrorÚmovedr#   r-   r$   r+   ÚfilterÚextendÚget_typeÚedgesr	   Ú	locationsÚ_add_to_pendingr
   Ú
workplanesÚappendÚ_add_to_contextr   ÚintÚfloatÚlocal_locationsÚrotater   ÚZr   Ú	__class__Ú__name__)r1   r2   r3   r4   ÚcontextÚobject_listÚobjÚobject_iterÚ	new_edgesÚ	new_wiresÚ	new_facesÚ
new_solidsÚcompoundÚnew_wireÚedgeÚlocationÚlocated_edgesÚnew_objectsÚ	workplaneÚfaces_per_workplaneÚfaceÚsolidÚlocated_solidsÚrotation_angles                           r>   r9   r9   U   s"  € ô2 &×2Ñ2°4Ó8€GØ€ÜÐDÓEÐEä�'œ8Ô$¬Z¸ÄÔ-JÜ˜7“m‰à�iˆñ óñ ˆCô ˜#œxÔ(ð �J‰J˜UˆJÔ#ä'¨¬WÔ5�—’¸3ñ?ð ð ð ô �G˜U KÔ0ä�'œ9Õ%ØÐÜ  1 aÓ(‰HÜ˜¤%Ô(Ü Ð*‰HäÐ5Ó6Ð6á6AÓB±k¨s�s—y‘y Õ*°kˆÐBÙ$/ÓI¡K˜S´:¸cÄ4Õ3H’S Kˆ	ÐIÙ$/ÓI¡K˜S´:¸cÄ4Õ3H’S Kˆ	ÐIÙ$/ÓI¡K˜S´:¸cÄ4Õ3H’S Kˆ	ÐIÙ%0ÓK¡[˜c´J¸sÄEÕ4J’c [ˆ
ÐKÜÑ@À+ÖNˆHØ×Ñ˜X×.Ñ.¬tÓ4Ô5Ø×Ñ˜X×.Ñ.¬tÓ4Ô5Ø×Ñ˜X×.Ñ.¬tÓ4Ô5Ø×Ñ˜h×/Ñ/´Ó6Õ7ð	 Oó
 "ˆHØ×Ñ˜XŸ^™^Ó-Õ.ð "ô ×(Ñ(Ô*ÜÐEÓFÐFñ "ô
á!�Ü(×5Ñ5Ó7×AÔA�ð �J‰J�xÕ àAð !Ø!ð 	ñ 
ð
 	 ˆ×Ñ Ñ/Ø#ˆô '×3Ñ3Ó5×@Ô@ˆIØ"$ÐÜ(×5Ñ5Ó7×AÔA�Û%�DØ'×.Ñ.¨t¯z©z¸(Ó/CÕDñ &ð Bð $ˆG×#Ñ#Ð%8ÐOÀYÒOØ×ÑÐ2Õ3ð Añ $ô
á#�Ü(×5Ñ5Ó7×AÔA�ð �K‰K˜Õ!àAð "Ø#ð 	ñ 
ð
 	 ˆ×Ñ °uÀ4ÓHØ×Ñ˜>Ô*ô: �KÓ Ð ô7 
�Gœ[Ô	)Ü%/°¼3Ä¸,Ô%G™ÈSˆØˆÛˆCØ×Ñô %1×$=Ñ$=Ó$?×$OÒ$Oóá$O˜ð —J‘JœtŸv™v ~Ó6×<Ñ<¸XÕFØ$Oñõð ð 	 ˆ×Ñ Ð8°4Ò8ô" �KÓ Ð ô 
�GœYÔ	'Ü%/°¼3Ä¸,Ô%G™ÈSˆØˆÛˆCØ×Ñô %1×$=Ñ$=Ó$?×$OÒ$Oóá$O˜ð —J‘JœtŸv™v ~Ó6×<Ñ<¸XÕFØ$Oñõð ð 	 ˆ×Ñ Ð8°4Ò8ô
 �KÓ Ð ô ˜X g×&7Ñ&7×&@Ñ&@Ð%AÀÐQÓRÐRùòmùò& CùÚIùÚIùÚIùÚKùó
ùó$
ùòùòsU   ÁAU!Ã5U&ÄU+Ä)U+Ä3U0Å	U0ÅU5Å)U5Å3U:Æ	U:É;;U?Í!;VÐ*6V
Ó"6V
c                 ó  — t        j                  d«      }| €)|�|�|j                  €t        d«      ‚|j                  g}nt	        | «      }t        |d|«       t        |D �cg c]  }|j                  dk(  ‘Œ c}«      �r{g }|D �]A  }t        |t        «      rŒ|j                  «       }|j                  j                  |j                  j                  f|j                  j                  |j                  j                  f|j                  j                  |j                  j                  f|j                  j                  |j                  j                  f|j                  j                  |j                  j                  fg}|j                  t!        t#        j$                  |D �cg c]  }t'        |«      ‘Œ c}«      «      «       �ŒD |� |j(                  |d|iŽ t+        t-        |«      j.                  «      S g }	|D ]Î  }t        |t        «      rŒ|j                  «       }|	j                  t1        j2                  |j4                  j                  |j4                  j                  |j4                  j6                  t9        |j                  j                  |j                  j                  |j                  j6                  f«      «      «       ŒÐ |� |j(                  |	d|iŽ t;        t-        |	«      j.                  «      S c c}w c c}w )a$  Generic Operation: Add Bounding Box

    Applies to: BuildSketch and BuildPart

    Add the 2D or 3D bounding boxes of the object sequence

    Args:
        objects (Shape or Iterable of): objects to create bbox for
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.
    Úbounding_boxúobjects must be providedé   r4   )r   rD   rH   rJ   r   r   ÚallÚ_dimr<   r,   rq   ÚminÚXÚYÚmaxrS   r$   r-   Úmake_polygonr   rT   r*   r!   Úwrappedr+   Úmake_boxÚsizerY   r   r&   )
r1   r4   r\   r]   r^   rb   ÚbboxÚverticesÚvri   s
             r>   rq   rq   Ñ   sR  € ô &×2Ñ2°>ÓB€Gà€Øˆ?˜gÐ1°g·l±lÐ6JÜÐ7Ó8Ð8Ø—|‘|�n‰ä& wÓ/ˆä�G˜^¨[Ô9ä
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Õ2Øˆ	ÜˆCÜ˜#œvÔ&ØØ×#Ñ#Ó%ˆDà—‘—‘˜TŸX™XŸZ™ZÐ(Ø—‘—‘˜TŸX™XŸZ™ZÐ(Ø—‘—‘˜TŸX™XŸZ™ZÐ(Ø—‘—‘˜TŸX™XŸZ™ZÐ(Ø—‘—‘˜TŸX™XŸZ™ZÐ(ðˆHð ×ÑœT¤$×"3Ñ"3ÉÓ4QÉÀ1´V¸AµYÈÑ4QÓ"RÓSÖTð ð ÐØ#ˆG×#Ñ# YÐ:°TÒ:Ü”h˜yÓ)×1Ñ1Ó2Ð2à€KÛˆÜ�cœ6Ô"ØØ×ÑÓ!ˆØ×ÑÜ�N‰NØ—	‘	—‘Ø—	‘	—‘Ø—	‘	—‘Ü�t—x‘x—z‘z 4§8¡8§:¡:¨t¯x©x¯z©zÐ:Ó;ó	õ	
ð	 ð ÐØˆ×Ñ Ð8°4Ò8Ü”˜Ó%×-Ñ-Ó.Ð.ùòC 2ùò 5Rs   Á"LÆ%LÚChamferFilletTypeÚlengthÚlength2ÚangleÚ	referencec           	      ó   ‡— t        j                  d«      }|r|rt        d«      ‚|r|t        t	        |«      «      z  }|r|s|st        d«      ‚|€|n|}| €|�| €|�|j
                  €t        d«      ‚t        | «      }t        |d|«       |�|j
                  Šn|d   j                  Š‰€t        d«      ‚‰j                  dk(  r¸t        ‰t        «      rt        ‰j                  «      n‰Št        |D �cg c]  }t        |t        «      ‘Œ c}«      st        d«      ‚‰j!                  ||t#        |«      |«      }|�!|j%                  |t&        j(                  ¬	«       t        t+        |g«      j                  «      S ‰j                  d
k(  �rt        ‰t,        «      rt/        ‰j                  «      n‰Št        |D �cg c]  }t        |t0        «      ‘Œ c}«      st        d«      ‚g }	‰j3                  «       D ][  }
|
j5                  «       D �cg c]	  }||v sŒ|‘Œ }}|r$|	j7                  |
j9                  ||||«      «       ŒK|	j7                  |
«       Œ] t/        t+        |	«      j                  «      }|�!|j%                  |t&        j(                  ¬	«       |S ‰j                  dk(  rÇt        ‰t:        «      rt=        ‰j                  «      n‰j?                  «       d   Št        |D �cg c]  }t        |t0        «      ‘Œ c}«      st        d«      ‚‰j@                  stC        tE        ˆfd„|«      «      }‰j9                  ||||«      }|�!|j%                  |t&        j(                  ¬	«       |S t        d«      ‚c c}w c c}w c c}w c c}w )aa  Generic Operation: chamfer

    Applies to 2 and 3 dimensional objects.

    Chamfer the given sequence of edges or vertices.

    Args:
        objects (Edge | Vertex  or Iterable of): edges or vertices to chamfer
        length (float): chamfer size
        length2 (float, optional): asymmetric chamfer size. Defaults to None.
        angle (float, optional): chamfer angle in degrees. Defaults to None.
        reference (Edge | Face): identifies the side where length is measured. Edge(s) must
            be part of the face. Vertex/Vertices must be part of edge

    Raises:
        ValueError: no objects provided
        ValueError: objects must be Edges
        ValueError: objects must be Vertices
        ValueError: Only one of length2 or angle should be provided
        ValueError: reference can only be used in conjunction with length2 or angle
    Úchamferz/Only one of length2 or angle should be providedz?reference can only be used in conjunction with length2 or angleúNo objects providedr   zNothing to chamferé   z%3D chamfer operation takes only Edges©r4   rs   z(2D chamfer operation takes only Verticesé   ú'1D fillet operation takes only Verticesc                 óú   •— t        t        | j                  «       Ž ‰j                  d«      z
  j                  d«      xs< t        t        | j                  «       Ž ‰j                  d«      z
  j                  d«       S ©Nr   rC   r‹   ©r.   r   Úto_tupleÚposition_atr‚   ©r€   Útargets    €r>   r?   zchamfer.<locals>.<lambda>z  óm   ø€ Ü!Ü# Q§Z¡Z£\Ð2°V×5GÑ5GÈÓ5JÑJ×RÑRØóò ô %Ü# Q§Z¡Z£\Ð2°V×5GÑ5GÈÓ5JÑJ×RÑRØóñ	r@   úInvalid object dimension)#r   rD   rJ   r   r   rH   r   r   Útopo_parentru   r<   r   r&   r{   rt   r#   r‡   rF   rT   r   ÚREPLACEr!   r   r*   r,   Úfacesr   rS   Ú
chamfer_2dr    r-   ÚwiresÚ	is_closedr(   rL   )r1   r‚   rƒ   r„   r…   r\   r]   r^   Únew_partrb   rl   r€   Úvertices_in_faceÚ
new_sketchre   r“   s                  @r>   r‡   r‡     sQ  ø€ ô8 &×2Ñ2°9Ó=€GÙ‘5ÜÐJÓKÐKáØœ3œw u›~Ó.Ñ.ˆá™'¡UÜØMó
ð 	
ð  ˜‰f¨W€Gàˆ˜G˜OØˆ˜GÐ/°G·L±LÐ4HäÐ.Ó/Ð/ä" 7Ó+€Kä�G˜Y¨Ô4àÐØ—‘‰à˜Q‘×+Ñ+ˆØ€~ÜÐ-Ó.Ð.à‡{�{�aÒä)3°F¼NÔ)K”�f—n‘nÔ%ÐQWˆä±[ÓA±[¨c”J˜s¤DÕ)°[ÑAÔBÜÐDÓEÐEØ—>‘> &¨'´4¸Ó3DÀiÓPˆàÐØ×#Ñ# H´4·<±<Ð#Ô@Ü”H˜h˜ZÓ(×0Ñ0Ó1Ð1à‡{�{�aÓô '1°Ô9IÔ&JŒF�6—>‘>Ô"ÐPVð 	ô ±{ÓC±{°”J˜s¤FÕ+°{ÑCÔDÜÐGÓHÐHØˆ	Ø—L‘L–NˆDØ+/¯=©=¬?ÓO©? a¸aÀ;Ò>N¢¨?ÐÐOÙØ× Ñ Ø—O‘O F¨GÐ5EÀyÓQõð × Ñ  Õ&ð #ô œH YÓ/×7Ñ7Ó8ˆ
àÐØ×#Ñ# J´T·\±\Ð#ÔBØÐà‡{�{�aÒô ˜&¤.Ô1ô �—‘Ô à—‘“ Ñ"ð 	ô
 ±{ÓC±{°”J˜s¤FÕ+°{ÑCÔDÜÐFÓGÐGà×ÒÜ#Üó	ð  óóˆKð ×$Ñ$ V¨W°kÀ9ÓMˆØÐØ×#Ñ# H´4·<±<Ð#Ô@Øˆä
Ð/Ó
0Ð0ùòy Bùò Dùò  Pùò& Ds   Ã7M<Æ?NÈ	NÈNË+NÚradiusc           	      ó¨  ‡— t        j                  d«      }| €|�| €|�|j                  €t        d«      ‚t	        | «      }t        |d|«       |�|j                  Šn|d   j                  Š‰€t        d«      ‚‰j                  dk(  r¶t        ‰t        «      rt        ‰j                  «      n‰Št        |D �cg c]  }t        |t        «      ‘Œ c}«      st        d«      ‚‰j                  |t        |«      «      }|�!|j!                  |t"        j$                  ¬«       t        t'        |g«      j                  «      S ‰j                  dk(  �rt        ‰t(        «      rt+        ‰j                  «      n‰Št        |D �cg c]  }t        |t,        «      ‘Œ c}«      st        d	«      ‚g }‰j/                  «       D ]b  }|j1                  «       D �cg c]  }|t        |«      v sŒ|‘Œ }	}|	r"|j3                  |j5                  ||	«      «       ŒR|j3                  |«       Œd t+        t'        |«      j                  «      }
|�!|j!                  |
t"        j$                  ¬«       |
S ‰j                  d
k(  rÅt        ‰t6        «      rt9        ‰j                  «      n‰j;                  «       d   Št        |D �cg c]  }t        |t,        «      ‘Œ c}«      st        d«      ‚‰j<                  st?        tA        ˆfd„|«      «      }‰j5                  ||«      }|�!|j!                  |t"        j$                  ¬«       |S t        d«      ‚c c}w c c}w c c}w c c}w )a%  Generic Operation: fillet

    Applies to 2 and 3 dimensional objects.

    Fillet the given sequence of edges or vertices. Note that vertices on
    either end of an open line will be automatically skipped.

    Args:
        objects (Edge | Vertex or Iterable of): edges or vertices to fillet
        radius (float): fillet size - must be less than 1/2 local width

    Raises:
        ValueError: no objects provided
        ValueError: objects must be Edges
        ValueError: objects must be Vertices
        ValueError: nothing to fillet
    Úfilletrˆ   r   zNothing to filletr‰   z$3D fillet operation takes only EdgesrŠ   rs   z'2D fillet operation takes only Verticesr‹   rŒ   c                 óú   •— t        t        | j                  «       Ž ‰j                  d«      z
  j                  d«      xs< t        t        | j                  «       Ž ‰j                  d«      z
  j                  d«       S rŽ   r�   r’   s    €r>   r?   zfillet.<locals>.<lambda>á  r”   r@   r•   )!r   rD   rH   rJ   r   r   r–   ru   r<   r   r&   r{   rt   r#   r¡   rF   rT   r   r—   r!   r   r*   r,   r˜   r   rS   Ú	fillet_2dr    r-   rš   r›   r(   rL   )r1   rŸ   r\   r]   r^   rœ   rb   rl   r€   r�   rž   re   r“   s               @r>   r¡   r¡   �  sú  ø€ ô* &×2Ñ2°8Ó<€GØˆ˜G˜OØˆ˜GÐ/°G·L±LÐ4HäÐ.Ó/Ð/ä" 7Ó+€Kä�G˜X {Ô3ØÐØ—‘‰à˜Q‘×+Ñ+ˆØ€~ÜÐ,Ó-Ð-à‡{�{�aÒä)3°F¼NÔ)K”�f—n‘nÔ%ÐQWˆä±[ÓA±[¨c”J˜s¤DÕ)°[ÑAÔBÜÐCÓDÐDØ—=‘= ¬¨kÓ):Ó;ˆàÐØ×#Ñ# H´4·<±<Ð#Ô@Ü”H˜h˜ZÓ(×0Ñ0Ó1Ð1à‡{�{�aÓô '1°Ô9IÔ&JŒF�6—>‘>Ô"ÐPVð 	ô ±{ÓC±{°”J˜s¤FÕ+°{ÑCÔDÜÐFÓGÐGØˆ	Ø—L‘L–NˆDØ+/¯=©=¬?ÓU©? a¸aÄ4ÈÓCTÒ>T¢¨?ÐÐUÙØ× Ñ  §¡°Ð8HÓ!IÕJà× Ñ  Õ&ð #ô œH YÓ/×7Ñ7Ó8ˆ
àÐØ×#Ñ# J´T·\±\Ð#ÔBØÐà‡{�{�aÒô ˜&¤.Ô1ô �—‘Ô à—‘“ Ñ"ð 	ô
 ±{ÓC±{°”J˜s¤FÕ+°{ÑCÔDÜÐFÓGÐGà×ÒÜ#Üó	ð  óóˆKð ×#Ñ# F¨KÓ8ˆØÐØ×#Ñ# H´4·<±<Ð#Ô@Øˆä
Ð/Ó
0Ð0ùòw Bùò Dùò  Vùò" Ds   Â8M Å>MÇM
Ç!M
Ê1MÚ
MirrorTypeÚaboutc                 ó>  — t        j                  d«      }t        | t        «      rt        | t        «      st        | «      }n| g}| €)|�|�|j                  €t        d«      ‚|j                  g}nt        | «      }t        |d|«       |D �cg c]&  }t        j                  |«      j                  |«      ‘Œ( }}|� |j                  |d|iŽ t	        |«      }t        |D �cg c]  }|j                  dk(  ‘Œ c}«      rt!        |j"                  «      S t        |D �cg c]  }|j                  dk(  ‘Œ c}«      rt%        |j"                  «      S t        |D �cg c]  }|j                  dk(  ‘Œ c}«      rt'        |j"                  «      S |S c c}w c c}w c c}w c c}w )a›  Generic Operation: mirror

    Applies to 1, 2, and 3 dimensional objects.

    Mirror a sequence of objects over the given plane.

    Args:
        objects (Edge |  Face | Compound  or Iterable of): objects to mirror
        about (Plane, optional): reference plane. Defaults to "XZ".
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.

    Raises:
        ValueError: missing objects
    Úmirrorrr   r4   r‰   rs   r‹   )r   rD   r<   r   r!   rF   rH   rJ   r   r   Úcopy_moduleÚdeepcopyr§   rT   rt   ru   r&   r{   r*   r"   )	r1   r¥   r4   r\   r]   r=   ÚmirroredÚmirrored_compoundr^   s	            r>   r§   r§   ú  sv  € ô& &×2Ñ2°8Ó<€GÜ�'œ8Ô$¬Z¸ÄÔ-JÜ˜7“m‰à�iˆà€Øˆ?˜gÐ1°g·l±lÐ6JÜÐ7Ó8Ð8Ø—|‘|�n‰ä& wÓ/ˆä�G˜X {Ô3á?JÓK¹{¸!”×$Ñ$ QÓ'×.Ñ.¨uÕ5¸{€HÐKàÐØˆ×Ñ Ð5°Ò5ä  Ó*ÐÜ
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2ÜÐ%×-Ñ-Ó.Ð.Ü
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2ÜÐ'×/Ñ/Ó0Ð0Ü
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2ÜÐ&×.Ñ.Ó/Ð/ØÐùò Lùò 2ùâ1ùâ1s   Â+FÃ!FÄFÅFÚ
OffsetTypeÚamountÚopeningsÚkindÚsideÚclosedÚmin_edge_lengthc                 óÄ
  — t        j                  d«      }| €)|�|�|j                  €t        d«      ‚|j                  g}	nt	        | «      }	t        |d|	«       g }
g }g }|	D �]/  }t        |t        «      rm|
j                  |j                  t        «      «       |j                  |j                  t        «      «       |j                  |j                  t        «      «       Œ�t        |t        «      r|j                  |«       Œ£t        |t        «      r|j                  |«       ŒÅt        |t        «      r|
j                  |«       Œçt        |t        «      r!|
j                  |j                  «       «       �Œt!        dt#        |«      › d|› �«      ‚ g }|D �]v  }|j%                  «       j'                  ||¬«      }|�|j)                  |«      }g }|j+                  «       D ]K  }	 |j'                  | |¬«      }|�!|j                  |j)                  |«      «       n|j                  |«       ŒM t        |«      }|j/                  «       |j/                  «       z
  j0                  dkD  r| }|r�|D �cg c]  }t        |«      ‘Œ }} |j2                  |Ž }t        |t        «      r#|j                  |j5                  d¬«      «       �Œ0t        |t6        «      r|j                  |«       �ŒS|j                  |«       �Œf|j                  |«       �Œy |
rÐt9        |
«      d	k(  r‚|
d
   j:                  t<        j>                  k(  rbt        t        j@                  |
d
   dz  |
d
   dz  «      t        j@                  |
d
   dz  |
d
   dz  «      g«      j'                  ||||¬«      g}nt        |
«      j'                  ||||¬«      g}|�!|D �cg c]  }|j)                  |«      ‘Œ }}ng }t        |t        «      r|g}g }|D ]Z  }|r#|D �cg c]  }||jC                  «       v sŒ|‘Œ }}ng }|j                  |jE                  |||¬«      jG                  «       «       Œ\ ||z   |z   }|� |jH                  |d|iŽ t        |«      }tK        |	D �cg c]  }|jL                  dk(  ‘Œ c}«      rtO        |jP                  «      S tK        |	D �cg c]  }|jL                  dk(  ‘Œ c}«      rtS        |jP                  «      S tK        |	D �cg c]  }|jL                  d	k(  ‘Œ c}«      rtU        |jP                  «      S |S # t,        $ r Y �Œ^w xY wc c}w c c}w c c}w c c}w c c}w c c}w )a¯  Generic Operation: offset

    Applies to 1, 2, and 3 dimensional objects.

    Offset the given sequence of Edges, Faces, Compound of Faces, or Solids.
    The kind parameter controls the shape of the transitions. For Solid
    objects, the openings parameter allows selected faces to be open, like
    a hollow box with no lid.

    Args:
        objects (Edge |  Face |  Solid |  Compound  or Iterable of): objects to offset
        amount (float): positive values external, negative internal
        openings (list[Face], optional), sequence of faces to open in part.
            Defaults to None.
        kind (Kind, optional): transition shape. Defaults to Kind.ARC.
        side (Side, optional): side to place offset. Defaults to Side.BOTH.
        closed (bool, optional): if Side!=BOTH, close the LEFT or RIGHT
            offset. Defaults to True.
        min_edge_length (float, optional): repair degenerate edges generated by offset
            by eliminating edges of minimum length in offset wire. Defaults to None.
        mode (Mode, optional): combination mode. Defaults to Mode.REPLACE.

    Raises:
        ValueError: missing objects
        ValueError: Invalid object type
    Úoffsetrr   zUnsupported type z for )r¯   gü©ñÒMbP?Tr7   r‹   r   rC   g      à?ç      ð?)r¯   r°   r±   r4   r‰   rs   )+r   rD   rH   rJ   r   r   r<   r!   rM   rN   r#   r$   r+   rS   r-   rO   Ú	TypeErrorÚtypeÚ
outer_wireÚ	offset_2dÚfix_degenerate_edgesÚinner_wiresÚ	ExceptionÚ	normal_atr‚   ÚcutrG   r(   ÚlenÚ	geom_typer   ÚLINEÚ	make_liner˜   Ú	offset_3dÚfixrT   rt   ru   r&   r{   r*   r"   )r1   r­   r®   r¯   r°   r±   r²   r4   r\   r]   rO   r˜   Úsolidsr^   rb   rl   r¸   r»   Ú
inner_wireÚoffset_wireÚnew_faceÚwÚinner_facesÚsubtractionra   rc   rm   r=   Úopenings_in_this_solidri   Úoffset_compounds                                  r>   r´   r´   /  sã  € ôH &×2Ñ2°8Ó<€Gà€Øˆ?˜gÐ1°g·l±lÐ6JÜÐ7Ó8Ð8Ø—|‘|�n‰ä& wÓ/ˆä�G˜X {Ô3à€EØ€EØ€FÜˆÜ�cœ8Ô$Ø�L‰L˜Ÿ™¤dÓ+Ô,Ø�L‰L˜Ÿ™¤dÓ+Ô,Ø�M‰M˜#Ÿ,™,¤uÓ-Õ.Ü˜œUÔ#Ø�M‰M˜#ÕÜ˜œTÔ"Ø�L‰L˜ÕÜ˜œTÔ"Ø�L‰L˜ÕÜ˜œTÔ"Ø�L‰L˜Ÿ™›Ö%äÐ/´°S³	¨{¸%À¸uÐEÓFÐFð ð  €IÜˆØ—_‘_Ó&×0Ñ0°¸dÐ0ÓCˆ
ØÐ&Ø#×8Ñ8¸ÓIˆJØˆØ×*Ñ*Ö,ˆJð	Ø(×2Ñ2°F°7ÀÐ2ÓF�Ø"Ð.Ø×&Ñ&Ø#×8Ñ8¸ÓIõð  ×&Ñ& {Ô3øð -ô ˜
Ó#ˆØ×ÑÓ  4§>¡>Ó#3Ñ3×;Ñ;¸eÒCØ �yˆHÙÙ,7Ó8©K qœ4 �7¨KˆKÐ8Ø&˜(Ÿ,™,¨Ð4ˆKÜ˜+¤xÔ0Ø× Ñ  §¡°t Ó!<Ö=Ü˜K¬Ô3Ø× Ñ  Ö-à× Ñ  Ö-à×Ñ˜XÖ&ð= ñ> Üˆu‹:˜Š?˜u Q™x×1Ñ1´X·]±]ÒBääŸ™ u¨Q¡x°#¡~°u¸Q±xÀ#±~ÓFÜŸ™ u¨Q¡x°#¡~°u¸Q±xÀ#±~ÓFðó÷
 ‘)˜F¨°DÀ�)ÓHð‰Iô �U“×%Ñ% f°4¸dÈ6Ð%ÓRðˆIð Ð&ÙJSÓTÉ)ÀQ˜×/Ñ/°Õ@È)ˆIÑTàˆ	ä�(œDÔ!Ø�:ˆà€JÛˆÙÙ19Ó%P±¨A¸QÀ%Ç+Á+Ã-Ò=O¢a°Ð"Ñ%Pà%'Ð"Ø×ÑØ�O‰OÐ2°FÀˆOÓF×JÑJÓLõ	
ð ð ˜iÑ'¨*Ñ4€KØÐØˆ×Ñ Ð8°4Ò8ä˜{Ó+€OÜ
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2Ü�O×+Ñ+Ó,Ð,Ü
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2Ü�o×-Ñ-Ó.Ð.Ü
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2Ü�_×,Ñ,Ó-Ð-ØÐøôy ò Úðüò 9ùò2 Uùò &Qùò 2ùâ1ùâ1s=   Ç&AT4É2UÏ	U	ÐUÐUÒ
UÓUÔ UÔ4	UÕ UÚProjectTyperj   r“   c           	      ó´
  — t        j                  d«      }t        | t        «      rt	        d«      ‚| s|€t	        d«      ‚| sx|�vt        |t
        «      rf|j                  |j                  z   }g |_        g |_        t        |j                  «      dkD  r|j                  d   }g |_	        n|j                  d   }nt        | «      }|D �cg c]*  }t        |t        «      rt        |j                  «       Ž n|‘Œ, }}t        |¬«      j!                  d¬«      j"                  }|D �cg c]  }t        |t        t        f«      sŒ|‘Œ }	}|	D �
cg c]  }
t        |
«      ‘Œ }}
|D �cg c]  }t        |t$        «      sŒ|‘Œ }}|D �cg c]  }t        |t&        t(        f«      sŒ|‘Œ }}|€�|€t	        d«      ‚t        |t*        «      r1|j,                  d   }|t.        j0                  k7  rP|s|rLt	        d	«      ‚t        |t2        «      r1|j,                  d   }|t.        j0                  k7  r|s|rt	        d
«      ‚t5        t6        |«      }d}|�At        |t
        «      r1|t.        j0                  k7  r|rt	        d«      ‚|€|j8                  }d}nt%        j:                  d|z  d|z  |¬«      }|€t	        d«      ‚t=        |d«       g }||z   D ]ù  }|j?                  «       |j?                  «       z
  jA                  «       }|jC                  |«      jD                  dk  r|jF                   |z  }n|jF                  |z  }|jI                  ||«      }|sŒ…t        |t2        «      r/|jK                  |D �cg c]  }|jM                  |«      ‘Œ c}«       ŒÄt        |t*        «      r|jK                  |«       Œæ|jO                  |d   «       Œû tQ        «       }|D ]À  }
|jR                  |
z
  jA                  «       }|jC                  |«      jD                  dk  rtU        |
|jF                  |z  «       }ntU        |
|jF                  |z  «      }|jW                  |«      }t        |tT        «      rtY        d«      ‚|€Œ¡|jO                  |jM                  |«      «       ŒÂ |� |jZ                  |d|iŽ |r|}|S t        |«      }t]        |D �cg c]  }|j^                  dk(  ‘Œ c}«      rta        |jb                  «      }|S t]        |D �cg c]  }|j^                  dk(  ‘Œ c}«      rte        |jb                  «      }|S c c}w c c}w c c}
w c c}w c c}w c c}w c c}w c c}w )aÿ  Generic Operation: project

    Applies to 0, 1, and 2 dimensional objects.

    Project the given objects or points onto a BuildLine or BuildSketch workplane in
    the direction of the normal of that workplane. When projecting onto a
    sketch a Face(s) are generated while Edges are generated for BuildLine.
    Will only use the first if BuildSketch has multiple active workplanes.
    In algebra mode a workplane must be provided and the output is either
    a Face, Curve, Sketch, Compound, or ShapeList[Vector].

    Note that only if mode is not Mode.PRIVATE only Faces can be projected into
    BuildSketch and Edge/Wires into BuildLine.

    Args:
        objects (Edge |  Face |  Wire |  VectorLike |  Vertex or Iterable of):
            objects or points to project
        workplane (Plane, optional): screen workplane
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.

    Raises:
        ValueError: project doesn't accept group_by
        ValueError: Either a workplane must be provided or a builder must be active
        ValueError: Points and faces can only be projected in PRIVATE mode
        ValueError: Edges, wires and points can only be projected in PRIVATE mode
        RuntimeError: BuildPart doesn't have a project operation
    Úprojectz2project doesn't accept group_by, did you miss [n]?zNo object to projectr   )ÚchildrenF)Úoptimalz?Either a workplane must be provided or a builder must be activez6Points and faces can only be projected in PRIVATE modez=Edges, wires and points can only be projected in PRIVATE moder‹   z,Points can only be projected in PRIVATE modeéÿÿÿÿr‰   )Úplanez'A target object could not be determinedz.working_plane and projection_axis are parallelr4   rs   )3r   rD   r<   r%   rJ   r   Úpending_edgesÚpending_facesr¿   Úpending_face_planesÚexit_workplanesr   r   r,   r�   r!   rq   Údiagonalr$   r#   r-   r   rR   r   ÚPRIVATEr   r   r   ÚpartÚ	make_rectr   ÚcenterÚ
normalizedÚfrom_local_coordsrY   Úz_dirÚproject_to_shaperM   Úto_local_coordsrS   r(   Úoriginr   Ú	intersectrE   rT   rt   ru   r*   r{   r"   )r1   rj   r“   r4   r\   r]   r=   Ú
shape_listÚobject_sizeÚvct_vrt_listÚpntÚ
point_listÚ	face_listÚ	line_listÚworking_planeÚprojection_flipÚprojected_shapesr^   Úobj_to_screenÚprojection_directionÚ
projectionÚpÚprojected_pointsÚpnt_to_targetÚprojection_axisÚintersectionÚresults                              r>   rÐ   rÐ   Ã  s  € ôB &×2Ñ2°9Ó=€Gä�'œ7Ô#ÜÐMÓNÐNá�w�ÜÐ/Ó0Ð0Ù�wÐ*¬z¸'Ä9Ô/MØ×+Ñ+¨g×.CÑ.CÑCˆØ "ˆÔØ "ˆÔÜˆw×*Ñ*Ó+¨aÒ/Ø×3Ñ3°AÑ6ˆIØ*,ˆGÕ'à×/Ñ/°Ñ2‰Iä& wÓ/ˆñ
 HSóÙGRÀ!¤¨A¬vÔ!6Œ�—
‘
“Ñ¸AÑ=À{ð ð ô  JÔ/×<Ñ<ÀUÐ<ÓK×TÑT€Ká*ÓN™{˜!¬j¸¼VÄVÐ<LÕ.M’A˜{€LÐNÙ)5Ó6© #”&˜•+¨€JÐ6Ù'Ó?™K�q¬:°a¼Õ+>’˜K€IÐ?Ù'ÓG™K�q¬:°a¼$Ä¸Õ+F’˜K€IÐGàÐØˆ?ÜØQóð ô �gœyÔ)Ø×*Ñ*¨1Ñ-ˆIØ”t—|‘|Ò#©±jÜ ØLóð ô ˜¤Ô-Ø×*Ñ*¨1Ñ-ˆIØ”t—|‘|Ò#©±jÜ ØSóð ô œ 	Ó*€Mð €OØÐœz¨'´9Ô=Ø”4—<‘<Ò¡JÜÐKÓLÐLØˆ>Ø—\‘\ˆFØ‰ä—‘  K¡°°[±ÈÔVˆà€~ÜÐBÓCÐCä�G˜YÔ'àÐà˜9Ô$ˆØŸ™›¨3¯:©:«<Ñ7×CÑCÓEˆØ×*Ñ*¨=Ó9×;Ñ;¸aÒ?Ø$1×$7Ñ$7Ð#7¸/Ñ#IÑ à#0×#6Ñ#6¸Ñ#HÐ Ø×)Ñ)¨&Ð2FÓGˆ
ÚÜ˜'¤;Ô/Ø ×'Ñ'Ù?IÓJ¹z¸!�]×2Ñ2°1Õ5¸zÑJõô ˜G¤YÔ/Ø ×'Ñ'¨
Õ3à ×'Ñ'¨
°1©Õ6ð %ô" +4«+ÐÛˆØ&×-Ñ-°Ñ3×?Ñ?ÓAˆØ×*Ñ*¨=Ó9×;Ñ;¸aÒ?Ü# C¨×)<Ñ)<¸Ñ)NÓOÐO‰Oä" 3¨×(;Ñ(;¸oÑ(MÓNˆOØ$×.Ñ.¨Ó?ˆÜ�l¤DÔ)ÜÐOÓPÐPØÑ#Ø×#Ñ# M×$AÑ$AÀ,Ó$OÕPð ð ÐØˆ×ÑÐ!1Ð=¸Ò=áØ!ˆð €Mô Ð*Ó+ˆÜ©Ó5© #�—‘˜A“¨Ñ5Ô6Ü˜FŸN™NÓ+ˆFð €Mô ©;Ó7©; C�#—(‘(˜a“-¨;Ñ7Ô8Ü˜6Ÿ>™>Ó*ˆFà€Mùòuùò
 OùÚ6ùÚ?ùÚGùòd Kùò6 6ùâ7sB   Ã	/T2Ä$T7Å T7Å
T<Å"UÅ8UÆUÆUÍ,U
ÓUÓ>Ur‹   Úbyc                 ó,  — t        j                  d«      }| €)|�|�|j                  €t        d«      ‚|j                  g}nt	        | «      }t        |d|«       t        |t        t        f«      rt        |«      }n‚t        |t        «      rgt        |«      dk(  rYt        d„ |D «       «      rGt        |«      }t        |j                  dddgd|j                  ddgdd|j                   dgg d¢g«      }nt        d«      ‚g }|D ]Ÿ  }	|	€Œ|	j"                  }
|
€J ‚|	j%                  t'        t        «       «      «      }t        |t        t        f«      r!|j)                  «      j+                  |
«      }n |j-                  «      j+                  |
«      }|j/                  |«       Œ¡ |� |j0                  |d|iŽ t3        |«      }t        |D �	cg c]  }	|	j4                  dk(  ‘Œ c}	«      rt7        |j8                  «      }nwt        |D �	cg c]  }	|	j4                  d	k(  ‘Œ c}	«      rt;        |j8                  «      }n;t        |D �	cg c]  }	|	j4                  d
k(  ‘Œ c}	«      rt=        |j8                  «      }|j?                  d¬«      S c c}	w c c}	w c c}	w )a  Generic Operation: scale

    Applies to 1, 2, and 3 dimensional objects.

    Scale a sequence of objects. Note that when scaling non-uniformly across
    the three axes, the type of the underlying object may change to bspline from
    line, circle, etc.

    Args:
        objects (Edge |  Face |  Compound |  Solid or Iterable of): objects to scale
        by (float | tuple[float, float, float]): scale factor
        mode (Mode, optional): combination mode. Defaults to Mode.REPLACE.

    Raises:
        ValueError: missing objects
    Úscalerr   r‰   c              3   óH   K  — | ]  }t        |t        t        f«      –— Œ y ­wr;   )r<   rU   rV   )Ú.0Úss     r>   Ú	<genexpr>zscale.<locals>.<genexpr>{  s   è ø€ Ð8±R°”
˜1œs¤E˜l×+±Rùs   ‚ "rC   )rC   rC   rC   rµ   z,by must be a float or a three tuple of floatr4   rs   r‹   Fr7   ) r   rD   rH   rJ   r   r   r<   rU   rV   rI   r¿   rt   r   r   rw   rx   rY   rg   Úlocatedr   rú   ÚlocateÚtransform_geometryrS   rT   r!   ru   r&   r{   r*   r"   rG   )r1   rø   r4   r\   r]   ÚfactorÚ	by_vectorÚscale_matrixri   r^   Úcurrent_locationÚobj_at_originÚ
new_objectÚscale_compounds                 r>   rú   rú   V  sY  € ô* &×2Ñ2°7Ó;€Gà€Øˆ?˜gÐ1°g·l±lÐ6JÜÐ7Ó8Ð8Ø—|‘|�n‰ä& wÓ/ˆä�G˜W kÔ2ä�"”sœE�lÔ#Ü�r“‰ä�2œÔÜ�‹G�qŠLÜÑ8±RÓ8Ô8ä˜2“Jˆ	Üà—‘˜c 3¨Ð,Ø�i—k‘k 3¨Ð,Ø�c˜9Ÿ;™;¨Ð,Ú$ð	ó
‰ô ÐGÓHÐHà€KÛˆØˆ;ØØŸ<™<ÐØÐ+Ð+Ð+ØŸ™¤H¬V«XÓ$6Ó7ˆÜ�bœ3¤˜,Ô'Ø&×,Ñ,¨VÓ4×;Ñ;Ð<LÓM‰Jà&×9Ñ9¸,ÓG×NÑNØ óˆJð 	×Ñ˜:Õ&ð ð ÐØˆ×Ñ Ð8°4Ò8ä˜kÓ*€NÜ
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2Ü˜n×4Ñ4Ó5‰Ü	¡{Ó3¡{ ˆc�h‰h˜!‹m {Ñ3Ô	4Ü × 6Ñ 6Ó7‰Ü	¡{Ó3¡{ ˆc�h‰h˜!‹m {Ñ3Ô	4Ü˜~×5Ñ5Ó6ˆØ× Ñ  uÐ Ó-Ð-ùò 2ùâ3ùâ3s   ÇJÈJÉJÚ	SplitTypeÚ	bisect_byÚkeepc                 ó~  — t        j                  d«      }| €)|�|�|j                  €t        d«      ‚|j                  g}nt	        | «      }t        |d|«       g }|D ]~  }d}|t        j                  k(  r|j                  ||«      \  }	}n|j                  ||«      }	|	|fD ]8  }
t        |
t        «      r|j                  |
«       Œ%|
€Œ(|j                  |
«       Œ: Œ€ |� |j                  |d|iŽ t        |«      }t        |D �cg c]  }|j                   dk(  ‘Œ c}«      rt#        |j$                  «      S t        |D �cg c]  }|j                   dk(  ‘Œ c}«      rt'        |j$                  «      S t        |D �cg c]  }|j                   dk(  ‘Œ c}«      rt)        |j$                  «      S |S c c}w c c}w c c}w )a(  Generic Operation: split

    Applies to 1, 2, and 3 dimensional objects.

    Bisect object with plane and keep either top, bottom or both.

    Args:
        objects (Edge |  Wire |  Face |  Solid or Iterable of), objects to split
        bisect_by (Plane |  Face, optional): plane to segment part.
            Defaults to Plane.XZ.
        keep (Keep, optional): selector for which segment to keep. Defaults to Keep.TOP.
        mode (Mode, optional): combination mode. Defaults to Mode.REPLACE.

    Raises:
        ValueError: missing objects
    ÚsplitNrr   r4   r‰   rs   r‹   )r   rD   rH   rJ   r   r   r   ÚBOTHr  r<   r   rM   rS   rT   r!   rt   ru   r&   r{   r*   r"   )r1   r
  r  r4   r\   r]   ri   r^   ÚbottomÚtopÚsubpartÚsplit_compounds               r>   r  r  ©  sŸ  € ô, &×2Ñ2°7Ó;€Gà€Øˆ?˜gÐ1°g·l±lÐ6JÜÐ7Ó8Ð8Ø—|‘|�n‰ä& wÓ/ˆä�G˜W kÔ2à#%€KÛˆØˆØ”4—9‘9ÒØŸ)™) I¨tÓ4‰KˆC‘à—)‘)˜I tÓ,ˆCØ˜V“}ˆGÜ˜'¤8Ô,Ø×"Ñ" 7Õ+ØÑ$Ø×"Ñ" 7Õ+ñ	 %ð ð ÐØˆ×Ñ Ð8°4Ò8ä˜kÓ*€NÜ
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2Ü�N×*Ñ*Ó+Ð+Ü
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2Ü�n×,Ñ,Ó-Ð-Ü
¡[Ó1¡[˜cˆC�H‰H˜‹M [Ñ1Ô2Ü�^×+Ñ+Ó,Ð,ØÐùò 2ùâ1ùâ1s   ÄF0ÅF5Å<F:Ú	SweepTypeFÚsectionsÚpathÚmultisectionÚ	is_frenetÚ
transitionÚnormalÚbinormalc	                 ón  — t        j                  d«      }	t        | t        t        t
        f«      rg | ¢n| g}
|
D �cg c]  }|€Œ|‘Œ	 }
}t        |	d|
«       |€L|	�"t        |	t        t        f«      r|	j                  st        d«      ‚t        |	j                  «      }g |	_	        nHt        |t        «      r	 t        |«      }n+t        |t        «      st        |j                  «       «      n|}|
sD|	�7t        |	t        «      r'|	j                  r|	j                  }
g |	_        g |	_        nt        d«      ‚g }g }|
D ]\  }t        |t         t        t"        f«      r |j%                  |j                  «       «       Œ>|j%                  |j'                  «       «       Œ^ g }|r‘|€|�t)        |«      }nt        |t"        «      rt        |g«      }n|}|r8|D �cg c]  }|j+                  «       ‘Œ } }t-        j.                  | |d||«      g}n(|D �cg c]  }t-        j0                  ||d|||¬«      ‘Œ }}g }|r=|
D ]8  }t3        j0                  |||«      }|j%                  |j'                  «       «       Œ: |	� |	j4                  ||z   ||dœŽ n<|r:|D �cg c]  }|j7                  «       ‘Œ }}|D �cg c]  }|j7                  «       ‘Œ }}|rt9        t;        |«      j<                  «      S t?        t;        |«      j<                  «      S c c}w # t        $ r}t        d«      |‚d}~ww xY wc c}w c c}w c c}w c c}w )	a{  Generic Operation: sweep

    Sweep pending 1D or 2D objects along path.

    Args:
        sections (Compound |  Edge |  Wire |  Face |  Solid): cross sections to sweep into object
        path (Curve |  Edge |  Wire, optional): path to follow.
            Defaults to context pending_edges.
        multisection (bool, optional): sweep multiple on path. Defaults to False.
        is_frenet (bool, optional): use frenet algorithm. Defaults to False.
        transition (Transition, optional): discontinuity handling option.
            Defaults to Transition.TRANSFORMED.
        normal (VectorLike, optional): fixed normal. Defaults to None.
        binormal (Edge |  Wire, optional): guide rotation along path. Defaults to None.
        clean (bool, optional): Remove extraneous internal structure. Defaults to True.
        mode (Mode, optional): combination. Defaults to Mode.ADD.
    ÚsweepNzpath must be providedzUnable to build path from edgeszNo sections providedT)Úsectionr  Ú
make_solidr  r4   r  rB   ) r   rD   r<   rF   rI   rL   r   r   r   rÕ   rJ   r-   r   rO   rÖ   r×   r"   r#   rM   r˜   r   r¸   r+   Úsweep_multir  r)   rT   r3   r&   r!   r{   r*   )r  r  r  r  r  r  r  r3   r4   r\   Úsection_listÚsecÚ	path_wireÚerrÚ	edge_listrê   rc   Úbinormal_moderl   rb   Úsweptrm   s                         r>   r  r  è  s  € ô8 &×2Ñ2°7Ó;€Gô " (¬T´5¼&Ð,AÔBˆˆ(‰ÈÈ
ð ñ $0ÓC¡<˜C°3±?’C <€LÐCä�G˜W lÔ3à€|àˆOÜ˜g¬	´;Ð'?Ô@Ø×(Ò(äÐ4Ó5Ð5Ü˜×.Ñ.Ó/ˆ	Ø "ˆÕä�dœHÔ%ðMÜ  ›J‘	ô 3=¸TÄ4Ô2Hœ˜TŸZ™Z›\Ô*ÈdˆIáàÐÜ˜7¤IÔ.Ø×%Ò%à"×0Ñ0ˆLØ$&ˆGÔ!Ø*,ˆGÕ'äÐ3Ó4Ð4à€IØ€IÛˆÜ�cœE¤4¬Ð.Ô/Ø×Ñ˜SŸY™Y›[Õ)à×Ñ˜SŸY™Y›[Õ)ð	 ð €JáØÐ Ð 2Ü" 6›N‰MÜ˜¤$Ô'Ü  ( Ó,‰Mà$ˆMÙÙ6?Ó@±i¨d˜Ÿ™Õ)°iˆHÐ@ä×!Ñ! (¨I°t¸YÈÓVð‰Jñ &ó
ñ &�Dô —‘Ø Ø"Ø#Ø'Ø&Ø)öð &ð ð 
ð €IÙÛˆCÜ—K‘K  Y°
Ó;ˆEØ×Ñ˜UŸ[™[›]Õ+ð  ð ÐØˆ×Ñ *¨yÑ"8ÀÈTÔRÙ	Ù1;Ó<±¨�e—k‘k•m°ˆ
Ð<Ù.7Ó8©i d�T—Z‘Z•\¨iˆ	Ð8áÜ”H˜ZÓ(×0Ñ0Ó1Ð1Ü”(˜9Ó%×-Ñ-Ó.Ð.ùòk Døô" ò MÜ Ð!BÓCÈÐLûðMüòH Aùò

ùò, =ùÚ8s;   ¼LÁLÂ6L ÇL#È	"L(ÊL-Ê*L2Ì	L ÌLÌL )NNN)_Ú__doc__Úcopyr¨   ÚloggingÚmathr   r   Útypingr   r   Úcollections.abcr   Úbuild123d.build_commonr   r	   r
   r   r   Úbuild123d.build_enumsr   r   r   r   r   r   Úbuild123d.build_liner   Úbuild123d.build_partr   Úbuild123d.build_sketchr   Úbuild123d.geometryr   r   r   r   r   r   r   r   Úbuild123d.objects_partr   Úbuild123d.objects_sketchr   Úbuild123d.objects_curver    Úbuild123d.topologyr!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   Ú	getLoggerÚ
addHandlerÚNullHandlerÚloggerr0   Ú__annotations__ÚADDrV   Úboolr9   rÚ   rq   r�   r‡   r¡   r¤   ÚXZr§   r¬   ÚARCr  r—   rF   r´   rÎ   rÐ   rI   rú   r	  ÚTOPr  r  ÚTRANSFORMEDr  © r@   r>   Ú<module>rC     sò  ðòó: Û ß ß "å $÷õ ÷ O× NÝ *Ý *Ý .÷	÷ 	ó 	õ 2Ý 5Ý 2÷÷ ÷ ÷ ð" €× Ñ �+Ó × )Ñ )Ð*=¨'×*=Ñ*=Ó*?Ô @Ø	ˆ×	Ñ	˜;Ó	'€à˜D‘[ 4Ñ'¨%Ñ/°(Ñ:¸WÑD€ˆÓ DØ 5ð
 -1ØØ—‘ñ	y!Ø�x Ñ(Ñ(ðy!à�lÑ" TÑ)ðy!ð ðy!ð ð	y!ð
 óy!ðz /3Ø—‘ñ:/Ø�X˜e‘_Ñ$ tÑ+ð:/à
ð:/ð ˆd�]ó:/ðz  $ f™}Ð �9Ó ,Ø 8ð !ØØ$(ñz1Ø Ð*;Ñ!<Ñ<ðz1àðz1ð �T‰\ðz1ð �4‰<ð	z1ð
 �d‰{˜TÑ!ðz1ð ˆd�]óz1ðzd1Ø Ð*;Ñ!<Ñ<ðd1àðd1ð ˆd�]�UÑód1ðN ˜t™ dÑ*¨XÑ5¸Ñ=ÀÑFÈÑM€
ˆIÓ MØ +ð 9=Ø—8‘8Ø—‘ñ.Ø˜( :Ñ.Ñ.°Ñ5ð.àð.ð ð.ð ˆV�^�dÑ˜XÑ%ó	.ðb ˜t™ eÑ+¨hÑ6€
ˆIÓ 6Ø )ð 9=ØØ)-Ø—‘Ø—‘ØØ$(Ø—‘ñMØ˜( :Ñ.Ñ.°Ñ5ðMàðMð �T˜$‘ZÑ $Ñ&ðMð ð	Mð
 ðMð ðMð ˜T‘\ðMð ðMð ˆV�^�dÑ˜XÑ%óMð`  ™ tÑ+¨fÑ4°vÑ=€ˆYÓ =Ø ,ð ;?Ø"Ø-1Ø—‘ñ	PØ˜8 KÑ0Ñ0°4Ñ7ðPà�t‰|ðPð �HÑ˜tÑ# dÑ*ðPð ð	Pð
 ˆV�^�hÑ ¨6Ñ!2Ñ2óPðh /3Ø-.Ø—‘ñL.Ø�X˜e‘_Ñ$ tÑ+ðL.à��e˜U EÐ)Ñ*Ñ*ðL.ð ðL.ð ˆV�^�dÑ˜XÑ%ó	L.ð^ ˜d‘{ TÑ)¨EÑ1€	ˆ9Ó 1Ø (ð 7;Ø&+§h¡hØ—‘Ø—‘ñ	8Ø˜ )Ñ,Ñ,¨tÑ3ð8à�t‰|˜eÑ#ð8ð ð8ð ó	8ðv   $‘¨Ñ-°Ñ4°uÑ<€	ˆ9Ó <Ø (ð 8<Ø8<ØØØ'×3Ñ3Ø $Ø#'ØØ—‘ñv/Ø˜( 9Ñ-Ñ-°Ñ4ðv/à
�$‰,˜Ñ
 ¨¡Ñ
.°Ñ
5ðv/ð ðv/ð ð	v/ð
 ðv/ð ˜Ñðv/ð �T‰k˜DÑ ðv/ð ðv/ð ðv/ð 
ˆF�]ôv/r@   