
    'jI                    	   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
d0d*%          d1 e
d2d3%          d4 e
d5d*%          d6 e
d7d%          d8 e
d9d$%          d: e
d;d%          d< e
d=d%          d> e
d?d%          d@ e
dAdB%          dC e
d;d %          dD e
dEd*%          i dF e
dG          dH e
dId*%          dJ e
dKd%          dL e
dMd$%          dN e
dOd%          dP e
dQd%          dR e
dSd%          dT e
dUd*%          dV e
dWd%          dX e
dYd$%          dZ e
d[d%          d\ e
d]d%          d^ e
d_d%          d` e
dad*%          db e
dcd*%          dd e
ded%          df e
dgd$%          i dh e
did%          dj e
dkd%          dl e
dmd%          dn e
dod*%          dp e
dqd%          dr e
dsd$%          dt e
dud%          dv e
dwd%          dx e
dyd%          dz e
d{d*%          d| e
d}d*%          d~ e
dd%          d e
dd$%          d e
dd%          d e
dd%          d e
dd%          d e
dw          i d e
d          d e
d5d*%          d e
d7d%          d e
d9d$%          d e
d;d%          d e
d=d%          d e
d?d%          d e
d          d e
d          d e
d          d e
d          d e
d          d e
d          d e
du          d e
d          d e
dy          d e
d           e
d           e
d           e
dw           e
d           e
d           e
d           e
d           e
d           e
d           e
du           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*dS )    )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MaterialCollectiontagsr   codeintreturntuple[Tags, Optional[Matrix44]]c                   g }t                      }| D ]R}|j        |k    r0|                    |j                   t	          |          dk    rd}=|                    |           St	          |          dk    r|t          |          fS | d fS )N   )r   r   appendvaluelenr   )r   r   values	remainingtags        Q/DATA/AppData/hermes/venv/lib/python3.11/site-packages/ezdxf/entities/material.pyfetch_matrixr*      s    FI " "8tMM#)$$$6{{b  S!!!!
6{{b(6****Tz    	tagwriterr   matrixr   Nonec                D    ||D ]}|                      ||           d S d S N)
write_tag2)r,   r   r-   r$   s       r)   export_matrixr2   /   sB     	. 	.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   rE   )r?   rC   r   r.   c                    t                                                       d | _        d | _        d | _        d | _        d | _        d | _        d | _        d S r0   )	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__   sW    9=":>#;?$9="6:<@%8<!!!r+   entityr   c                `   d }t          |t                    sJ  || j                  |_         || j                  |_         || j                  |_         || j                  |_         || j                  |_         || j                  |_         || j                  |_        dS )zCopy material mapper matricesc                2    | d n|                                  S r0   )copy)r-   s    r)   r   z Material.copy_data.<locals>.copy   s    !>44v{{}}<r+   N)	
isinstancer   r   r   r   r   r   r   r   )r   r   copy_strategyr   s       r)   	copy_datazMaterial.copy_data   s    	= 	= 	= &(+++++'+tD,F'G'G$(,T-H(I(I%)-d.J)K)K&'+tD,F'G'G$$(D)@$A$A!*.$t/L*M*M'&*d4+D&E&E###r+   N	processorOptional[SubclassProcessor]r   c                    t                                          |          }|r3|                    |t          dd          }|                     |           |S )Nr   F)log)r   load_dxf_attribsfast_load_dxfattribsacdb_material_group_codesload_matrices)r   r   dxfr   r   s       r)   r   zMaterial.load_dxf_attribs   sc     gg&&y11 	%11.u 2  D t$$$
r+   c                   t          |d          \  }}|r|| _        t          |d          \  }}|r|| _        t          |d          \  }}|r|| _        t          |d          \  }}|r|| _        t          |d          \  }}|r|| _        t          |d          \  }}|r|| _        t          |d          \  }}|r	|| _        d S d S )N+   /   1            )r*   r   r   r   r   r   r   r   )r   r   r-   s      r)   r   zMaterial.load_matrices  s   #D"--f 	0)/D&#D"--f 	1*0D'#D"--f 	2+1D(#D#..f 	0)/D&#D#..f 	-&,D##D#..f 	3,2D)#D"--f 	/(.D%%%	/ 	/r+   r,   r   c                   t                                          |           |                    t          t          j                   | j                            |g d           t          |d| j	                   | j                            |g d           t          |d| j
                   | j                            |g d           t          |d| j                   | j                            |g d           t          |d| j                   | j                            |g d	           t          |d
