
    hW                    8   % S r SSKJr  SSKJrJrJrJrJrJ	r	J
r
Jr  SSKJr  SSKrSSKrSSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJrJrJr  SSKJr  SSK J!r!  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.  \(       a,  SSK/J0r0  SSK1J2r2  SSK3J4r4J5r5  SSKJr  SSK6J7r7  SSK8J9r9  SSKJ:r:  / SQr;\Rx                  " S5      r=Sr>Sr?Sr@\" S\" S 5      \" S!5      S".5      rAS#\BS$'   \
" S%S&S'9rC " S( S&5      rD\!R                   " S) S*\D5      5       rFg)+a  :class:`DXFEntity` is the super class of all DXF entities.

The current entity system uses the features of the latest supported DXF version.

The stored DXF version of the document is used to warn users if they use
unsupported DXF features of the current DXF version.

The DXF version of the document can be changed at runtime or overridden by
exporting, but unsupported DXF features are just ignored by exporting.

Ezdxf does no conversion between different DXF versions, this package is
still not a CAD application.

    )annotations)TYPE_CHECKINGAnyIterableIteratorOptionalTypeTypeVarCallable)SelfN)options)const)Tags)DXFTag)ExtendedTags)DXFAttrDXFAttributesDefSubclass)set_flag_state   )factory)AppDataReactors)DXFNamespaceSubclassProcessor)XData)ExtensionDict)default_copyCopyNotSupported)Auditor)Drawing)
DXFGraphicInsert)r   )AbstractTagWriter)Matrix44)xref)	DXFEntityDXFTagStorage
base_classr   ezdxf_source_of_copy_uuid_source_block_reference   iJ  )handleownerr   r)   Tr'   )boundc                  &   \ rS rSr% SrSr\" \5      r0 r	S\
S'   \R                  rSRS jr\SSS j5       r\    ST         SUS	 jj5       rS
 rS r\SVSWS jj5       rSVSXS jjr SV   SYS jjrSZS jr\SVS[S jj5       r\S\S j5       r\4S]S jjr\4S^S jjrS_S jrSRS jr\S`S j5       r \SaS j5       r!\SaS j5       r"SbS jr#ScS jr$SdS jr%\S`S j5       r&\S`S j5       r'\S`S j5       r(\S`S j5       r)\SeS  j5       r*SfS! jr+SRS" jr,SVSgS# jjr-ShS$ jr.SiS% jr/SjS& jr0\0r1SjS' jr2SkS( jr3SkS) jr4SkS* jr5SVSlS+ jjr6 Sm       SnS, jjr7SoSpS- jjr8SVSqS. jjr9SRS/ jr:S0 r;SVSrS1 jjr<SsS2 jr=StS3 jr>StS4 jr?StS5 jr@StS6 jrASuS7 jrB\S`S8 j5       rCSvS9 jrDSvS: jrESRS; jrFSRS< jrGSwS= jrHSxS> jrISyS? jrJSzS@ jrKSwSA jrLSxSB jrMSySC jrNS{SD jrOS|SE jrPS}SF jrQS~SG jrRSSH jrSS~SI jrTS`SJ jrUSSK jrVSSL jrWSdSM jrXSdSN jrYSSO jrZSSP jr[SQr\g)r'   W   z(Common super class for all DXF entities.	DXFENTITYdict[str, Any]DEFAULT_ATTRIBSc                t    SU l         [        U S9U l        SU l        SU l        SU l        SU l        SU l        g)z#Default constructor. (internal API)N)entity)docr   dxfappdatareactorsextension_dictxdataproxy_graphicselfs    J/var/www/html/env/lib/python3.13/site-packages/ezdxf/entities/dxfentity.py__init__DXFEntity.__init__e   s>     '+!-T!: +/,07;&*
.2    c                z    [        U [        S5      nUc&  [        R                  " 5       n[	        U [        U5        U$ )zReturns a UUID, which allows to distinguish even
virtual entities without a handle.

Dynamic attribute: this UUID will be created at the first request.

N)getattrDYN_UUID_ATTRIBUTEuuiduuid4setattr)rB   uuid_s     rC   rJ   DXFEntity.uuidy   s5     0$7=JJLED,e4rF   Nc                    U " 5       nXEl         XR                  l        X%R                  l        [	        U R
                  5      nUR                  U=(       d    0 5        UR                  U5        UR                  5         U$ )a8  Constructor for building new entities from scratch by ezdxf.

NEW process:

This is a trusted environment where everything is under control of
ezdxf respectively the package-user, it is okay to raise exception
to show implementation errors in ezdxf or usage errors of the
package-user.

The :attr:`Drawing.is_loading` flag can be checked to distinguish the
NEW and the LOAD process.

Args:
    handle: unique DXF entity handle or None
    owner: owner handle if entity has an owner else None or '0'
    dxfattribs: DXF attributes
    doc: DXF document

(internal API)
)	r:   r;   r/   r0   dictr7   updateupdate_dxf_attribspost_new_hook)clsr/   r0   
dxfattribsr:   r9   attribss          rC   newDXFEntity.new   sd    8 
"

 

s**+z'R(!!'*rF   c                    g)zPost-processing and integrity validation after entity creation.

Called only if created by ezdxf (see :meth:`DXFEntity.new`),
not if loaded from an external source.

(internal API)
N rA   s    rC   rS   DXFEntity.post_new_hook   s     	rF   c                    g)aV  Post-processing and integrity validation after binding entity to a
DXF Document. This method is triggered by the :func:`factory.bind`
function only when the entity was created by ezdxf.

If the entity was loaded in the 1st loading stage, the
:func:`factory.load` functions also calls the :func:`factory.bind`
to bind entities to the loaded document, but not all entities are
loaded at this time. To avoid problems this method will not be called
when loading content from DXF file, but :meth:`post_load_hook` will be
triggered for loaded entities at a later and safer point in time.

(internal API)
NrZ   rA   s    rC   post_bind_hookDXFEntity.post_bind_hook   s     	rF   c                h    U " 5       nX#l         U(       a  UR                  OSnUR                  XS9  U$ )aX  Constructor to generate entities loaded from an external source.

LOAD process:

This is an untrusted environment where valid structure are not
guaranteed and errors should be fixed, because the package-user is not
responsible for the problems and also can't fix them, raising
exceptions should only be done for unrecoverable issues.
Log fixes for debugging!

    Be more like BricsCAD and not as mean as AutoCAD!

The :attr:`Drawing.is_loading` flag can be checked to distinguish the
NEW and the LOAD process.

Args:
    tags: DXF tags as :class:`ExtendedTags`
    doc: DXF Document

(internal API)
N
dxfversion)r:   ra   	load_tagsrT   tagsr:   r9   ra   s        rC   loadDXFEntity.load   s3    0 
'*S^^
5rF   c                   U(       a  [        UR                  5      (       a  U R                  UR                  5        [        UR                  5      (       a   [	        UR                  5      U l        [        XS9nU R                  U5      U l        gg! [
        R                   aN    [        R                  " UR                  5      U l        [        R                  SUR                  5        35         Nf = f)aZ  Generic tag loading interface, called if DXF document is loaded
from external sources.

1. Loading stage which set the basic DXF attributes, additional
   resources (DXF objects) are not loaded yet. References to these
   resources have to be stored as handles and can be resolved in the
2. Loading stage: :meth:`post_load_hook`.

(internal API)
zremoved invalid XDATA from r`   N)lenr<   setup_app_datar?   r   r   DXFValueError	safe_initloggerdebugentity_namer   load_dxf_attribsr;   )rB   rd   ra   	processors       rC   rb   DXFEntity.load_tags   s     4<<  ##DLL14::U!&tzz!2DJ
 *$FI,,Y7DH  ** U!&!<DJLL#>t?O?O?Q>R!STUs   B AC54C5c                    [        X5      $ )z'Load DXF attributes into DXF namespace.)r   )rB   rp   s     rC   ro   DXFEntity.load_dxf_attribs   s     I,,rF   c                T    U R                   b  U R                   R                  U5        g)a  The 2nd loading stage when loading DXF documents from an external
