Ë
    Jÿié  ã                  óv   — d Z ddlmZ ddl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  G d„ de«      Zy	)
a  
BuildPart

name: build_part.py
by:   Gumyr
date: July 12th 2022

desc:
    This python module is a library used to build 3D parts.

TODO:
- add TwistExtrude, ProjectText

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.

é    )Úannotations)ÚBuilderÚlogger)ÚMode)ÚLocationÚPlane)ÚEdgeÚFaceÚJointÚPartÚSolidÚWirec                  óÈ   ‡ — e Zd ZdZd ZdZeZeZ	e
j                  dœ	 	 	 dˆ fd„Zedd„«       Zej                  dd„«       ZeZedd„«       Zedd„«       Zd	d
œdd„Zd„ Zˆ xZS )Ú	BuildPartaH  BuildPart

    The BuildPart class is another subclass of Builder for building parts
    (objects with the property of volume) from sketches or 3D objects.
    It has an _obj property that returns the current part being built, and
    several pending lists for storing faces, edges, and planes that will be
    integrated into the final part later. The class overrides the _add_to_pending
    method of Builder.

    Args:
        workplanes (Plane, optional): initial plane to work on. Defaults to Plane.XY.
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.
    Úpart)Úmodec               óx   •— i | _         d | _        g | _        g | _        g | _        g | _        t        ‰| �  |d|iŽ y )Nr   )ÚjointsÚ_partÚpending_facesÚpending_face_planesÚpending_planesÚpending_edgesÚsuperÚ__init__)Úselfr   Ú
workplanesÚ	__class__s      €úe/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/build123d/build_part.pyr   zBuildPart.__init__<   sE   ø€ ð
 )+ˆŒØ"&ˆŒ
Ø)+ˆÔØ02ˆÔ Ø+-ˆÔØ)+ˆÔÜ‰Ñ˜*Ð0¨4Ó0ó    c                ó   — | j                   S )zGet the current part©r   ©r   s    r   r   zBuildPart.partI   s   € ð �z‰zÐr    c                ó   — || _         y)zSet the current partNr"   )r   Úvalues     r   r   zBuildPart.partN   s   € ð ˆ�
r    c                óF   — t        j                  | j                  «      d   S )z1Return a wire representation of the pending edgesr   )r   Úcombiner   r#   s    r   Úpending_edges_as_wirezBuildPart.pending_edges_as_wireU   s   € ô �|‰|˜D×.Ñ.Ó/°Ñ2Ð2r    c                óZ   — | j                   �| j                   j                  S t        «       S )zBuilder's location)r   Úlocationr   r#   s    r   r*   zBuildPart.locationZ   s$   € ð &*§Y¡YÐ%:ˆt�y‰y×!Ñ!ÐJÄÃ
ÐJr    N)Ú
face_planec               óÞ  — |D �cg c]  }t        |t        «      sŒ|‘Œ }}|D ]\  }t        j                  d|j                  |«       | j
                  j                  |«       |€ŒB| j                  j                  |«       Œ^ |D �cg c]  }t        |t        «      sŒ|‘Œ }}|D ]=  }t        j                  d|j                  «       | j                  j                  |«       Œ? yc c}w c c}w )z‚Add objects to BuildPart pending lists

        Args:
            objects (Union[Edge, Face]): sequence of objects to add
        z;Adding Face to pending_faces at %s on pending_face_plane %sNz"Adding Edge to pending_edges at %s)
Ú
isinstancer
   r   Údebugr*   r   Úappendr   r	   r   )r   r+   ÚobjectsÚoÚ	new_facesÚfaceÚ	new_edgesÚedges           r   Ú_add_to_pendingzBuildPart._add_to_pending_   sÕ   € ñ !(Ó?¡˜1¬:°a¼Õ+>’Q ˆ	Ð?ÛˆDÜ�L‰LØMØ—‘Øôð
 ×Ñ×%Ñ% dÔ+ØÑ%Ø×(Ñ(×/Ñ/°
Õ;ð ñ !(Ó?¡˜1¬:°a¼Õ+>’Q ˆ	Ð?ÛˆDÜ�L‰LØ4Ø—‘ôð ×Ñ×%Ñ% dÕ+ñ ùò @ùò @s   …C%›C%ÂC*ÂC*c                óÈ   — | j                   rV| j                   | j                  _         | j                  j                   j                  «       D ]  }| j                  |_        Œ yy)zTransfer joints on exitN)r   r   ÚvaluesÚparent)r   Újoints     r   Ú_exit_extraszBuildPart._exit_extrasx   sF   € à�;Š;Ø#Ÿ{™{ˆD�I‰IÔØŸ™×)Ñ)×0Ñ0Ö2�Ø#Ÿy™y�•ñ 3ð r    )r   zFace | Plane | Locationr   r   )ÚreturnzPart | None)r%   r   r<   ÚNone)r<   r   )r<   zLocation | None)r0   zEdge | Facer+   zPlane | None)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú_tagÚ	_obj_namer   Ú_shaper   Ú
_sub_classr   ÚADDr   Úpropertyr   ÚsetterÚ_objr(   r*   r6   r;   Ú__classcell__)r   s   @r   r   r   (   sª   ø„ ñð €DØ€IØ€FØ€Jð
 —X‘Xñ1à,ð1ð õ1ð òó ðð 
‡[�[òó ðð €Dàò3ó ð3ð òKó ðKð QUõ ,ö2)r    r   N)rA   Ú
__future__r   Úbuild123d.build_commonr   r   Úbuild123d.build_enumsr   Úbuild123d.geometryr   r   Úbuild123d.topologyr	   r
   r   r   r   r   r   © r    r   Ú<module>rQ      s,   ðñõ> #ç 2Ý &ß .ß C× CôU)�õ U)r    