Ë
    £èh€c  ã                  óô   — d dl mZ d dlmZmZmZmZmZ d dlZd dl	m
Z
 d dlmZ d dlmZmZmZmZmZmZmZmZmZ erd dlmZ d dlmZmZ  ej8                  d	«      Zg d
¢Zh d£Z G d„ d«      Z ddd„Z!ddd„Z"y)é    )Úannotations)ÚTYPE_CHECKINGÚIterableÚcastÚUnionÚOptionalN)Úconst)ÚARROWS)	Ú	DXFEntityÚ
DXFGraphicÚHatchÚPolylineÚDimStyleÚ	DimensionÚViewportÚLinetypeÚInsert)ÚDrawing)Ú
BaseLayoutÚLayoutÚezdxf)Ú	linetypesÚlayersÚstylesÚ	dimstyles>   ÚARCÚRAYÚLINEÚMESHÚTEXTÚHATCHÚMTEXTÚPOINTÚSHAPEÚSOLIDÚTRACEÚXLINEÚ3DFACEÚATTDEFÚATTRIBÚCIRCLEÚINSERTÚLEADERÚSPLINEÚELLIPSEÚPOLYLINEÚVIEWPORTÚ	DIMENSIONÚ
LWPOLYLINEc                  ó$  — e Zd ZdZdd„Zd d„Zd!d„Zd"d„Z	 d#	 	 	 d$d„Z	 d#	 	 	 	 	 d%d„Z	d&d„Z
d d	„Zd'd
„Z	 d(	 	 	 	 	 d)d„Zd*d„Zd+d„Zd,d„Zd-d„Zd.d„Z	 d(	 	 	 	 	 d/d„Zd(d0d„Zd1d„Zd1d„Zd2d„Zd3d4d„Zd5d6d„Zd„ Zd2d„Zd2d„Zd„ Zd„ Zd2d„Zy)7ÚImporteraI  
    The :class:`Importer` class is central element for importing data from
    other DXF documents.

    Args:
        source: source :class:`~ezdxf.drawing.Drawing`
        target: target :class:`~ezdxf.drawing.Drawing`

    Attributes:
        source: source DXF document
        target: target DXF document
        used_layers: Set of used layer names as string, AutoCAD accepts layer
            names without a LAYER table entry.
        used_linetypes: Set of used linetype names as string, these linetypes
            require a TABLE entry or AutoCAD will crash.
        used_styles: Set of used text style names, these text styles require
            a TABLE entry or AutoCAD will crash.
        used_dimstyles: Set of used dimension style names, these dimension
            styles require a TABLE entry or AutoCAD will crash.

    c                óÎ  — || _         || _        t        «       | _        t        «       | _        t        «       | _        t        «       | _        t        «       | _        t        «       | _        t        «       | _
        t        «       | _        t        «       | _        |j                  d   j                  j                   | _        |j$                  d   j                  j                   | _        y )NÚNormalÚGlobal)ÚsourceÚtargetÚsetÚused_layersÚused_linetypesÚused_stylesÚused_shape_filesÚused_dimstylesÚused_arrowsÚdictÚhandle_mappingÚlistÚimported_insertsÚimported_blocksÚ
plotstylesÚdxfÚhandleÚ_default_plotstyle_handleÚ	materialsÚ_default_material_handle)Úselfr9   r:   s      ú5lib/python3.12/site-packages/ezdxf/addons/importer.pyÚ__init__zImporter.__init__O   s¬   € Ø%ˆŒØ%ˆŒä%(£UˆÔÜ(+«ˆÔÜ%(£UˆÔÜ*-«%ˆÔÜ(+«ˆÔÜ%(£UˆÔÜ.2«fˆÔô 26³ˆÔô 04«vˆÔØ)/×):Ñ):¸8Ñ)D×)HÑ)H×)OÑ)OˆÔ&Ø(.×(8Ñ(8¸Ñ(B×(FÑ(F×(MÑ(MˆÕ%ó    c                ó¢  — | j                   j                  |j                  dd«      «       | j                  j                  |j                  dd«      «       |j	                  d«      r+| j
                  j                  |j                  dd«      «       |j	                  d«      r,| j                  j                  |j                  dd«      «       yy)	zRegister used resources.ÚlayerÚ0ÚlinetypeÚBYLAYERÚstyleÚStandardÚdimstyleN)r<   ÚaddÚget_dxf_attribr=   Úis_supported_dxf_attribr>   r@   ©rM   Úentitys     rN   Ú_add_used_resourceszImporter._add_used_resourcesd   s§   € à×Ñ×Ñ˜V×2Ñ2°7¸CÓ@ÔAØ×Ñ×Ñ × 5Ñ 5°jÀ)Ó LÔMØ×)Ñ)¨'Ô2Ø×Ñ× Ñ  ×!6Ñ!6°wÀ
Ó!KÔLØ×)Ñ)¨*Ô5Ø×Ñ×#Ñ# F×$9Ñ$9¸*ÀjÓ$QÕRð 6rP   c                ó´  — | j                   j                  |j                  dd«      «       | j                  j                  |j                  dd«      «       | j                  j                  |j                  dd«      «       | j                  j                  |j                  dd«      «       | j                  j                  |j                  dd«      «       | j                  j                  |j                  d	d«      «       | j                  j                  |j                  d
d«      «       | j                  j                  |j                  dd«      «       y )NÚdimtxstyrW   ÚdimltyperU   Údimltex1Údimltex2ÚdimblkÚ Údimblk1Údimblk2Ú	dimldrblk)r>   rY   rZ   r=   rA   )rM   rX   s     rN   Ú_add_dimstyle_resourcesz Importer._add_dimstyle_resourcesm   s
  € Ø×Ñ×Ñ˜X×4Ñ4°ZÀÓLÔMØ×Ñ×Ñ × 7Ñ 7¸
