Esempio n. 1
0
def dxf_stream_info(stream):
    """
    Reads basic DXF information from a text stream: DXF version, encoding and handle seed.

    Returns:
        DXF info object with attributes: version, release, handseed, encoding

    """
    info = dxf_info(stream)
    if info.version >= 'AC1021':  # R2007 files and later are always encoded as UTF-8
        info.encoding = 'utf-8'
    return info
Esempio n. 2
0
def checkhandles(stream):
    info = dxf_info(stream)
    stream.seek(0)
    handles = []
    iterator = TagIterator(stream)
    for tag in iterator:
        if tag.code in (5, 105):
            try:
                handle = int(tag.value, 16)
            except ValueError:
                print('invalid handle at line number %d' % iterator.lineno)
            else:
                handles.append(handle)
    printhandles(handles, info)
Esempio n. 3
0
 def get_dxf_info(self):
     info = dxf_info(self)
     # since DXF R2007 (AC1021) file encoding is always 'utf-8'
     self.encoding = info.encoding if info.version < 'AC1021' else 'utf-8'
     self.dxfversion = info.version
Esempio n. 4
0
 def get_dxf_encoding(self):
     info = dxf_info(self)
     # since DXF R2007 (AC1021) file encoding is always 'utf-8'
     self.encoding = info.encoding if info.version < 'AC1021' else 'utf-8'