
    ^j                    t    d Z ddl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  G d dee         Zy	)
a  
BuildLine

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

desc:
    This python module is a library used to build lines in three dimensional space.

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WorkplaneListlogger)Mode)LocationPlane)CurveEdgeFacec                      e Zd ZdZd ZdZeZeZ	e
j                  ej                  f	 	 	 d fdZedd       Zej"                  dd       Zedd       Zej"                  dd       Zd Zd	 Zd
 Zd Zd ZddddZ xZS )	BuildLinea  BuildLine

    The BuildLine class is a subclass of Builder for building lines (objects
    with length but not area or volume). It has an _obj property that returns
    the current line being built. The class overrides the faces and solids methods
    of Builder since they don't apply to lines.

    BuildLine only works with a single workplane which is used to convert tuples
    as inputs to global coordinates. For example:

    .. code::

        with BuildLine(Plane.YZ) as radius_arc:
            RadiusArc((1, 2), (2, 1), 1)

    creates an arc from global points (0, 1, 2) to (0, 2, 1). Note that points
    entered as Vector(x, y, z) are considered global and are not localized.

    The workplane is also used to define planes parallel to the workplane that
    arcs are created on.

    Args:
        workplane (Union[Face, Plane, Location], optional): plane used when local
            coordinates are used and when creating arcs. Defaults to Plane.XY.
        mode (Mode, optional): combination mode. Defaults to Mode.ADD.
    linec                |    d | _         t        | 	  ||       t        | j                        dkD  rt        d      y )Nmode   z$BuildLine only accepts one workplane)_linesuper__init__len
workplanes
ValueError)self	workplaner   	__class__s      M/opt/ringagent/.cad-venv/lib/python3.12/site-packages/build123d/build_line.pyr   zBuildLine.__init__F   s@    
 $(
.t!#CDD $    c                    | j                   S )zGet the current liner   r   s    r   r   zBuildLine.lineP        zzr   c                    || _         yzSet the current lineNr    r   values     r   r   zBuildLine.lineU        
r   c                    | j                   S )zAlias _obj to liner    r!   s    r   _objzBuildLine._objZ   r"   r   c                    || _         yr$   r    r%   s     r   r)   zBuildLine._obj_   r'   r   c                j   | j                   j                  | j                         | j                  | j                  t
        j                  k7  rp| j                  dt        j                  dt        | j                        j                         | j                  j                  | j                  | j                         t        j                         j                  | _        | j                  r| j"                  j%                  ddd       t        j&                  dt        |       j                         y)z6Upon exiting restore context and send object to parentNzTransferring object(s) to %sr   z
Exiting %s)_currentreset
_reset_tokbuilder_parentr   r   PRIVATEr   r   debugtype__name___add_to_contextr   _get_contextr   exit_workplanesworkplanes_context__exit__info)r   exception_typeexception_value	tracebacks       r   r8   zBuildLine.__exit__d   s    DOO, +		T\\)		%LL.T5H5H0I0R0R //				/J,99;FF ??##,,T4>L$t*"5"56r   c                    t        d      )zfaces() not implementedz"faces() doesn't apply to BuildLineNotImplementedErrorr   argss     r   faceszBuildLine.faces{       !"FGGr   c                    t        d      )zface() not implementedz!face() doesn't apply to BuildLiner>   r@   s     r   facezBuildLine.face   s    !"EFFr   c                    t        d      )zsolids() not implementedz#solids() doesn't apply to BuildLiner>   r@   s     r   solidszBuildLine.solids   s    !"GHHr   c                    t        d      )zsolid() not implementedz"solid() doesn't apply to BuildLiner>   r@   s     r   solidzBuildLine.solid   rC   r   N)
face_planec                   t        d      )z_add_to_pending not implementedz*_add_to_pending doesn't apply to BuildLiner>   )r   rJ   objectss      r   _add_to_pendingzBuildLine._add_to_pending   s    !"NOOr   )r   zFace | Plane | Locationr   r   )returnzCurve | None)r&   r
   rN   None)rL   zEdge | FacerJ   zPlane | None)r3   
__module____qualname____doc___tag	_obj_namer   _shaper
   
_sub_classr	   XYr   ADDr   propertyr   setterr)   r8   rB   rE   rG   rI   rM   __classcell__)r   s   @r   r   r   %   s    6 DIFJ .3XXXXE*E E   
[[    
[[ 7.HGIH QU P Pr   r   N)rR   
__future__r   build123d.build_commonr   r   r   build123d.build_enumsr   build123d.geometryr   r	   build123d.topologyr
   r   r   r    r   r   <module>rb      s5   8 # A A & . 0 0hP hPr   