source, for the 1st loading stage see :meth:`load_tags`.

This stage is meant to convert resource handles into :class:`DXFEntity`
objects. This is an untrusted environment where valid structure are not
guaranteed, raise exceptions only for unrecoverable structure errors
and fix everything else. Log fixes for debugging!

Some fixes can not be applied at this stage, because some structures
like the OBJECTS section are not initialized, in this case return a
callable, which will be executed after the DXF document is fully
initialized, for an example see :class:`Image`.

Triggered in method: :meth:`Drawing._2nd_loading_stage`

Examples for two stage loading:
Image, Underlay, DXFGroup, Dictionary, Dimstyle, MText

N)r>   load_resources)rB   r:   s     rC   post_load_hookDXFEntity.post_load_hook  s'    ( *..s3rF   c                N    U R                  [        R                  " U5      U5      $ )z6Load constructor from text for testing. (internal API))re   r   	from_text)rT   textr:   s      rC   ry   DXFEntity.from_text  s      xx..t4c::rF   c                8   U " 5       nUR                   Ul         UR                  Ul        UR                  Ul        UR                  Ul        UR                  Ul        UR
                  Ul        UR                  Ul        UR                  R                  U5        U$ )zMCopy constructor for type casting e.g. Polyface and Polymesh.
(internal API)
)r:   r;   r>   r=   r<   r?   r@   rewire)rT   otherr9   s      rC   shallow_copyDXFEntity.shallow_copy!  su    
 YY
YY
 % 4 4..{{$22

&!rF   c                $    UR                  U 5      $ )a  Internal entity copy for usage in the same document or as virtual entity.

Returns a copy of `self` but without handle, owner and reactors.
This copy is NOT stored in the entity database and does NOT reside
in any layout, block, table or objects section!
The extension dictionary will be copied for entities bound to a valid
DXF document. The reactors are not copied.

(internal API)
)copyrB   copy_strategys     rC   r   DXFEntity.copy2  s     !!$''rF   c                    g)zCopy entity data like vertices or attribs to the copy of the entity.

This is the second stage of the copy process, see copy() method.

