
    h\                       S SK Jr  S SKJr  S SKJrJr  S SKJr  S SK	J
r
  S SKJrJr  \(       a  S SKJr  SrS	rS
rSrSrSrSrSrSrSS jrSS jrSS jrS S jrS!S jrSS jrSS jrSS jr S"S jr!S#S jr"S$S%S jjr#        S&S jr$g)'    )annotations)TYPE_CHECKING)const	validator)BoundingBox)bbox)EndCaps	JoinStyle)Drawingz$CLAYERz$CECOLORz$CELTYPEz
$CELWEIGHTz
$CELTSCALEz
$TEXTSTYLEz	$DIMSTYLEz$EXTMINz$EXTMAXc                z    XR                   ;  a  [        R                  " SU S35      eXR                  [        '   g)zSet current layer.zundefined layer: ""N)layersr   DXFValueErrorheaderCURRENT_LAYERdocnames     C/var/www/html/env/lib/python3.13/site-packages/ezdxf/appsettings.pyset_current_layerr      s3    ::!!$6tfA">?? $JJ}    c                    [         R                  " U5      (       d  [        R                  " SU S35      eXR                  [
        '   g)zSet current :ref:`ACI`.zinvalid ACI color value: "r   N)r   is_valid_aci_colorr   r   r   CURRENT_COLOR)r   colors     r   set_current_colorr   !   s:    ''..!!$>ugQ"GHH %JJ}r   c                z    XR                   ;  a  [        R                  " SU S35      eXR                  [        '   g)zSet current linetype.zundefined linetype: "r   N)	linetypesr   r   r   CURRENT_LINETYPEr   s     r   set_current_linetyper    (   4    == !!$9$q"ABB#'JJ r   c                    [         R                  " U5      (       d  [        R                  " SU S35      eXR                  [
        '   g)zKSet current lineweight, see :ref:`lineweights` reference for valid
values.
zinvalid lineweight value: "r   N)r   is_valid_lineweightr   r   r   CURRENT_LINEWEIGHT)r   
lineweights     r   set_current_lineweightr&   /   s=     ((44!!$?
|1"MNN%/JJ!"r   c                h    US::  a  [         R                  " SU S35      eXR                  [        '   g)zSet current linetype scale.g        zinvalid linetype scale: "r   N)r   r   r   CURRENT_LINETYPE_SCALE)r   scales     r   set_current_linetype_scaler*   8   s1    |!!$=eWA"FGG).JJ%&r   c                z    XR                   ;  a  [        R                  " SU S35      eXR                  [        '   g)zSet current text style.zundefined textstyle: "r   N)stylesr   r   r   CURRENT_TEXTSTYLEr   s     r   set_current_textstyler.   ?   s4    ::!!$:4&"BCC$(JJ !r   c                z    XR                   ;  a  [        R                  " SU S35      eXR                  [        '   g)zSet current dimstyle.zundefined dimstyle: "r   N)	dimstylesr   r   r   CURRENT_DIMSTYLEr   s     r   set_current_dimstyler2   F   r!   r   c                r    [        X5        U R                  R                  U5      nUR                  U 5        g)zLSet current dimstyle and copy all dimstyle attributes to the HEADER section.N)r2   r0   getcopy_to_header)r   r   dimstyles      r   set_current_dimstyle_attribsr7   M   s,    #}}  &HC r   c                    U R                   R                  5         U R                  R                  S5       H  nUR                  5         M     g)zlRestore 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   s7     JJ)))4 5r   c                R   U R                  5       n[        R                  " USS9nUR                  (       ap  UR                  UR
                  l        UR                  UR
                  l        UR                  U R                  [        '   UR                  U R                  [        '   U$ )aB  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   msprA   s      r   update_extentsrI   ]   sp    0 ..
Cll3T*G  $^^

6$^^

6Nr   c                4    [        U5      U R                  S'   g)zuThe CAD application or DXF viewer should show lines and curves with
"thickness" (lineweight) if `state` is ``True``.
z
$LWDISPLAYNintr   )r   states     r   show_lineweightrN      s      #5zCJJ|r   c                d    [        U5      U R                  S'   [        U5      U R                  S'   g)zSet the style of end caps and joints for linear entities when displaying
line weights. These settings only affect objects created afterwards.
z$ENDCAPSz
$JOINSTYLENrK   )r   end_caps
join_styles      r   set_lineweight_display_stylerR      s(     !]CJJz":CJJ|r   N)r   r   r   str)r   r   r   rL   )r   r   r%   rL   )r   r   r)   float)r   r   )r   r   returnr   )T)r   r   rU   None)r   r   rP   r	   rQ   r
   rU   rV   )%
__future__r   typingr   ezdxf.lldxfr   r   
ezdxf.mathr   ezdxfr   ezdxf.enumsr	   r
   ezdxf.documentr   r   r   r   r$   r(   r-   r1   rF   rG   r   r   r    r&   r*   r.   r2   r7   r=   rI   rN   rR    r   r   <module>r_      s    #   ( "  *& ! %    		%&(0/)(!D*/	/#/1:/	/r   