ÀIÓ NÔOØ×Ñ×Ñ × 7Ñ 7¸
ÀIÓ NÔOØ×Ñ×Ñ × 7Ñ 7¸
ÀIÓ NÔOØ×Ñ×Ñ˜X×4Ñ4°X¸rÓBÔCØ×Ñ×Ñ˜X×4Ñ4°YÀÓCÔDØ×Ñ×Ñ˜X×4Ñ4°YÀÓCÔDØ×Ñ×Ñ˜X×4Ñ4°[À"ÓEÕFrP   c                ó®  — |j                   j                  «       sy |j                   j                  «       }| j                  j                  j                  |«      }|€y |j                  j                  dk(  r0| j                  j                  |j                  j                  «       y | j                  j                  |j                  j                  «       y )Nre   )Úpattern_tagsÚis_complex_typeÚget_style_handler9   ÚentitydbÚgetrH   Únamer?   rY   Úfontr>   )rM   rT   Ústyle_handlerV   s       rN   Ú_add_linetype_resourcesz Importer._add_linetype_resourcesw   s•   € Ø×$Ñ$×4Ñ4Ô6ØØ×,Ñ,×=Ñ=Ó?ˆØ—‘×$Ñ$×(Ñ(¨Ó6ˆØˆ=ØØ�9‰9�>‰>˜RÒà×!Ñ!×%Ñ% e§i¡i§n¡nÕ5à×Ñ× Ñ  §¡§¡Õ0rP   c                óx   — t        |t        «      r|dk(  rt        }n|f}|D ]  }| j                  |d|¬«       Œ y)a   Import DXF tables from the source document into the target document.

        Args:
            table_names: iterable of tables names as strings, or a single table
                name as string or "*" for all supported tables
            replace: ``True`` to replace already existing table entries else
                ignore existing entries

        Raises:
            TypeError: unsupported table type

        Ú*)ÚentriesÚreplaceN)Ú