| j                   | j                            |g d           t          |d| j                   | j                            |g d           t          |d| j                   | j                            |g d           dS )z(Export entity specific data as DXF tags.)r4   r5   r9   r;   r=   r?   rA   rC   rF   rH   rJ   rL   rN   rP   r   )
rR   rT   rU   rW   rY   r[   r]   r_   ra   rc   r   )re   rg   ri   rk   rm   ro   r   )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   r   r   N)r   export_entityr1   r   acdb_materialr4   r   export_dxf_attribsr2   r   r   r   r   r   r   r   )r   r,   r   s     r)   r   zMaterial.export_entity  s?   i(((_m.@AAA##  	
 	
 	
& 	iT%?@@@##  	
 	
 	
 	iT%@AAA##  
	
 
	
 
	
 	iT%ABBB##  	
 	
 	
 	id&@AAA##  
	
 
	
 
	
 	id&=>>>##  	
 	
 	
 	id&CDDD##	 	 		
 	
 	
 	iT%>???##  	
 	
 	
 	
 	
r+   r   r.   )r   r   r   r.   r0   )r   r   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=99J= = = = = = 5A F F F F F  8<	 	 	 	 	 	 	/ / /.G
 G
 G
 G
 G
 G
 G
 G
 G
 G
r+   c                  (     e Zd Zd fdZddZ xZS )	r   docr   c                x    t                                          |dd           |                                  d S )NACAD_MATERIALr   )	dict_nameobject_type)r   r   create_required_entries)r   r   r   s     r)   r   zMaterialCollection.__init__  s:    ZPPP$$&&&&&r+   r   r.   c                B    dD ]}|| vr|                      |           d S )N)ByBlockByLayerGlobal)new)r   r4   s     r)   r   z*MaterialCollection.create_required_entries  s6    4 	 	D4	 	r+   )r   r   r   )r   r   r   r   r   r   r   s   @r)   r   r     sQ        ' ' ' ' ' '       r+   N)r   r   r   r   r   r   )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*   r2   r   r   r   r    r+   r)   <module>r     s   # " " " " " * * * * * * * * " " " " " " - - - - - -            " ! ! ! ! ! 4 4 4 4 4 4 4 4       $ $ $ $ $ $ . . . . . .             '66666666777777&&&&&&+
,   $. . . . ^

^wwq"---^ 	!
 !
 !
^ 	C 8 8 8^ 	wwr{{^ 	!
 !
 !
^ 	C 8 8 8^ 	ww 
  
  
^ 	#GG%
 %
 %
^$ 	ggb!444%^( 	 B!7!7!7)^* 	(*
 *
 *
+^0 	$WWR%;%;%;1^2 	,WWR-C-C-C3^< 	 S!9!9!9=^> 	 "
 "
 "
?^D 	 S!9!9!9E^ ^F 	G^H 	$WW&
 &
 &
I^N 	wwr1555O^R 	!''!R"8"8"8S^T 	)''+
 +
 +
U^Z 	%ggb!&<&<&<[^\ 	-ggc1.E.E.E]^f 	&ww(
 (
 (
g^l 	 a!8!8!8m^p 	#GGAr$:$:$:q^r 	+GG-
 -
 -
s^x 	')
 )
 )
y^~ 	/Q0G0G0G^H 	773,,,I^J 	#GG%
 %
 %
K^P 	ggc1555Q^T 	 B!7!7!7U^ ^ ^V 	(*
 *
 *
W^\ 	$WWS!%<%<%<]^^ 	,WWS!-D-D-D_^h 	 c!:!:!:i^j 	773222k^n 	gga444o^p 	%gg'
 '
 '
q^v 	!''#q"9"9"9w^x 	)''#q*A*A*Ay^B 	GGC555C^D 	&ww(
 (
 (
E^J 	 a!8!8!8K^N 	#GGAr$:$:$:O^P 	+GG-
 -
 -
Q^V 	')
 )
 )
W^\ 	/Q0G0G0G]^h 	WWS\\i^ ^ ^j 	wws||k^l 	"77$
 $
 $
m^r 	WWR333s^v 	2 6 6 6w^x 	')
 )
 )
y^~ 	#GGB$:$:$:^@ 	+GGB,B,B,BA^J 	WWS\\K^L 	wws||M^N 	WWS\\O^P 	wws||Q^R 	ggcllS^T 	WWS\\U^V 	''#,,W^X 	wws||Y^Z 	#GGCLL[^\ 	WWS\\]^ ^^ !$WS\\#GCLL$WS\\$WS\\%gcll$+GBKK")'#,,#*73<<WS\\$WR[[%gbkk R000{^ ^ ^a aD /.}==  J
 J
 J
 J
 J
y J
 J
 J
Z    )(3     r+   