
    ho                     j    S SK Jr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JrJr   " S S\	5      rg	)
    )IterableOptional)Vec3UVec)const   )
BaseLayout)
DXFGraphicAttDefBlockEndBlkc                      \ rS rSrSrS\4S jr\S\\	   4S j5       r
\S\\   4S j5       r\S\4S j5       r\R                  SS	 j5       r\S
 5       r\S\4S j5       r\R                  S\4S j5       r\S\4S j5       r\R                  S\4S j5       r\S\4S j5       r\R                  S\SS4S j5       rS\\   4S jrS\S\4S jrS\S\\   4S jrSS\S\S\4S jjrS\\   4S jrS\4S jrS rSrg)BlockLayout
   zBlockLayout has the same factory-functions as Layout, but is managed
in the :class:`BlocksSection` class. It represents a DXF Block.

returnc                 f    [        U[        5      (       a  U R                  U   nXR                  ;   $ )zuReturns ``True`` if block contains `entity`.

Args:
     entity: :class:`DXFGraphic` object or handle as hex string

)
isinstancestrentitydbentity_space)selfentitys     K/var/www/html/env/lib/python3.13/site-packages/ezdxf/layouts/blocklayout.py__contains__BlockLayout.__contains__   s.     fc""]]6*F****    c                 .    U R                   R                  $ )z5the associated :class:`~ezdxf.entities.Block` entity.)block_recordblockr   s    r   r   BlockLayout.block   s       &&&r   c                 .    U R                   R                  $ )z6the associated :class:`~ezdxf.entities.EndBlk` entity.)r   endblkr    s    r   r#   BlockLayout.endblk    s       '''r   c                 B    U R                   R                  R                  $ )zGet/set the BLOCK name)r   dxfnamer    s    r   r'   BlockLayout.name%   s       $$)))r   Nc                 :    U R                   R                  U5        g N)r   rename)r   new_names     r   r'   r(   *   s      *r   c                 .    U R                   R                  $ )zODXF name space of associated :class:`~ezdxf.entities.BlockRecord`
table entry.
)r   r&   r    s    r   r&   BlockLayout.dxf.   s    
   $$$r   c                 T    [        U R                  R                  R                  5      $ )zLSet property to ``True`` to allow exploding block references of
this block.
)boolr   r&   exploder    s    r   can_explodeBlockLayout.can_explode5   s!    
 D%%))1122r   valuec                 L    [        U5      U R                  R                  l        g r*   )intr   r&   r1   r   r4   s     r   r2   r3   <   s    (+E
%r   c                 T    [        U R                  R                  R                  5      $ )zWSet property to ``True`` to allow block references of this block
only scale uniformly.
)r0   r   r&   scaler    s    r   scale_uniformlyBlockLayout.scale_uniformly@   s!    
 D%%))//00r   c                 L    [        U5      U R                  R                  l        g r*   )r6   r   r&   r9   r7   s     r   r:   r;   G   s    &)%j#r   c                 T    [        U R                  R                  R                  5      $ )z$Get/Set the base point of the block.r   r   r&   
base_pointr    s    r   r?   BlockLayout.base_pointK   s     DJJNN--..r   c                 L    [        U5      U R                  R                  l        g r*   r>   r7   s     r   r?   r@   P   s    $(K

!r   c                     S U  5       $ )zIReturns iterable of all :class:`~ezdxf.entities.attrib.Attdef`
entities.
c              3   T   #    U  H  n[        U[        5      (       d  M  Uv   M      g 7fr*   )r   r   ).0es     r   	<genexpr>&BlockLayout.attdefs.<locals>.<genexpr>X   s     94a:a#84s   (	( r    s    r   attdefsBlockLayout.attdefsT   s     :499r   tagc                 (    U R                  U5      SL$ )zOReturns ``True`` if an :class:`~ezdxf.entities.attrib.Attdef` for
`tag` exist.
N)
get_attdef)r   rK   s     r   
has_attdefBlockLayout.has_attdefZ   s     s#4//r   c                 l    U R                  5        H   nXR                  R                  :X  d  M  Us  $    g)zNReturns attached :class:`~ezdxf.entities.attrib.Attdef` entity by
`tag` name.
N)rI   r&   rK   )r   rK   attdefs      r   rM   BlockLayout.get_attdef`   s,     llnFjjnn$ % r   defaultc                 Z    U R                  U5      nUc  U$ UR                  R                  $ )zReturns text content for :class:`~ezdxf.entities.attrib.Attdef`
`tag` as string or returns `default` if no :class:`Attdef` for `tag`
exist.

Args:
    tag: name of tag
    default: default value if `tag` not exist

)rM   r&   text)r   rK   rS   rQ   s       r   get_attdef_textBlockLayout.get_attdef_texti   s*     %>Nzzr   c                 0    S U R                  5        5       $ )zAReturns iterable for all constant ATTDEF entities. (internal API)c              3   J   #    U  H  oR                   (       d  M  Uv   M     g 7fr*   is_constrD   rQ   s     r   rF   0BlockLayout.get_const_attdefs.<locals>.<genexpr>z   s     G^6^s   #	#)rI   r    s    r   get_const_attdefsBlockLayout.get_const_attdefsx   s    GT\\^GGr   c                 B    [        S U R                  5        5       5      $ )zGReturns ``True`` if the block has a non constant attribute
definition.
c              3   B   #    U  H  oR                   (       + v   M     g 7fr*   rZ   r\   s     r   rF   3BlockLayout.has_non_const_attdef.<locals>.<genexpr>   s     D^6&&^s   )anyrI   r    s    r   has_non_const_attdef BlockLayout.has_non_const_attdef|   s     DT\\^DDDr   c                 x    U R                  5       nU R                  R                  [        R                  U5        g r*   )rd   r   set_flag_stater   BLK_NON_CONSTANT_ATTRIBUTES)r   states     r   update_block_flagsBlockLayout.update_block_flags   s*    ))+

!!%"C"CUKr   rH   )r   N) ) __name__
__module____qualname____firstlineno____doc__r0   r   propertyr   r   r   r   r#   r   r'   setterr&   r2   r:   r   r?   r   r   r   rI   rN   rM   rV   r^   rd   rj   __static_attributes__rH   r   r   r   r   
   s   
	+d 	+ 'x ' ' (( ( ( *c * * 
[[+ + % % 3T 3 3 3 3 3 1 1 1 1T 1 1 /D / / 0 0 0 0:&) :0c 0d 0c hv&6 3  c H8F#3 HEd ELr   r   N)typingr   r   
ezdxf.mathr   r   ezdxf.lldxfr   baser	   ezdxf.entitiesr
   r   r   r   r   rH   r   r   <module>rz      s)    & !   < <zL* zLr   