isinstanceÚstrÚIMPORT_TABLESÚimport_table)rM   Útable_namesrw   Ú
table_names       rN   Úimport_tableszImporter.import_tables„   sA   € ô �k¤3Ô'Ø˜cÒ!Ü+‘à*˜n�Û%ˆJØ×Ñ˜j°#¸wÐÕGñ &rP   c           	     óü  — |t         vrt        d|› d�«      ‚t        | j                  j                  |«      }t        | j
                  j                  |«      }t        |t        «      r|dk(  r
d„ |D «       }n|f}|D �]G  }	 |j                  |«      }|j                  j                  }||v ra|rBt        j                  d|› d	|› d
�«       |j!                  |j                  j                  «       nt        j                  d|› d	|› d
�«       Œ‘|dk(  r,| j"                  j%                  |j'                  dd«      «       n-|dk(  r| j)                  |«       n|dk(  r| j+                  |«       | j-                  |«      }|j/                  |«       |j                  j0                  | j2                  |j                  j0                  <   �ŒJ y# t        j                  $ r  t        j                  d|› d|› d�«       Y �Œ~w xY w)aø  
        Import specific table entries from the source document into the
        target document.

        Args:
            name: valid table names are "layers", "linetypes" and "styles"
            entries: Iterable of table names as strings, or a single table name
                or "*" for all table entries
            replace: ``True`` to replace the already existing table entry else
                ignore existing entries

        Raises:
            TypeError: unsupported table type

        zTable "z" import not supported.ru   c              3  óH   K  — | ]  }|j                   j                  –— Œ y ­w©N)rH   rp   )Ú.0Úentrys     rN   Ú	<genexpr>z(Importer.import_table.<locals>.<genexpr>´   s   è ø€ ÐD±|¨e˜5Ÿ9™9Ÿ>�>±|ùs   ‚ "zRequired table entry "z" in table fz not found.z"Replacing already existing entry "z" of z table.z#Discarding already existing entry "r   rT   Ú
Continuousr   r   N)rz   Ú	TypeErrorÚgetattrr9   Útablesr:   rx   ry   ro   r	   ÚDXFTableEntryErrorÚloggerÚwarningrH   rp   ÚdebugÚremover=   rY   rZ   ri   rs   Ú_duplicate_table_entryÚ	add_entryrI   rC   )	rM   rp   rv   rw   Úsource_tableÚtarget_tableÚ
entry_nameÚtable_entryÚnew_table_entrys	            rN   r{   zImporter.import_table›   s÷  € ð$ ”}Ñ$Ü˜g d VÐ+BÐCÓDÐDÜ˜tŸ{™{×1Ñ1°4Ó8ˆÜ˜tŸ{™{×1Ñ1°4Ó8ˆä�gœsÔ#Ø˜#Š~ÙD±|ÓD‘à"˜*�Ü!ˆJðØ*×.Ñ.¨zÓ:�ð %Ÿ™×-Ñ-ˆJØ˜\Ñ)ÙÜ—L‘LØ<¸Z¸Lð IØ"˜V 7ð,ôð !×'Ñ'¨¯©×(<Ñ(<Õ=ä—L‘LØ=¸j¸\ð JØ"˜V 7ð,ôð à�xÒØ×#Ñ#×'Ñ'Ø×.Ñ.¨z¸<ÓHõð ˜Ò$Ø×,Ñ,¨[Õ9Ø˜Ò$Ø×,Ñ,¨[Ô9ð #×9Ñ9¸+ÓFˆOØ×"Ñ" ?Ô3ð ;J×:MÑ:M×:TÑ:TˆD×Ñ §¡× 6Ñ 6Ó7ñM "øô ×+Ñ+ò Ü—‘Ø,¨Z¨L¸ÀTÀFð K!ð "ôò ðús   ÂGÇ/G;Ç:G;c                óL  — |D ]Ÿ  }| j                   j                  j                  |«      }| j                  j                  j	                  |«      }|r8|j
                  j                  | j                  |j
                  j                  <   Œ‡t        j                  d|› d�«       Œ¡ y)z²Import shape file table entries from the source document into the
        target document.
        Shape file entries are stored in the styles table but without a name.

        zRequired shape file entry "ú" not found.N)
r9   r   Úfind_shxr:   Úget_shxrH   rI   rC   rŠ   r‹   )rM   Úfontsrq   r“   r”   s        rN   Úimport_shape_fileszImporter.import_shape_filesß   s�   € ó ˆDØŸ+™+×,Ñ,×5Ñ5°dÓ;ˆKà"Ÿk™k×0Ñ0×8Ñ8¸Ó>ˆOÙà>M×>QÑ>Q×>XÑ>X�×#Ñ# K§O¡O×$:Ñ$:Ò;ä—‘Ð!<¸T¸FÀ,ÐOÕPñ rP   c                ó   — | j                   |_        |j                  j                  d«      r| j                  |j                  _        |j                  j                  d«      r| j                  |j                  _        y y )NÚplotstyle_handleÚmaterial_handle)r:   ÚdocrH   ÚhasattrrJ   rœ   rL   r�   r\   s     rN   Ú_set_table_entry_dxf_attribsz%Importer._set_table_entry_dxf_attribsï   s\   € Ø—[‘[ˆŒ
Ø�:‰:×ÑÐ0Ô1Ø*.×*HÑ*HˆF�J‰JÔ'Ø�:‰:×ÑÐ/Ô0Ø)-×)FÑ)FˆF�J‰JÕ&ð 1rP   c                óˆ   — t        |«      }| j                  |«       | j                  j                  j	                  |«       |S r�   )Únew_clean_entityr    r:   rn   rY   )rM   rƒ   Ú	new_entrys      rN   rŽ   zImporter._duplicate_table_entryö   s:   € ä$ UÓ+ˆ	Ø×)Ñ)¨%Ô0ð 	�‰×Ñ× Ñ  Ô+ØÐrP   Nc                ó¸  ‡ — ˆ fd„}|€‰ j                   j                  «       }n.|j                  ‰ j                   k7  rt        j                  d«      ‚|j                  «       }|t        vr#t        j                  dt        |«      › d�«       y‰ j                  |«       	 t        t        t        |«      «      } ||«       ‰ j                   j                  j!                  |«       |j#                  |«       	  t%        ‰ d|j'                  «       z   «      |«       y# t        j                  $ r t        j                  d|› d�«       Y yw xY w# t(        $ r Y yw xY w)	a£  
        Imports a single DXF `entity` into `target_layout` or the modelspace
        of the target document, if `target_layout` is ``None``.

        Args:
            entity: DXF entity to import
            target_layout: any layout (modelspace, paperspace or block) from
                the target document

        Raises:
            DXFStructureError: `target_layout` is not a layout of target document

        c                óÊ   •— ‰j                   | _        | j                  j                  d«       | j                  j                  d«       | j                  j                  d«       y )Nrœ   r�   Úvisualstyle_handle)r:   rž   rH   Údiscard)ÚerM   s    €rN   Úset_dxf_attribsz/Importer.import_entity.<locals>.set_dxf_attribs  sA   ø€ Ø—K‘KˆAŒEà�E‰E�M‰MÐ,Ô-Ø�E‰E�M‰MÐ+Ô,Ø�E‰E�M‰MÐ.Õ/rP   NzCTarget layout has to be a layout or block from the target document.z
