
    'j\                        d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZmZ erd dlmZ dZd	Zd
ZdZdZdZdZdZdZd/dZd0dZd/dZd1dZd2dZd/dZd/d Zd/d!Z d3d"Z!d4d%Z"d5d6d(Z#d7d-Z$d.S )8    )annotations)TYPE_CHECKING)const	validator)BoundingBox)bbox)EndCaps	JoinStyle)Drawingz$CLAYERz$CECOLORz$CELTYPEz
$CELWEIGHTz
$CELTSCALEz
$TEXTSTYLEz	$DIMSTYLEz$EXTMINz$EXTMAXdocr   namestrc                f    || j         vrt          j        d| d          || j        t          <   dS )zSet current layer.zundefined layer: ""N)layersr   DXFValueErrorheaderCURRENT_LAYERr   r   s     K/DATA/AppData/hermes/venv/lib/python3.11/site-packages/ezdxf/appsettings.pyset_current_layerr      s>    3:!">t">">">??? $CJ}    colorintc                |    t          j        |          st          j        d| d          || j        t
          <   dS )zSet current :ref:`ACI`.zinvalid ACI color value: "r   N)r   is_valid_aci_colorr   r   r   CURRENT_COLOR)r   r   s     r   set_current_colorr   !   sE    '.. I!"Gu"G"G"GHHH %CJ}r   c                f    || j         vrt          j        d| d          || j        t          <   dS )zSet current linetype.zundefined linetype: "r   N)	linetypesr   r   r   CURRENT_LINETYPEr   s     r   set_current_linetyper"   (   ?    3=  !"A$"A"A"ABBB#'CJ   r   
lineweightc                |    t          j        |          st          j        d| d          || j        t
          <   dS )zSSet current lineweight, see :ref:`lineweights` reference for valid
    values.
    zinvalid lineweight value: "r   N)r   is_valid_lineweightr   r   r   CURRENT_LINEWEIGHT)r   r$   s     r   set_current_lineweightr(   /   sH     (44 O!"M
"M"M"MNNN%/CJ!"""r   scalefloatc                `    |dk    rt          j        d| d          || j        t          <   dS )zSet current linetype scale.g        zinvalid linetype scale: "r   N)r   r   r   CURRENT_LINETYPE_SCALE)r   r)   s     r   set_current_linetype_scaler-   8   s;    ||!"Fe"F"F"FGGG).CJ%&&&r   c                f    || j         vrt          j        d| d          || j        t          <   dS )zSet current text style.zundefined textstyle: "r   N)stylesr   r   r   CURRENT_TEXTSTYLEr   s     r   set_current_textstyler1   ?   s?    3:!"B4"B"B"BCCC$(CJ !!!r   c                f    || j         vrt          j        d| d          || j        t          <   dS )zSet current dimstyle.zundefined dimstyle: "r   N)	dimstylesr   r   r   CURRENT_DIMSTYLEr   s     r   set_current_dimstyler5   F   r#   r   c                    t          | |           | j                            |          }|                    |            dS )zLSet current dimstyle and copy all dimstyle attributes to the HEADER section.N)r5   r3   getcopy_to_header)r   r   dimstyles      r   set_current_dimstyle_attribsr:   M   sA    d###}  &&HC     r   c                    | j                                          | j                            d          D ]}|                                 dS )ztRestore the UCS settings in the HEADER section to the :ref:`WCS` and
    reset all active viewports to the WCS.
    z*ActiveN)r   	reset_wcs	viewports
get_config)r   vports     r   restore_wcsr@   T   sT     J)))44   r   returnr   c                    |                                  }t          j        |d          }|j        rJ|j        |j        _        |j        |j        _        |j        | j        t          <   |j        | j        t          <   |S )a  Calculate the extents of the model space, update the HEADER variables
    $EXTMIN and $EXTMAX and returns the result as :class:`ezdxf.math.BoundingBox`.
    Note that this function uses the :mod:`ezdxf.bbox` module to calculate the
    extent of the model space. This module is not very fast and not very
    accurate for text and ignores all :term:`ACIS` based entities.

    The function updates only the values in the HEADER section, to zoom the
    active viewport to this extents, use this recipe::

        import ezdxf
        from ezdxf import zoom, appsettings

        doc = ezdxf.readfile("your.dxf")
        extents = appsettings.update_extents(doc)
        zoom.center(doc.modelspace(), extents.center, extents.size)

    .. seealso::

        - the :mod:`ezdxf.bbox` module to understand the limitations of the
          extent calculation
        - the :mod:`ezdxf.zoom` module

    T)fast)

modelspacer   extentshas_dataextmindxfextmaxr   EXTMINEXTMAX)r   msprE   s      r   update_extentsrM   ]   si    0 ..

Cl3T***G ,  $^
6$^
6Nr   TNonec                4    t          |          | j        d<   dS )z}The CAD application or DXF viewer should show lines and curves with
    "thickness" (lineweight) if `state` is ``True``.
    z
$LWDISPLAYNr   r   )r   states     r   show_lineweightrR      s      #5zzCJ|r   end_capsr	   
join_styler
   c                b    t          |          | j        d<   t          |          | j        d<   dS )zSet the style of end caps and joints for linear entities when displaying
    line weights. These settings only affect objects created afterwards.
    z$ENDCAPSz
$JOINSTYLENrP   )r   rS   rT   s      r   set_lineweight_display_stylerV      s.     !]]CJz":CJ|r   N)r   r   r   r   )r   r   r   r   )r   r   r$   r   )r   r   r)   r*   )r   r   )r   r   rA   r   )T)r   r   rA   rN   )r   r   rS   r	   rT   r
   rA   rN   )%
__future__r   typingr   ezdxf.lldxfr   r   
ezdxf.mathr   ezdxfr   ezdxf.enumsr	   r
   ezdxf.documentr   r   r   r!   r'   r,   r0   r4   rJ   rK   r   r   r"   r(   r-   r1   r5   r:   r@   rM   rR   rV    r   r   <module>r_      s   # " " " " "             ( ( ( ( ( ( ( ( " " " " " "       * * * * * * * * '&&&&&& ! %    		% % % %& & & &( ( ( (0 0 0 0/ / / /) ) ) )( ( ( (! ! ! !      D* * * * */ / / / / /r   