(internal API)
NrZ   )rB   r9   r   s      rC   	copy_dataDXFEntity.copy_data?  s     	rF   c                v    [        U[        5      (       a  UR                  (       d  Sn[        U [        U5        g)zSet immediate source entity of a copy.

Also used from outside to set the source of sub-entities
of disassembled entities (POLYLINE, LWPOLYLINE, ...).

(Internal API)
N)
isinstancer'   is_aliverL   DYN_SOURCE_OF_COPY_ATTRIBUTErB   sources     rC   set_source_of_copyDXFEntity.set_source_of_copyH  s)     fi((F2F;rF   c                P    [        U [        5      (       a  [        U [        5        gg)z1Delete source of copy reference.

(Internal API)
N)hasattrr   delattrrA   s    rC   del_source_of_copyDXFEntity.del_source_of_copyU  s"    
 4566D67 7rF   c                    U R                   SL$ )z$Is ``True`` if the entity is a copy.N)source_of_copyrA   s    rC   is_copyDXFEntity.is_copy]  s     ""$..rF   c                v    [        U [        S5      n[        U[        5      (       a  UR                  (       d  gU$ )ziThe immediate source entity if this entity is a copy else
``None``. Never references a destroyed entity.
N)rH   r   r   r'   r   r   s     rC   r   DXFEntity.source_of_copyb  s.     ;TBfi((rF   c                   U R                   n[        U[        5      (       ag  UR                  (       aV  UR                  (       aE  UR                   n[        U[        5      (       a$  UR                  (       a  UR                  (       a  ME  U$ )zThe origin source entity if this entity is a copy else
``None``. References the first non-virtual source entity and never
references a destroyed entity.
)r   r   r'   r   
is_virtualr   s     rC   origin_of_copyDXFEntity.origin_of_copym  sZ     $$++FDUDU**F ++FDUDUDUrF   c                r    U R                   R                  nUR                  5        H  u  p4U" X45        M     g)zMSet DXF attributes by a ``dict`` like :code:`{'layer': 'test',
'color': 4}`.
N)r;   setitems)rB   rU   setterkeyvalues        rC   rR   DXFEntity.update_dxf_attribsy  s.     $**,JC3 -rF   c                
   U H}  nUS   u  p4U[         R                  :X  a  [        R                  " U5      U l        M;  U[         R
                  :X  a  [        R                  " U5      U l        Ml  U R                  XB5        M     g)z3Setup data structures from APP data. (internal API)r   N)	r   ACAD_REACTORSr   	from_tagsr=   ACAD_XDICTIONARYr   r>   set_app_data)rB   r<   datacodeappids        rC   ri   DXFEntity.setup_app_data  sf    Dq'KD+++ ( 2 24 8%000&3&=&=d&C#!!%. rF   c                ~    XR                   l        U R                  (       a  U R                  R                  U5        gg)z$Update entity handle. (internal API)N)r;   r/   r>   update_ownerrB   r/   s     rC   update_handleDXFEntity.update_handle  s-     ,,V4 rF   c                    [        U S5      $ )z(Is ``False`` if entity has been deleted.r;   )r   rA   s    rC   r   DXFEntity.is_alive  s     tU##rF   c                \    U R                   SL =(       d    U R                  R                  SL $ )z*Is ``True`` if entity is a virtual entity.N)r:   r;   r/   rA   s    rC   r   DXFEntity.is_virtual  s%     xx4:488??d#::rF   c                    U R                   (       a1  U R                  (       d   [        R                  " X R                  5      $ g)z/Is ``True`` if entity is bound to DXF document.F)r   r   r   is_boundr:   rA   s    rC   r   DXFEntity.is_bound  s)     ==##D((33rF   c                "    [        U [        5      $ )zDIs ``True`` if this virtual entity was created by a block reference.)r   $DYN_SOURCE_BLOCK_REFERENCE_ATTRIBUTErA   s    rC   has_source_block_reference$DXFEntity.has_source_block_reference  s     tABBrF   c                R    [        U [        S5      nUb  UR                  (       a  U$ g)zThe source block reference (INSERT) which created
this virtual entity. The property is ``None`` if this entity was not
created by a block reference.
N)rH   r   r   rB   blockrefs     rC   source_block_reference DXFEntity.source_block_reference  s)     4!EtLH$5$5OrF   c                z    U R                   (       d   S5       eU R                  (       a  g[        U [        U5        g)a  Set the immediate source block reference which created this virtual
entity.

The source block reference can only be set once by the immediate INSERT
entity and does not change if the entity is passed through multiple
nested INSERT entities.

(Internal API)
z#instance has to be a virtual entityN)r   r   rL   r   r   s     rC   set_source_block_reference$DXFEntity.set_source_block_reference  s/     E EE**:HErF   c                P    [        U [        5      (       a  [        U [        5        gg)z/Delete source block reference.

(Internal API)
N)r   r   r   rA   s    rC   del_source_block_reference$DXFEntity.del_source_block_reference  s"    
 4=>>D>? ?rF   c                8    U R                   R                  X5      $ )aU  Get DXF attribute `key`, returns `default` if key doesn't exist, or
raise :class:`DXFValueError` if `default` is :class:`DXFValueError`
and no DXF default value is defined::

    layer = entity.get_dxf_attrib("layer")
    # same as
    layer = entity.dxf.layer

Raises :class:`DXFAttributeError` if `key` is not an supported DXF
attribute.

)r;   get)rB   r   defaults      rC   get_dxf_attribDXFEntity.get_dxf_attrib  s     xx||C))rF   c                :    U R                   R                  X5        g)zSet new `value` for DXF attribute `key`::

   entity.set_dxf_attrib("layer", "MyLayer")
   # same as
   entity.dxf.layer = "MyLayer"

Raises :class:`DXFAttributeError` if `key` is not an supported DXF
attribute.

N)r;   r   )rB   r   r   s      rC   set_dxf_attribDXFEntity.set_dxf_attrib  s     	S rF   c                :    U R                   R                  U5        g)zDelete DXF attribute `key`, does not raise an error if attribute is
supported but not present.

Raises :class:`DXFAttributeError` if `key` is not an supported DXF
attribute.

N)r;   discardrB   r   s     rC   del_dxf_attribDXFEntity.del_dxf_attrib  s     	rF   c                8    U R                   R                  U5      $ )zReturns ``True`` if DXF attribute `key` really exist.

Raises :class:`DXFAttributeError` if `key` is not an supported DXF
attribute.

)r;   r   r   s     rC   has_dxf_attribDXFEntity.has_dxf_attrib  s     xx$$rF   c                    XR                   ;   aN  U R                  (       a<  U R                  R                  U R                   R                  U5      R                  :  $ gg)zuReturns ``True`` if DXF attrib `key` is supported by this entity.
Does not grant that attribute `key` really exist.

TF)
DXFATTRIBSr:   ra   r   r   s     rC   is_supported_dxf_attrib!DXFEntity.is_supported_dxf_attrib  sL    
 //!xxHH''**3/::;
 rF   c                    U R                   $ )z:Get DXF type as string, like ``LINE`` for the line entity.)DXFTYPErA   s    rC   dxftypeDXFEntity.dxftype  s    ||rF   c                j    SR                  U R                  5       U R                  R                  5      $ )z'Returns a simple string representation.z{}(#{}))formatr   r;   r/   rA   s    rC   __str__DXFEntity.__str__  s#    @@rF   c                J    [        U R                  5      S-   [        U 5      -   $ )z;Returns a simple string representation including the class. )str	__class__rA   s    rC   __repr__DXFEntity.__repr__  s    4>>"S(3t944rF   c                    U R                   R                  5       nU(       a,  UR                  5        VVs0 s H  u  p4X1;  d  M  X4_M     snn$ U$ s  snnf )z{Returns a ``dict`` with all existing DXF attributes and their
values and exclude all DXF attributes listed in set `drop`.

)r;   all_existing_dxf_attribsr   )rB   dropall_attribskvs        rC   rU   DXFEntity.dxfattribs  sO    
 hh779%0%6%6%8J%8TQAMDAD%8JJ Ks   AAc           	         U R                   R                  US5      nU R                   R                  U[        XAUS95        g)zSet binary coded `flag` of DXF attribute `name` to 1 (on)
if `state` is ``True``, set `flag` to 0 (off)
if `state` is ``False``.
r   )stateN)r;   r   r   r   )rB   flagr   nameflagss        rC   r   DXFEntity.set_flag_state"  s1     T1%T>%UCDrF   c                R    [        U R                  R                  US5      U-  5      $ )zyReturns ``True`` if any `flag` of DXF attribute is 1 (on), else
``False``. Always check only one flag state at the time.
r   )boolr;   r   )rB   r   r   s      rC   get_flag_stateDXFEntity.get_flag_state,  s#     DHHLLq)D011rF   c                    U R                   (       a_  SU R                  l        SU R                  l        SU l        SU l        SU l        SU l        U R                  5         U R                  5         gg)a  Remove all dependencies from current document.

Intended usage is to remove dependencies from the current document to
move or copy the entity to `other` DXF document.

An error free call of this method does NOT guarantee that this entity
can be moved/copied to the `other` document, some entities like
DIMENSION have too many dependencies to a document to move or copy
them, but to check this is not the domain of this method!

(internal API)
N)
r   r;   r0   r/   r=   r>   r<   r?   r   r   )rB   r~   s     rC   remove_dependenciesDXFEntity.remove_dependencies2  s[     ==!DHHN"DHHO DM"&DDLDJ##%++- rF   c                    U R                   (       d  gU R                  b  U R                  R                  5         U ?U ?U ?U ?U ?U ?U R                  5         U R                  5         g)zoDelete all data and references. Does not delete entity from
structures like layouts or groups.

(internal API)
N)
r   r>   destroyr<   r=   r?   r:   r;   r   r   rA   s    rC   r  DXFEntity.destroyJ  sc     }}*'')#LMJHH!'')rF   c                @    U R                   (       d  gU ?U ?U ?U ?U ?U ?g)z^Delete entity but not the referenced content!

DANGER! DON'T USE THIS METHOD!

(internal API)
N)r   r>   r<   r=   r?   r:   r;   rA   s    rC   _silent_killDXFEntity._silent_kill_  s-     }}LMJHHrF   c                    g)z*Internal messaging system.  (internal API)NrZ   )rB   message_typer   s      rC   notifyDXFEntity.notifyo  s    rF   c                    g)zPre requirement check and pre-processing for export.

Returns ``False``  if entity should not be exported at all.

(internal API)
TrZ   rB   	tagwriters     rC   preprocess_exportDXFEntity.preprocess_exports  s     rF   c                    UR                   U R                  :  a  gU R                  U5      (       d  gU R                  U5        U R	                  U5        U R                  U5        g)ah  Export DXF entity by `tagwriter`.

This is the first key method for exporting DXF entities:

    - has to know the group codes for each attribute
    - has to add subclass tags in correct order
    - has to integrate extended data: ExtensionDict, Reactors, AppData
    - has to maintain the correct tag order (because sometimes order matters)

(internal API)

N)ra   MIN_DXF_VERSION_FOR_EXPORTr  export_base_classexport_entityexport_xdatar  s     rC   
export_dxfDXFEntity.export_dxf|  s]     $"A"AA%%i00y) 	9% 	)$rF   c                   U R                   nUS:X  a  SOSnUR                  [        R                  U5        UR                  [        R
                  :  a  UR                  X0R                  R                  5        U R                  (       a  U R                  R                  U5        U R                  (       a  U R                  R                  U5        U R                  (       a  U R                  R                  U5        UR                  [        R                  U R                  R                  SS5      5        gUR                  (       a&  UR                  X0R                  R                  5        gg)z?Export base class DXF attributes and structures. (internal API)DIMSTYLEi   r.   r0   0N)r   
write_tag2r   STRUCTURE_MARKERra   DXF2000r;   r/   r<   r  has_extension_dictr>   r=   
OWNER_CODEr   write_handles)rB   r  r   _handle_codes       rC   r  DXFEntity.export_base_class  s    ,,%3sU33W=5==0  xx?||''	2&&##..y9}}((3  !1!1488<<3MN&&$$\88??C 'rF   c                    g)a/  Export DXF entity specific data by `tagwriter`.

This is the second key method for exporting DXF entities:

    - has to know the group codes for each attribute
    - has to add subclass tags in correct order
    - has to maintain the correct tag order (because sometimes order matters)

(internal API)
NrZ   r  s     rC   r  DXFEntity.export_entity  s     	rF   c                ^    U R                   (       a  U R                   R                  U5        gg)z/Export DXF XDATA by `tagwriter`. (internal API)N)r?   r  r  s     rC   r  DXFEntity.export_xdata  s     ::JJ!!), rF   c                    g)zValidity check. (internal API)NrZ   )rB   auditors     rC   auditDXFEntity.audit  s    rF   c                p    U R                   nUb'  UR                  (       a  UR                  R                  $ g)zbReturns ``True`` if entity has an attached
:class:`~ezdxf.entities.xdict.ExtensionDict` instance.
F)r>   r   
dictionaryrB   xdicts     rC   r  DXFEntity.has_extension_dict  s0    
 ####,,,rF   c                R    U R                   (       a  U R                  $ [        S5      e)zReturns the existing :class:`~ezdxf.entities.xdict.ExtensionDict`
instance.

Raises:
    AttributeError: extension dict does not exist

z#Entity has no extension dictionary.)r  r>   AttributeErrorrA   s    rC   get_extension_dictDXFEntity.get_extension_dict  s%     ""&&& !FGGrF   c                    U R                   c   e[        R                  " U R                  R                  U R                   5      nXl        U$ )zCCreate a new :class:`~ezdxf.entities.xdict.ExtensionDict` instance.)r:   r   rW   r;   r/   r>   r-  s     rC   new_extension_dictDXFEntity.new_extension_dict  s;    xx###!!$((//488<#rF   c                    [        U R                  [        5      (       a  U R                  R                  5         SU l        g)z=Delete :class:`~ezdxf.entities.xdict.ExtensionDict` instance.N)r   r>   r   r  rA   s    rC   discard_extension_dict DXFEntity.discard_extension_dict  s/    d))=99'')"rF   c                    [        U R                  [        5      (       a+  [        U R                  5      S:X  a  U R	                  5         ggg)zHDelete :class:`~ezdxf.entities.xdict.ExtensionDict` instance when empty.r   N)r   r>   r   rh   r8  rA   s    rC   discard_empty_extension_dict&DXFEntity.discard_empty_extension_dict  s@     t**M::D''(A-'') . ;rF   c                B    U R                   (       a  XR                   ;   $ g)z?Returns ``True`` if application defined data for `appid` exist.F)r<   rB   r   s     rC   has_app_dataDXFEntity.has_app_data  s    <<LL((rF   c                    U R                   (       a'  [        U R                   R                  U5      SS 5      $ [        R                  " U5      e)zReturns application defined data for `appid`.

Args:
    appid: application name as defined in the APPID table.

Raises:
    DXFValueError: no data for `appid` found

r   )r<   r   r   r   rj   r>  s     rC   get_app_dataDXFEntity.get_app_data  s=     <<((/"566%%e,,rF   c                r    U R                   c  [        5       U l         U R                   R                  X5        g)zSet application defined data for `appid` as iterable of tags.

Args:
     appid: application name as defined in the APPID table.
     tags: iterable of (code, value) tuples or :class:`~ezdxf.lldxf.types.DXFTag`

N)r<   r   addrB   r   rd   s      rC   r   DXFEntity.set_app_data
  s)     <<"9DL%rF   c                ^    U R                   (       a  U R                   R                  U5        gg)zhDiscard application defined data for `appid`. Does not raise an
exception if no data for `appid` exist.
N)r<   r   r>  s     rC   discard_app_dataDXFEntity.discard_app_data  s"     <<LL  ' rF   c                B    U R                   (       a  XR                   ;   $ g)z4Returns ``True`` if extended data for `appid` exist.F)r?   r>  s     rC   	has_xdataDXFEntity.has_xdata  s    ::JJ&&rF   c                    U R                   (       a'  [        U R                   R                  U5      SS 5      $ [        R                  " U5      e)zReturns extended data for `appid`.

Args:
    appid: application name as defined in the APPID table.

Raises:
    DXFValueError: no extended data for `appid` found

r   N)r?   r   r   r   rj   r>  s     rC   	get_xdataDXFEntity.get_xdata$  s;     ::

u-ab122%%e,,rF   c                r    U R                   c  [        5       U l         U R                   R                  X5        g)zSet extended data for `appid` as iterable of tags.

Args:
     appid: application name as defined in the APPID table.
     tags: iterable of (code, value) tuples or :class:`~ezdxf.lldxf.types.DXFTag`

N)r?   r   rF  rG  s      rC   	set_xdataDXFEntity.set_xdata3  s'     ::DJ

u#rF   c                ^    U R                   (       a  U R                   R                  U5        gg)zfDiscard extended data for `appid`. Does not raise an exception if
no extended data for `appid` exist.
N)r?   r   r>  s     rC   discard_xdataDXFEntity.discard_xdata?  s"     ::JJu% rF   c                f    U R                  U5      (       a  U R                  R                  X5      $ g)zGReturns ``True`` if a tag list `name` for extended data `appid`
exist.
F)rM  r?   	has_xlistrB   r   r   s      rC   has_xdata_listDXFEntity.has_xdata_listF  s+     >>%  ::''44rF   c                    U R                   (       a$  [        U R                   R                  X5      5      $ [        R                  " U5      e)zReturns tag list `name` for extended data `appid`.

Args:
    appid: application name as defined in the APPID table.
    name: extended data list name

Raises:
    DXFValueError: no extended data for `appid` found or no data list `name` not found

)r?   r   	get_xlistr   rj   rZ  s      rC   get_xdata_listDXFEntity.get_xdata_listO  s6     ::

,,U9::%%e,,rF   c                t    U R                   c  [        5       U l         U R                   R                  XU5        g)zSet tag list `name` for extended data `appid` as iterable of tags.

Args:
     appid: application name as defined in the APPID table.
     name: extended data list name
     tags: iterable of (code, value) tuples or :class:`~ezdxf.lldxf.types.DXFTag`

N)r?   r   	set_xlistrB   r   r   rd   s       rC   set_xdata_listDXFEntity.set_xdata_list_  s+     ::DJ

U$/rF   c                ^    U R                   (       a  U R                   R                  X5        gg)zDiscard tag list `name` for extended data `appid`. Does not raise
an exception if no extended data for `appid` or no tag list `name`
exist.
N)r?   discard_xlistrZ  s      rC   discard_xdata_listDXFEntity.discard_xdata_listl  s"    
 ::JJ$$U1 rF   c                Z    U R                   c   eU R                   R                  XU5        g)a  
Replaces tag list `name` for existing extended data `appid` by `tags`.
Appends new list if tag list `name` do not exist, but raises
:class:`DXFValueError` if extended data `appid` do not exist.

Args:
     appid: application name as defined in the APPID table.
     name: extended data list name
     tags: iterable of (code, value) tuples or :class:`~ezdxf.lldxf.types.DXFTag`

Raises:
    DXFValueError: no extended data for `appid` found

N)r?   replace_xlistrc  s       rC   replace_xdata_listDXFEntity.replace_xdata_listt  s(     zz%%%

  d3rF   c                ,    [        U R                  5      $ )z(Returns ``True`` if entity has reactors.)r   r=   rA   s    rC   has_reactorsDXFEntity.has_reactors  s    DMM""rF   c                \    U R                   (       a  U R                   R                  5       $ / $ )z/Returns associated reactors as list of handles.)r=   r   rA   s    rC   get_reactorsDXFEntity.get_reactors  s     &*mmt}}  ";;rF   c                r    U R                   c  [        5       U l         U R                   R                  U5        g)z Set reactors as list of handles.N)r=   r   r   )rB   handless     rC   set_reactorsDXFEntity.set_reactors  s'    == $JDM'"rF   c                r    U R                   c  [        5       U l         U R                   R                  U5        g)zAppend `handle` to reactors.N)r=   r   rF  r   s     rC   append_reactor_handleDXFEntity.append_reactor_handle  s'    == $JDM&!rF   c                ^    U R                   (       a  U R                   R                  U5        gg)zXDiscard `handle` from reactors. Does not raise an exception if
`handle` does not exist.
N)r=   r   r   s     rC   discard_reactor_handle DXFEntity.discard_reactor_handle  s"     ==MM!!&) rF   c                h   U R                   (       a<  U R                   R                  R                  5        H  nUR                  U5        M     U R                  (       aT  U R                  R                  5        H5  nUR                  5        H  nUR                  UR                  5        M      M7     gg)z5Register required resources to the resource registry.N)	r?   r   keys	add_appidr<   rd   get_hard_owner_handles
add_handler   )rB   registryr   rd   tags        rC   register_resourcesDXFEntity.register_resources  sz    ::

,,.""4( /<<))+668C''		2 9 , rF   c                  ^^ UU4S jnUR                   (       a2  UR                   R                  R                  5        H
  mU" 5         M     UR                  (       aE  UR                  R	                  5        H'  mTR                  TUR                  R                  S9  M)     UR                  (       aI  U R                  c   eU R                  R                  R                  UR                  R                  T5        U R                  (       ah  U R                  R                   Vs/ s H  nTR                  U5      PM     nnU Vs/ s H  oDS:w  d  M
  UPM     nnU(       a  UR                  U5        gggs  snf s  snf )z3Translate resources from self to the copied entity.c                    > [        T5       HT  u  n u  pUS:X  a   [        UTR                  U5      5      TU '   M.  US:X  d  M6  [        UTR                  U5      5      TU '   MV     g )Ni  i  )	enumerater   
get_handle	get_layer)indexr   r   mappingrd   s      rC   map_xdata_resources4DXFEntity.map_resources.<locals>.map_xdata_resources  s\    (1$$}4<"(w/A/A%/H"IDKT\"(w/@/@/G"HDK	 )8rF   )new_owner_handleNr  )r?   r   valuesr<   rd   map_pointersr;   r/   r>   r,  map_resourcesr=   r  rv  )rB   cloner  r  hmapped_handlesrd   s     `   @rC   r  DXFEntity.map_resources  s'   	I ;;((//1#% 2 ==**,$$TEII<L<L$M - &&222**88$$// ===A]]=S=ST=Sg003=SNT)7DA8aND"">2 	 TDs   &E7	E<E<)r<   r:   r;   r>   r@   r=   r?   returnNone)r  z	uuid.UUID)NNNN)
rT   Type[T]r/   Optional[str]r0   r  r:   Optional[Drawing]r  r1   N)rT   r  rd   r   r:   r  r  r1   )rd   r   ra   r  r  r  )rp   zOptional[SubclassProcessor]r  r   )r:   r!   r  zOptional[Callable])rT   r  rz   r   r:   r  r  r1   )rT   r  r~   r'   r  r1   r  r   )r9   r   r  r  )r   Optional[DXFEntity]r  r   )r  r  )rU   rP   r  r  )r<   z
list[Tags]r  r  )r/   r   r  r  )r  zOptional[Insert])r   r#   r  r  )r   r   r   r   r  r   )r   r   r   r   r  r  )r   r   r  r  )r   r   r  r   )r  r   )r   zOptional[set[str]]r  rP   )Tr   )r   intr   r   r   r   r  r  )r   )r   r  r   r   r  r   )r~   r  )r  r  r   r   r  r  )r  r$   r  r   r  r$   r  r  )r(  r    r  r  )r  r   )r   r   r  r   )r   r   r  r   )r   r   rd   r   r  r  )r   r   )r   r   r  r  )r   r   r   r   r  r   )r   r   r   r   r  r   )r   r   r   r   rd   r   r  r  )r   r   r   r   r  r  )r  z	list[str])ru  zIterable[str]r  r  )r  zxref.Registryr  r  )r  r   r  zxref.ResourceMapperr  r  )]__name__
__module____qualname____firstlineno____doc__r   r   r)   r   r7   __annotations__r   DXF12r  rD   propertyrJ   classmethodrW   rS   r]   re   rb   ro   rv   ry   r   r   r   r   r   r   r   r   r   rR   ri   r   r   r   r   r   r   r   r   r   r   r   r   dxf_attrib_existsr   r   r   r   rU   r   r   r   r  r  r	  r  r  r  r  r  r)  r  r2  r5  r8  r;  r?  rC  r   rJ  rM  rP  rS  rV  r[  r_  rd  rh  rl  ro  rr  rv  ry  r|  r  r  __static_attributes__rZ   rF   rC   r'   r'   W   s   2Gz*J ')O^(!&3(    !%#!%$$$ $
 $ 
$ $L   :82 8<-4-	-0 ; ;    ". ( 5A <8 / /   	 		/5 $ $ ; ;   C C  F@*!% ' A5	 :AEE $E36E	E2.0** %4D*-
-  H#*-
&(-
$&- 024$#<#"*33rF   c                     ^  \ rS rSrSrSU 4S jjr\4SS jjrSS jr\	S 5       r
\	SS j5       rSS jr\SSS	 jj5       rSS
 jrSS jrSS jrSS jrSU 4S jjrSS jrSS jrSrU =r$ )r(   i  z5Just store all the tags as they are. (internal class)c                N   > [         TU ]  5         [        5       U l        SU l        g)zDefault constructorN)superrD   r   xtagsembedded_objectsrB   r   s    rC   rD   DXFTagStorage.__init__  s    !^
6:rF   c                <    [        SU R                  5        S35      e)NzCopying of tag storage z not supported.)r   r   r   s     rC   r   DXFTagStorage.copy  s"    %dlln%5_E
 	