Import of z not supportedzCopying for DXF type z not supported.Ú_import_)r:   Ú
modelspacerž   r	   ÚDXFStructureErrorÚdxftypeÚIMPORT_ENTITIESrŠ   rŒ   ry   r^   r   r   r¢   ÚDXFTypeErrorrn   rY   Ú
add_entityr‡   ÚlowerÚAttributeError)rM   r]   Útarget_layoutr©   r­   Ú
new_entitys   `     rN   Úimport_entityzImporter.import_entityÿ   s5  ø€ ô"	0ð Ð Ø ŸK™K×2Ñ2Ó4‰MØ×Ñ $§+¡+Ò-Ü×)Ñ)ØXóð ð —.‘.Ó"ˆØœ/Ñ)Ü�L‰L˜:¤c¨&£k ]°.ÐAÔBØØ× Ñ  Ô(ð	ÜœjÔ*:¸6Ó*BÓCˆJñ
 	˜
Ô#Ø�‰×Ñ× Ñ  Ô,Ø× Ñ  Ô,ð	Ø7ŒG�D˜* w§}¡}£Ñ6Ó7¸
ÕCøô ×!Ñ!ò 	Ü�L‰LÐ0°°	¸ÐIÔJÙð	ûô ò 	Ùð	ús$   ÂD Ã7#E Ä,E
Å	E
Å	EÅEc                ór   — | j                   j                  |«       |j                  D ]  }t        |«       Œ y r�   )rE   ÚappendÚattribsÚremove_dependencies)rM   ÚinsertÚattribs      rN   Ú_import_insertzImporter._import_insert3  s,   € Ø×Ñ×$Ñ$ VÔ,à—n”nˆFÜ Õ'ñ %rP   c                ó<   — |j                   D ]  }t        |«       Œ y r�   )Úverticesr¹   )rM   ÚpolylineÚvertexs      rN   Ú_import_polylinezImporter._import_polyline9  s   € à×'Ô'ˆFÜ Õ'ñ (rP   c                ó:   — |j                   j                  d«       y )NÚassociative©rH   r§   )rM   Úhatchs     rN   Ú_import_hatchzImporter._import_hatch>  s   € Ø�	‰	×Ñ˜-Õ(rP   c                óV  — |j                   j                  d«       |j                   j                  d«       |j                   j                  d«       |j                   j                  d«       |j                   j                  d«       |j                   j                  d«       |j                   j                  d«       |j                   j                  d«       |j                   j                  d	«       |j                   j                  d
«       |j                   j                  d«       y )NÚ
sun_handleÚclipping_boundary_handleÚ
ucs_handleÚucs_base_handleÚbackground_handleÚshade_plot_handleÚvisual_style_handleÚref_vp_object_1Úref_vp_object_2Úref_vp_object_3Úref_vp_object_4rÄ   )rM   Úviewports     rN   Ú_import_viewportzImporter._import_viewportA  sÑ   € Ø�‰×Ñ˜\Ô*Ø�‰×ÑÐ7Ô8Ø�‰×Ñ˜\Ô*Ø�‰×ÑÐ.Ô/Ø�‰×ÑÐ0Ô1Ø�‰×ÑÐ0Ô1Ø�‰×ÑÐ2Ô3Ø�‰×ÑÐ.Ô/Ø�‰×ÑÐ.Ô/Ø�‰×ÑÐ.Ô/Ø�‰×ÑÐ.Õ/rP   c                óú   — |j                   rZ|j                   D ]J  }t        |t        «      r'| j                  |j                  j
                  d¬«       | j                  |«       ŒL y t        j                  d«       y )NF©Úrenamez9The required geometry block for DIMENSION is not defined.)	Úvirtual_block_contentrx   r   Úimport_blockrH   rp   r^   rŠ   Úerror)rM   Ú	dimensionr]   s      rN   Ú_import_dimensionzImporter._import_dimensionN  s]   € Ø×*Ò*Ø#×9Ô9�Ü˜f¤fÔ-Ø×%Ñ% f§j¡j§o¡o¸eÐ%ÔDØ×(Ñ(¨Õ0ñ :ô
 �L‰LÐTÕUrP   c                ó6   — |D ]  }| j                  ||«       Œ y)a˜  Import all `entities` into `target_layout` or the modelspace of the
        target document, if `target_layout` is ``None``.

        Args:
            entities: Iterable of DXF entities
            target_layout: any layout (modelspace, paperspace or block) from
                the target document

        Raises:
            DXFStructureError: `target_layout` is not a layout of target document

        N)rµ   )rM   Úentitiesr³   r]   s       rN   Úimport_entitieszImporter.import_entitiesW  s   € ó" ˆFØ×Ñ˜v }Õ5ñ rP   c                óZ   — | j                  | j                  j                  «       |¬«       y)a~  Import all entities from source modelspace into `target_layout` or
        the modelspace of the target document, if `target_layout` is ``None``.

        Args:
            target_layout: any layout (modelspace, paperspace or block) from
                the target document

        Raises:
            DXFStructureError: `target_layout` is not a layout of target document

        ©r³   N)rß   r9   r«   )rM   r³   s     rN   Úimport_modelspacezImporter.import_modelspacek  s$   € ð 	×Ñ˜TŸ[™[×3Ñ3Ó5À]ÐÕSrP   c                ó^  ‡ ‡— ˆˆ fd„}dd„}‰j                  «       dk(  r‰ j                  j                  «       S ‰ j                  j                  j                  ‰«      } |«       } ||j                  j                  «       «      }‰ j                  j                  j                  ||¬«      }|S )aX  Recreate source paperspace layout `name` in the target document.
        The layout will be renamed if `name` already exist in the target
        document. Returns target modelspace for layout name "Model".

        Args:
            name: layout name as string

        Raises:
            KeyError: if source layout `name` not exist

        c                 óœ   •— ‰} ‰}d}| ‰j                   j                  v r,|t        |«      z   } |dz  }| ‰j                   j                  v rŒ,| S )Né   )r:   Úlayoutsry   )ÚtnameÚ	base_nameÚcountrp   rM   s      €€rN   Úget_target_namez8Importer.recreate_source_layout.<locals>.get_target_name†  sV   ø€ ØˆEØˆIØˆEØ˜4Ÿ;™;×.Ñ.Ñ.Ø!¤C¨£JÑ.�Ø˜‘
�ð ˜4Ÿ;™;×.Ñ.Ò.ð ˆLrP   c                ó”   ‡ — d
ˆ fd„} |d«        |d«        |d«        |d«        |d«        |d«        |d«        |d	«       ‰ S )Nc                ó,   •— 	 ‰| = y # t         $ r Y y w xY wr�   )ÚKeyError)rp   Ú
dxfattribss    €rN   r§   z?Importer.recreate_source_layout.<locals>.clear.<locals>.discard‘  s"   ø€ ðØ" 4Ñ(øÜò Ùðús   ƒ ‡	’rI   ÚownerÚtaborderrÍ   Úblock_record_handleÚviewport_handlerÊ   Úbase_ucs_handle)rp   ry   © )rî   r§   s   ` rN   Úclearz.Importer.recreate_source_layout.<locals>.clear�  sT   ø€ õñ �HÔÙ�GÔÙ�JÔÙÐ'Ô(ÙÐ)Ô*ÙÐ%Ô&Ù�LÔ!ÙÐ%Ô&ØÐrP   Úmodel)rî   )rî   rB   ÚreturnrB   )	r±   r:   r«   r9   ræ   ro   Ú
dxf_layoutrî   Únew)rM   rp   rê   rõ   Úsource_layoutÚtarget_namerî   r³   s   ``      rN   Úrecreate_source_layoutzImporter.recreate_source_layouty  s�   ù€ õ	ó	ð" �:‰:‹<˜7Ò"Ø—;‘;×)Ñ)Ó+Ð+àŸ™×+Ñ+×/Ñ/°Ó5ˆÙ%Ó'ˆÙ˜=×3Ñ3×>Ñ>Ó@ÓAˆ
ØŸ™×+Ñ+×/Ñ/°È
Ð/ÓSˆØÐrP   c                óæ   — |j                  «       dk(  rt        j                  d«      ‚| j                  j                  j                  |«      }| j                  |«      }| j                  ||«       |S )a?  Import paperspace layout `name` into the target document.

        Recreates the source paperspace layout in the target document, renames
        the target paperspace if a paperspace with same `name` already exist
        and imports all entities from the source paperspace into the target
        paperspace.

        Args:
            name: source paper space name as string

        Returns: new created target paperspace :class:`Layout`

        Raises:
            KeyError: source paperspace does not exist
            DXFTypeError: invalid modelspace import

        rö   z:Can not import modelspace, use method import_modelspace().)r±   r	   r¯   r9   ræ   ro   rü   rß   )rM   rp   rú   r³   s       rN   Úimport_paperspace_layoutz!Importer.import_paperspace_layoutª  sj   € ð$ �:‰:‹<˜7Ò"Ü×$Ñ$ØLóð ð Ÿ™×+Ñ+×/Ñ/°Ó5ˆØ×3Ñ3°DÓ9ˆØ×Ñ˜]¨MÔ:ØÐrP   c                ó    — | j                   j                  j                  «       D ]'  }|j                  «       dk7  sŒ| j	                  |«       Œ) y)zèImport all paperspace layouts and their content into the target
        document.
        Target layouts will be renamed if a layout with the same name already
        exist. Layouts will be imported in original tab order.

        rö   N)r9   ræ   Únames_in_taborderr±   rþ   )rM   rp   s     rN   Úimport_paperspace_layoutsz"Importer.import_paperspace_layoutsÅ  s=   € ð —K‘K×'Ñ'×9Ñ9Ö;ˆDØ�z‰z‹|˜wÓ&Ø×-Ñ-¨dÕ3ñ <rP   c                ó8   — |D ]  }| j                  ||¬«       Œ y)a³  Import all BLOCK definitions from source document.

        If a BLOCK already exist the BLOCK will be renamed if argument
        `rename` is ``True``, otherwise the existing BLOCK in the target
        document will be used instead of the BLOCK from the source document.
        Required name resolving for imported BLOCK references (INSERT), will be
        done in the :meth:`Importer.finalize` method.

        Args:
            block_names: names of BLOCK definitions to import
            rename: rename BLOCK if a BLOCK with the same name already exist in
                target document

        Raises:
            ValueError: BLOCK in source document not found (defined)

        rÖ   N)rÙ   )rM   Úblock_namesr×   Ú
