
    h                        S SK Jr  S SKJrJrJrJrJr  S SKJ	r	  S SK
r
S SKJr  S SKJr  \(       a  S SKJr  S SKJrJrJrJr  S S	KJr  S S
KJr  \
R2                  " S5      r " S S5      r " S S5      rg)    )annotations)TYPE_CHECKINGIterableIteratorcastOptional)chainN)const)entity_linker)Drawing)	DXFEntityDXFTagStorageBlockRecord
DXFGraphic)AbstractTagWriter)Tagsezdxfc                  (    \ rS rSrSS jrSS jrSrg)StoredSection   c                    Xl         g Nentities)selfr   s     I/var/www/html/env/lib/python3.13/site-packages/ezdxf/sections/entities.py__init__StoredSection.__init__   s         c                n    U R                    H  nUR                  U5        M     UR                  S5        g )Nz  0
ENDSEC
)r   
write_tags	write_str)r   	tagwriterentitys      r   
export_dxfStoredSection.export_dxf   s.    mmF  ( $ 	O,r   r   N)r   z
list[Tags])r#   r   )__name__
__module____qualname____firstlineno__r   r%   __static_attributes__ r   r   r   r      s    !-r   r   c                  X    \ rS rSrSr  S
   SS jjrSS jrSS jrSS jrSS jr	S	r
g)EntitySection!   zq:class:`EntitiesSection` is just a proxy for :class:`Modelspace` and
active :class:`Paperspace` linked together.
Nc                L    Xl         Ub  U R                  [        U5      5        g g r   )doc_builditer)r   r1   r   s      r   r   EntitySection.__init__&   s$    
 KKX'  r   c              #     #    U R                   c   eU R                   R                  n[        UR                  5       UR	                  5       5       H  nUv   M	     g7f)zRReturns an iterator for all entities of the modelspace and the active
paperspace.
N)r1   layoutsr	   
modelspaceactive_layout)r   r6   r$   s      r   __iter__EntitySection.__iter__/   sO      xx###((""G..0'2G2G2IJFL Ks   AAc                    U R                   c   eU R                   R                  n[        UR                  5       5      [        UR	                  5       5      -   $ )zWReturns the count of all entities in the modelspace and the active paperspace.
        )r1   r6   lenr7   r8   )r   r6   s     r   __len__EntitySection.__len__8   sJ     xx###((""7%%'(3w/D/D/F+GGGr   c                L  ^^^^	 U R                   c   e[        S[        U5      5      nUR                  5       S:w  d  UR                  S   S:w  a  [
        R                  " S5      eS
UUUU	4S jjn[        SU R                   R                  R                  S5      5      m[        SU R                   R                  R                  S	5      5      mTR                  R                  mTR                  R                  m	[        5       nU H  nU" U5      (       a  M  U" U5        M     g )Nr   SECTION   )   ENTITIESz-Critical structure error in ENTITIES section.c                  > U R                   R                  nSnUT:X  a  SnO?UT:X  a  SnO6U R                   R                  S5      (       a  U R                   R                  nU(       a  TR	                  U 5        g TR	                  U 5        g )Nr   rA   
paperspace)dxfownerhasattrrE   
add_entity)r$   handlerE   mspmsp_layout_keypsppsp_layout_keys      r   add!EntitySection._build.<locals>.addK   sw    ZZ%%FJ'
>)
##  $ZZ22
v&v&r   r   z*Model_Spacez*Paper_Space)r$   r   )r1   r   nextdxftype
base_classr
   DXFStructureErrorblock_recordsgetrF   rJ   r   )
r   r   section_headrO   linked_entitiesr$   rK   rL   rM   rN   s
         @@@@r   r2   EntitySection._buildA   s    xx###OT(^<!Y.,2I2I3
3 ))? 	' 	'$ =$(("8"8"<"<^"LM=$(("8"8"<"<^"LM!ggnn!ggnn'/F #6**F	 r   c                8   U R                   c   eU R                   R                  nUR                  S5        UR                  5       R                  R                  U5        UR                  5       R                  R                  U5        UR                  SS5        g )Nz  0
SECTION
  2
ENTITIES
r   ENDSEC)r1   r6   r"   r7   entity_spacer%   r8   
write_tag2)r   r#   r6   s      r   r%   EntitySection.export_dxfi   s|    xx###(("";< 	))44Y?,,77	BQ)r   )r1   )NN)r1   zOptional[Drawing]r   zOptional[Iterable[DXFEntity]])returnIterator[DXFEntity])r_   int)r   r`   r_   None)r#   r   r_   rb   )r'   r(   r)   r*   __doc__r   r9   r=   r2   r%   r+   r,   r   r   r.   r.   !   s<     "&26(( 0(H&P*r   r.   )
__future__r   typingr   r   r   r   r   	itertoolsr	   loggingezdxf.lldxfr
   ezdxf.entitiesr   ezdxf.documentr   r   r   r   r   ezdxf.lldxf.tagwriterr   ezdxf.lldxf.tagsr   	getLoggerloggerr   r.   r,   r   r   <module>ro      sV    # D D    (&PP7% 
		7	#	- 	-P* P*r   