
    Og-
                        d dl mZ d dlmZ d dlZd dlZd dlZd dlmZ d dl	m
Z
 d dlmZmZ ddgZdd	Zdd
ZddZddZddZddZy)    )annotations)TextION)Drawing)
Modelspace)	TagWriterAbstractTagWriterexport_fileexport_streamc                N    t        j                  |ddd      }t        | |       y)zExports the specified DXF R12 document, which should contain content conforming
    to the ASTM-D6673-10 standard, in a special way so that Gerber Technology applications
    can parse it by their low-quality DXF parser.
    wtascii
dxfreplace)modeencodingerrorsN)ioopenr
   )docfilenamefps      ^/var/www/html/public_html/myphp/venv/lib/python3.12/site-packages/ezdxf/addons/gerber_D6673.pyr	   r	      s"    
 
w|	LB#r    c                    | j                   t        j                  j                  k7  rt        j                  d      t        |dt        j                  j                        }t        | |       y)z>Exports the specified DXF R12 document into a `stream` object.z only DXF R12 format is supportedF)write_handles
dxfversionN)r   ezdxfconstDXF12DXFVersionErrorr   _export_sections)r   stream	tagwriters      r   r
   r
      sN     ~~***##$FGG&%++BSBSTIS)$r   c                f    t        |       t        | |       t        | j                         |       y )N)_export_header_export_blocks_export_entities
modelspace)r   r"   s     r   r    r    #   s%    93	"S^^%y1r   c                J    | j                  d       | j                  dd       y )Nz  0
SECTION
  2
HEADER
r   ENDSEC)	write_str
write_tag2)r"   s    r   r$   r$   )   s!    56H%r   c                    |j                  d       | j                  D ]   }|j                  s|j                  |       " |j	                  dd       y )Nz  0
SECTION
  2
BLOCKS
r   r)   )r*   block_recordsis_block_layoutexport_block_definitionr+   )r   r"   block_records      r   r%   r%   /   sQ     56)) <''00;< H%r   c                    |j                  d       | j                  j                  |       |j                  dd       |j                  dd       y )Nz  0
SECTION
  2
ENTITIES
r   r)   EOF)r*   entity_space
export_dxfr+   )mspr"   s     r   r&   r&   A   sE    78	*H%E"r   )r   r   r   zstr | os.PathLikereturnNone)r   r   r!   r   r6   r7   )r   r   r"   r   r6   r7   )r"   r   r6   r7   )r5   r   r"   r   r6   r7   )
__future__r   typingr   osr   r   ezdxf.documentr   ezdxf.layoutsr   ezdxf.lldxf.tagwriterr   r   __all__r	   r
   r    r$   r%   r&    r   r   <module>r@      sG    #  	 	  " $ >/
*%2&&$#r   