block_names       rN   Úimport_blockszImporter.import_blocksÐ  s!   € ó$ &ˆJØ×Ñ˜j°ÐÕ8ñ &rP   c                óx  ‡‡— dˆˆfd„}	 | j                   ‰   S # t        $ r Y nw xY w	 | j                  j                  ‰   }n&# t        j
                  $ r t        d‰› d�«      ‚w xY w| j                  j                  Š‰‰v r|du r‰| j                   ‰<   ‰S  |«       }|j                  }|€J ‚‰j                  ||j                  j                  |j                  j                  |j                  j                  |j                  j                  dœ¬«      }| j                  ||¬«       || j                   ‰<   |S )	az  Import one BLOCK definition from source document.

        If the BLOCK already exist the BLOCK will be renamed if argument
        `rename` is ``True``, otherwise the existing BLOCK in the target
        document will be used instead of the BLOCK in the source document.
        Required name resolving for imported block references (INSERT), will be
        done in the :meth:`Importer.finalize` method.

        To replace an existing BLOCK in the target document, just delete it
        before importing data:
        :code:`target.blocks.delete_block(block_name, safe=False)`

        Args:
            block_name: name of BLOCK to import
            rename: rename BLOCK if a BLOCK with the same name already exist in
                target document

        Returns: (renamed) BLOCK name

        Raises:
            ValueError: BLOCK in source document not found (defined)

        c                 óH   •— d} ‰}|‰v r‰t        | «      z   }| dz  } |‰v rŒ|S )Nr   rå   )ry   )Únumrp   r  Útarget_blockss     €€rN   Úget_new_block_namez1Importer.import_block.<locals>.get_new_block_nameþ  s=   ø€ ØˆCØˆDØ˜-Ñ'Ø!¤C¨£HÑ,�Ø�q‘�ð ˜-Ò'ð ˆKrP   zSource block "r–   F)ÚdescriptionÚflagsÚ	xref_path)Ú