rF   c                    [        S5      e)Nz cannot transform DXF tag storage)NotImplementedError)rB   ms     rC   	transformDXFTagStorage.transform  s    !"DEErF   c                4    U R                   R                  S   $ )Nr   )r  
subclassesrA   s    rC   r)   DXFTagStorage.base_class  s    zz$$Q''rF   c                8    U R                   R                  S5      $ )zReturns ``True`` if the entity has a graphical representations and
can reside in the model space, a paper space or a block layout,
otherwise the entity is a table or class entry or a DXF object from the
OBJECTS section.

AcDbEntity)r  has_subclassrA   s    rC   is_graphic_entityDXFTagStorage.is_graphic_entity  s     zz&&|44rF   c                   SSK Jn  [        5       n U R                  R	                  S5      nU H1  u  pEUR                  U5      n[        U[        5      (       d  M-  XRU'   M3     U$ ! [
        R                   a    Us $ f = f)a  Returns the graphical properties like layer, color, linetype, ... as
`dxfattribs` dict if the :class:`TagStorage` object represents a graphical
entity otherwise returns an empty dictionary.

These are all the DXF attributes which are stored in the ``AcDbEntity``
subclass.

r   )acdb_entity_group_codesr  )
ezdxf.entities.dxfgfxr  rP   r  get_subclassr   DXFKeyErrorr   r   r   )rB   r  rV   rd   r   r   attrib_names          rC   graphic_properties DXFTagStorage.graphic_properties  s~     	B"&&	::**<8D  KD155d;K+s++',$       	N	s   A& &A?>A?c                (   [        U[        5      (       d   eU R                  US9nU(       a  UR                  OS nUR	                  XS9  UR                  U5        UR                  U5        [        R                  (       a  UR                  5         U$ )N)r:   r`   )
r   r   rW   ra   rb   
store_tagsstore_embedded_objectsr   load_proxy_graphicsload_proxy_graphicrc   s        rC   re   DXFTagStorage.load  sy    $----S!'*S^^
5$%%d+&&%%'rF   c                    U R                   R                  S5      nUR	                  S5       Vs/ s H  o"R
                  PM     nn[        U5      (       a  SR                  U5      U l        g g ! [        R                   a     g f = fs  snf )Nr  i6  rF   )	r  r  r   r  find_allr   rh   joinr@   )rB   rd   r  binary_datas       rC   r   DXFTagStorage.load_proxy_graphic  s{    	::**<8D -1MM#,>?,>Syy,>?{!$+!6D     		?s   A/ B	/BBc                (   Xl         U R                  S   R                  U l         UR	                  S5      nUR                  SS5      U R                  R                  S'   g ! [        R                   a    SU R                  R                  S'    g f = f)Nr   r  C   
paperspace)
r  r)   r   r   r  get_first_valuer;   __dict__r   r  )rB   rd   acdb_entitys      rC   r  DXFTagStorage.store_tags  s~     
q)//	0++L9K.9.I.I"a.PDHHl+   	0./DHHl+	0s   :A! !-BBc                &    UR                   U l         g r  )r  )rB   rd   s     rC   r  $DXFTagStorage.store_embedded_objects"  s     $ 5 5rF   c                    U R                   R                  SS  H  nUR                  U5        M     U R                  (       a%  U R                   H  nUR                  U5        M     gg)z Write subclass tags as they are.r   N)r  r  
write_tagsr  )rB   r  subclassrd   s       rC   r  DXFTagStorage.export_entity%  sY    

