
    OgI                       d dl mZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZ d dlmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ d dlmZ ddlmZ erd dlmZmZ d dl m!Z! d dl"m#Z# ddgZ$ddZ%ddZ& edi d e
d      d e
dd      d e
dd       d e
dd      d  e
d!      d" e
d#d       d$ e
d%d      d& e
d'd(      d) e
d*d      d+ e
d,d      d- e
d.d      d/ e
d0d      d1 e
d2d      d3 e
d4d      d5 e
d6d7      d8 e
d0d       d9 e
d:d      i d; e
d<      d= e
d>d      d? e
d@d      dA e
dBd      dC e
dDd      dE e
dFd      dG e
dHd      dI e
dJd      dK e
dLd      dM e
dNd      dO e
dPd      dQ e
dRd      dS e
dTd      dU e
dVd      dW e
dXd      dY e
dZd      d[ e
d\d      i d] e
d^d      d_ e
d`d      da e
dbd      dc e
ddd      de e
dfd      dg e
dhd      di e
djd      dk e
dld      dm e
dnd      do e
dpd      dq e
drd      ds e
dtd      du e
dvd      dw e
dxd      dy e
dzd      d{ e
d|d      d} e
dl      i d~ e
d      d e
d*d      d e
d,d      d e
d.d      d e
d0d      d e
d2d      d e
d4d      d e
d      d e
d      d e
d      d e
d      d e
d      d e
d      d e
dj      d e
d      d e
dn      d e
dt       e
d       e
d       e
dl       e
d       e
d       e
d       e
d       e
d       e
d       e
dj       e
d       e
d!       e
d       e
d       e
dd      d      Z' ee'      Z(e G d de             Z) G d dee)         Z*y)    )annotations)TYPE_CHECKINGOptional)Self)SUBCLASS_MARKER)DXFAttrDXFAttributesDefSubclassgroup_code_mapping)Tags   )
base_classSubclassProcessor)	DXFObject)register_entity)ObjectCollection)Matrix44)default_copy)DXFNamespace	DXFEntity)AbstractTagWriter)DrawingMaterialMaterialCollectionc                    g }t               }| D ]O  }|j                  |k(  r-|j                  |j                         t	        |      dk(  s<d}?|j                  |       Q t	        |      dk(  r|t        |      fS | d fS )N   )r   codeappendvaluelenr   )tagsr   values	remainingtags        \/var/www/html/public_html/myphp/venv/lib/python3.12/site-packages/ezdxf/entities/material.pyfetch_matrixr'      s    FI "88tMM#))$6{b S!" 6{b(6***Tz    c                <    ||D ]  }| j                  ||        y y N)
write_tag2)	tagwriterr   matrixr    s       r&   export_matrixr.   /   s,     	.E  u-	. r(   AcDbMaterialnamedescription    )defaultambient_color_methodF   ambient_color_factor(   g      ?ambient_color_valueZ   diffuse_color_methodG   diffuse_color_factor)   diffuse_color_value[   diffuse_map_blend_factor*   diffuse_map_sourceH   diffuse_map_file_name   diffuse_map_projection_methodI   diffuse_map_tiling_methodJ   !diffuse_map_auto_transform_methodK   specular_gloss_factor,   g      ?specular_color_methodspecular_color_factor-   specular_color_value\   specular_map_blend_factor.   specular_map_sourceM   specular_map_file_name   specular_map_projection_methodN   specular_map_tiling_methodO   "specular_map_auto_transform_method   reflection_map_blend_factor0   reflection_map_source   reflection_map_file_name    reflection_map_projection_method   reflection_map_tiling_method   $reflection_map_auto_transform_method   opacity   opacity_map_blend_factor   opacity_map_source   opacity_map_file_name   opacity_map_projection_method   opacity_map_tiling_method   !opacity_map_auto_transform_method   bump_map_blend_factor   bump_map_source   bump_map_file_name   bump_map_projection_methodi  bump_map_tiling_methodi  bump_map_auto_transform_methodi  refraction_index   refraction_map_blend_factor   refraction_map_sourcei  refraction_map_file_name	    refraction_map_projection_methodi  refraction_map_tiling_methodi  $refraction_map_auto_transform_methodi  normal_map_methodnormal_map_strengthi  normal_map_blend_factornormal_map_sourcenormal_map_file_namenormal_map_projection_methodnormal_map_tiling_method normal_map_auto_transform_methodcolor_bleed_scalei  indirect_dump_scalei  reflectance_scalei  transmittance_scalei  two_sided_materiali"  	luminancei  luminance_modematerials_anonymousi%  global_illumination_modefinal_gather_modei,  i#  i  i-  i$  >   i  i     i  ]   ^   ?   )gen_proc_namegen_proc_val_boolgen_proc_val_intgen_proc_val_realgen_proc_val_textgen_proc_table_endgen_proc_val_color_indexgen_proc_val_color_rgbgen_proc_val_color_name	map_utiletranslucenceself_illuminationreflectivityillumination_modelchannel_flagsc                  t     e Zd ZdZdddZ eee      Zd
 fdZ	e
fddZ	 d	 	 	 d fdZd Zd fd	Z xZS )r   MATERIALr   rA   )r;   r?   c                    t         |           d | _        d | _        d | _        d | _        d | _        d | _        d | _        y r*   )	super__init__diffuse_mapper_matrixspecular_mapper_matrixreflexion_mapper_matrixopacity_mapper_matrixbump_mapper_matrixrefraction_mapper_matrixnormal_mapper_matrix)self	__class__s    r&   r   zMaterial.__init__   sF    9=":>#;?$9="6:<@%8<!r(   c                p   d }t        |t              sJ  || j                        |_         || j                        |_         || j                        |_         || j
                        |_         || j                        |_         || j                        |_         || j                        |_        y)zCopy material mapper matricesc                *    | d S | j                         S r*   )copy)r-   s    r&   r   z Material.copy_data.<locals>.copy   s    !>4<v{{}<r(   N)	
isinstancer   r   r   r   r   r   r   r   )r   entitycopy_strategyr   s       r&   	copy_datazMaterial.copy_data   s    	= &(+++'+D,F,F'G$(,T-H-H(I%)-d.J.J)K&'+D,F,F'G$$()@)@$A!*.t/L/L*M'&*4+D+D&E#r(   c                ~    t         |   |      }|r*|j                  |t        dd      }| j	                  |       |S )Nr   F)log)r   load_dxf_attribsfast_load_dxfattribsacdb_material_group_codesload_matrices)r   	processordxfr"   r   s       r&   r   zMaterial.load_dxf_attribs   sK     g&y111.u 2 D t$
r(   c                V   t        |d      \  }}|r|| _        t        |d      \  }}|r|| _        t        |d      \  }}|r|| _        t        |d      \  }}|r|| _        t        |d      \  }}|r|| _        t        |d      \  }}|r|| _        t        |d      \  }}|r|| _        y y )N+   /   1            )r'   r   r   r   r   r   r   r   )r   r"   r-   s      r&   r   zMaterial.load_matrices  s    #D"-f)/D&#D"-f*0D'#D"-f+1D(#D#.f)/D&#D#.f&,D##D#.f,2D)#D"-f(.D% r(   c                   t         |   |       |j                  t        t        j
                         | j                  j                  |g d       t        |d| j                         | j                  j                  |g d       t        |d| j                         | j                  j                  |g d       t        |d| j                         | j                  j                  |g d       t        |d| j                         | j                  j                  |g d	       t        |d
| j                         | j                  j                  |g d       t        |d| j                         | j                  j                  |g d       t        |d| j                         | j                  j                  |g d       y)z(Export entity specific data as DXF tags.)r0   r1   r5   r7   r9   r;   r=   r?   rB   rD   rF   rH   rJ   rL   r   )
rN   rP   rQ   rS   rU   rW   rY   r[   r]   r_   r   )ra   rc   re   rg   ri   rk   r   )rm   ro   rq   rs   ru   rw   ry   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   r   r   r   r   r   N)r   export_entityr+   r   acdb_materialr0   r   export_dxf_attribsr.   r   r   r   r   r   r   r   )r   r,   r   s     r&   r   zMaterial.export_entity  s   i(_m.@.@A##	
& 	iT%?%?@##	
 	iT%@%@A##
	
 	iT%A%AB##	
 	id&@&@A##
	
 	id&=&=>##	
 	id&C&CD##		
 	iT%>%>?##	
r(   returnNone)r   r   r   r   r*   )r   zOptional[SubclassProcessor]r   r   )r,   r   r   r   )__name__
__module____qualname__DXFTYPEDEFAULT_ATTRIBSr	   r   r   
DXFATTRIBSr   r   r   r   r   r   __classcell__r   s   @r&   r   r      s_    G !*O z=9J= 5A F  8<	4			/.G
 G
r(   c                  (     e Zd Zd fdZddZ xZS )r   c                J    t         |   |dd       | j                          y )NACAD_MATERIALr   )	dict_nameobject_type)r   r   create_required_entries)r   docr   s     r&   r   zMaterialCollection.__init__  s#    ZP$$&r(   c                >    dD ]  }|| vs| j                  |        y )N)ByBlockByLayerGlobal)new)r   r0   s     r&   r   z*MaterialCollection.create_required_entries  s$    4 	D4	r(   )r   r   r   )r   r   r   r   r   r   r   s   @r&   r   r     s    'r(   N)r"   r   r   intr   ztuple[Tags, Optional[Matrix44]])r,   r   r   r   r-   r   r   r   )+
__future__r   typingr   r   typing_extensionsr   ezdxf.lldxf.constr   ezdxf.lldxf.attributesr   r	   r
   r   ezdxf.lldxf.tagsr   	dxfentityr   r   dxfobjr   factoryr   objectcollectionr   
ezdxf.mathr   r   r   ezdxf.entitiesr   r   ezdxf.lldxf.tagwriterr   ezdxf.documentr   __all__r'   r.   r   r   r   r    r(   r&   <module>r     s   # * " -  " 4  $ .  67&+
,$. ^
^wq"-^ 	!
^ 	C 8^ 	wr{^ 	!
^ 	C 8^ 	w 
^ 	#G%
^$ 	gb!4%^( 	 B!7)^* 	(*
+^0 	$WR%;1^2 	,WR-C3^< 	 S!9=^> 	 "
?^D 	 S!9E^F 	G^H 	$W&
I^N 	wr15O^R 	!'!R"8S^T 	)'+
U^Z 	%gb!&<[^\ 	-gc1.E]^f 	&w(
g^l 	 a!8m^p 	#GAr$:q^r 	+G-
s^x 	')
y^~ 	/Q0G^H 	73,I^J 	#G%
K^P 	gc15Q^T 	 B!7U^V 	(*
W^\ 	$WS!%<]^^ 	,WS!-D_^h 	 c!:i^j 	732k^n 	ga4o^p 	%g'
q^v 	!'#q"9w^x 	)'#q*Ay^B 	GC5C^D 	&w(
E^J 	 a!8K^N 	#GAr$:O^P 	+G-
Q^V 	')
W^\ 	/Q0G]^h 	WS\i^j 	ws|k^l 	"7$
m^r 	WR3s^v 	2 6w^x 	')
y^~ 	#GB$:^@ 	+GB,BA^J 	WS\K^L 	ws|M^N 	WS\O^P 	ws|Q^R 	gclS^T 	WS\U^V 	'#,W^X 	ws|Y^Z 	#GCL[^\ 	WS\]^^ !$S\#CL$S\$S\%cl$+BK")#,#*3<S\$R[%bk R0{^aD /}=  J
y J
 J
Z)(3 r(   