base_pointrî   rá   )r÷   ry   )rF   rí   r9   Úblocksr	   ÚDXFKeyErrorÚ
ValueErrorr:   Úblockrù   rH   r  r  r  r  rß   )	rM   r  r×   r
  Úsource_blockÚnew_block_namer  Útarget_blockr	  s	    `      @rN   rÙ   zImporter.import_blockå  sC  ù€ ö2	ð	Ø×'Ñ'¨
Ñ3Ð3øÜò 	Ùð	úð	HØŸ;™;×-Ñ-¨jÑ9‰LøÜ× Ñ ò 	HÜ˜~¨j¨\¸ÐFÓGÐGð	Húð Ÿ™×*Ñ*ˆØ˜-Ñ'¨f¸©oØ/9ˆD× Ñ  Ñ,ØÐá+Ó-ˆØ×"Ñ"ˆØÐ Ð Ð Ø$×(Ñ(ØØ—y‘y×+Ñ+à$Ÿy™y×4Ñ4ØŸ™Ÿ™Ø"ŸY™Y×0Ñ0ñð )ó 
ˆð 	×Ñ˜\¸ÐÔFØ+9ˆ×Ñ˜ZÑ(ØÐs   ‹ š	&¥&ªA Á#A'c                óä   — | j                   j                  d«       | j                   D ]F  }t        j                  |«      r| j                  j                  |«       Œ4| j                  |d¬«       ŒH y)zÕCreate or import required arrow blocks, used by the LEADER or the
        DIMSTYLE entity, which are not imported automatically because they are
        not used in an anonymous DIMENSION geometry BLOCK.

        re   FrÖ   N)rA   r§   r
   Úis_acad_arrowr:   Úacquire_arrowrÙ   )rM   Ú
arrow_names     rN   Ú_create_missing_arrowszImporter._create_missing_arrows%  s`   € ð 	×Ñ× Ñ Øô	
ð ×*Ô*ˆJÜ×#Ñ# JÔ/Ø—‘×)Ñ)¨*Õ5à×!Ñ! *°UÐ!Õ;ñ	 +rP   c                ó  — t        | j                  «      rpt        | j                  «      }g | _        |D ]8  }| j                  |j                  j
                  «      }||j                  _        Œ: t        | j                  «      rŒoyy)a  Resolve BLOCK names of imported BLOCK reference entities (INSERT).

        This is required for the case the name of the imported BLOCK collides
        with an already existing BLOCK in the target document and the conflict
        resolving method is "rename".

        N)ÚlenrE   rD   rÙ   rH   rp   )rM   Úinsertsrº   r  s       rN   Ú_resolve_insertszImporter._resolve_inserts4  sg   € ô �$×'Ñ'Ô(Ü˜4×0Ñ0Ó1ˆGà$&ˆDÔ!Û!�Ø!×.Ñ.¨v¯z©z¯©Ó?�
Ø",�—
‘
•ð "ô	 �$×'Ñ'×(rP   c                ó  — t        | j                  «      r| j                  d| j                  «       t        | j                  «      r| j                  d| j                  «       t        | j                  «      r| j                  d| j                  «       t        | j
                  «      r| j                  d| j
                  «       t        | j                  «      r| j                  | j                  «       | j                  «        y)zlImport required table entries collected while importing entities
        into the target document.

        r   r   r   r   N)	r  r@   r{   r<   r=   r>   r?   rš   Úupdate_complex_linetypes©rM   s    rN   Ú_import_required_table_entriesz'Importer._import_required_table_entriesD  sÌ   € ô ˆt×"Ñ"Ô#Ø×Ñ˜k¨4×+>Ñ+>Ô?ô ˆt×ÑÔ Ø×Ñ˜h¨×(8Ñ(8Ô9ô ˆt×"Ñ"Ô#Ø×Ñ˜k¨4×+>Ñ+>Ô?ô ˆt×ÑÔ Ø×Ñ˜h¨×(8Ñ(8Ô9ô ˆt×$Ñ$Ô%Ø×#Ñ# D×$9Ñ$9Ô:ð 	×%Ñ%Õ'rP   c                óÆ   — | j                   D ]9  }	 | j                  j                  j                  |«      }| j                  |«       Œ; y # t        j
                  $ r Y ŒRw xY wr�   )r=   r9   r   ro   r	   r‰   rs   )rM   Ú