--ab1H  * 2   --$$T* . !rF   c                J   > U R                   (       d  g U ?[        TU ]  5         g r  )r   r  r  r  r  s    rC   r  DXFTagStorage.destroy.  s    }}JrF   c              #     #    SSK Jn  U R                  (       aH  U" U R                  U R                  5      R	                  5        H  nUR                  U 5        Uv   M     gg7f)z0Implements the SupportsVirtualEntities protocol.r   )ProxyGraphicN)ezdxf.proxygraphicr  r@   r:   virtual_entitiesr   )rB   r  es      rC   __virtual_entities__"DXFTagStorage.__virtual_entities__5  sN     3!$"4"4dhh?PPR$$T* S s   A!A#c                "    U R                  5       $ )z+Yields proxy graphic as "virtual" entities.)r  rA   s    rC   r  DXFTagStorage.virtual_entities>  s    ((**rF   )r   r  r@   r  r  r  )r  r%   r  r   r  )r  r6   r  )rd   r   r:   r  r  r(   )rd   r   r  r  r  )r  zIterator[DXFGraphic])r  r  r  r  r  rD   r   r   r  r  r)   r  r  r  re   r  r  r  r  r  r  r  r  __classcell__)r   s   @rC   r(   r(     s    ?; ". 

F ( ( 5 5. 	 	7
06++ +rF   r(   )Gr  
__future__r   typingr   r   r   r   r   r	   r
   r   typing_extensionsr   loggingrJ   r*   r   ezdxf.lldxfr   ezdxf.lldxf.tagsr   ezdxf.lldxf.typesr   ezdxf.lldxf.extendedtagsr   ezdxf.lldxf.attributesr   r   r   ezdxf.toolsr    r   r<   r   r   dxfnsr   r   r?   r   r.  r   r   r   r   ezdxf.auditr    ezdxf.documentr!   ezdxf.entitiesr"   r#   ezdxf.lldxf.tagwriterr$   
ezdxf.mathr%   r&   __all__	getLoggerrl   r   rI   r   r)   r  r1   r'   set_default_classr(   rZ   rF   rC   <module>r     s   #	 	 	 #     ! $ 1 F F &  & 2    0#&1.7# L			7	#  1   (A $%!*
 
K   C{#q3 q3h 	t+I t+ t+rF   