ltype_nameÚltypes      rN   Ú(_add_required_complex_linetype_resourcesz1Importer._add_required_complex_linetype_resourcesa  s[   € Ø×-Ô-ˆJðØŸ™×-Ñ-×1Ñ1°*Ó=�ð ×(Ñ(¨Õ/ñ .øô ×+Ñ+ò Ùðús   ‘%A
Á
A ÁA c                ó„  — | j                   j                  j                  d«      j                  j                  }| j                   j
                  D ]n  }|j                  j                  «       sŒ|j                  j                  «       }| j                  j                  ||«      }|j                  j                  |«       Œp y )NÚSTANDARD)r:   r   ro   rH   rI   r   rk   rl   rm   rC   Úset_style_handle)rM   Ú
std_handlerT   Ú
old_handleÚ
new_handles        rN   r   z!Importer.update_complex_linetypesi  sŽ   € Ø—[‘[×'Ñ'×+Ñ+¨JÓ7×;Ñ;×BÑBˆ
ØŸ™×-Ô-ˆHØ×$Ñ$×4Ñ4Õ6Ø%×2Ñ2×CÑCÓE�
Ø!×0Ñ0×4Ñ4°ZÀÓL�
Ø×%Ñ%×6Ñ6°zÕBñ	 .rP   c                ó„   — | j                  «        | j                  «        | j                  «        | j                  «        y)a  Finalize the import by importing required table entries and BLOCK
        definitions, without finalization the target document is maybe invalid
        for AutoCAD. Call the :meth:`~Importer.finalize()` method as last step
        of the import process.

        N)r  r&  r"  r  r!  s    rN   ÚfinalizezImporter.finalizeq  s4   € ð 	×ÑÔØ×5Ñ5Ô7Ø×+Ñ+Ô-Ø×#Ñ#Õ%rP   )r9   r   r:   r   )r]   r   r÷   ÚNone)rX   r   r÷   r/  )rT   r   r÷   r/  )ru   F)r|   úUnion[str, Iterable[str]]r÷   r/  )rp   ry   rv   r0  r÷   r/  )r™   zset[str]r÷   r/  )rƒ   r   r÷   r   r�   )r]   r   r³   úOptional[BaseLayout]r÷   r/  )rº   r   )r¿   r   )rÅ   r   )rÓ   r   )rÛ   r   )rÞ   zIterable[DXFEntity]r³   r1  r÷   r/  )r³   r1  r÷   r/  )rp   ry   r÷   r   )r÷   r/  ©F)r  zIterable[str]r÷   r/  )T)r  ry   r÷   ry   ) Ú__name__Ú
__module__Ú__qualname__Ú__doc__rO   r^   ri   rs   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ô   rP   rN   r5   r5   8   s   „ ñó,Nó*SóGó1ð EJðHØ4ðHà	óHð0 LQðBUØðBUØ";ðBUà	óBUóHQó Góð HLð2Øð2Ø0Dð2à	ó2óh(ó(ó
)ó0óVð /3ð6à%ð6ð ,ð6ð 
ó	6ô(Tó/óbó6	4ô9ô*>ò@<ó-ó (ò:0òCô
&rP   r5   c                óJ   — | j                  «       }d|_        t        ||¬«      S )z�Copy entity and remove all external dependencies.

    Args:
        entity: DXF entity
        keep_xdata: keep xdata flag

    N)Ú
keep_xdata)Úcopyrž   r¹   )r]   r8  r´   s      rN   r¢   r¢   ~  s#   € ð —‘“€JØ€J„NÜ˜z°jÔAÐArP   c                óB   — d| _         d| _        d| _        |sd| _        | S )zqRemove all external dependencies.

    Args:
        entity: DXF entity
        keep_xdata: keep xdata flag

    N)ÚappdataÚreactorsÚextension_dictÚxdata)r]   r8  s     rN   r¹   r¹   ‹  s)   € ð €F„NØ€F„OØ €FÔÙØˆŒØ€MrP   r2  )r]   r   r8  Úboolr÷   r   )#Ú
__future__r   Útypingr   r   r   r   r   ÚloggingÚezdxf.lldxfr	   Úezdxf.render.arrowsr
   Úezdxf.entitiesr   r   r   r   r   r   r   r   r   Úezdxf.documentr   Úezdxf.layoutsr   r   Ú	getLoggerrŠ   rz   r®   r5   r¢   r¹   rô   rP   rN   Ú<module>rI     si   ðõ #ß AÕ AÛ Ý Ý &÷
÷ 
õ 
ñ Ý&ß0à	ˆ×	Ñ	˜7Ó	#€â>€ò€÷8C	&ñ C	&ôL
BõrP   