blob: 1df9969a3fc2eb73d1b9a8e85b835efafb224cef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# Purpose: handle default chunk
# Created: 21.07.2012, taken from my ezdxf project
# Copyright (C) 2012, Manfred Moitzi
# License: MIT License
from __future__ import unicode_literals
__author__ = "mozman <mozman@gmx.at>"
from .tags import Tags, DXFTag
class DefaultChunk(object):
def __init__(self, tags):
assert isinstance(tags, Tags)
self.tags = tags
@staticmethod
def from_tags(tags, drawing):
return DefaultChunk(tags)
@property
def name(self):
return self.tags[1].value.lower()
def iterchunks(tagreader, stoptag='EOF', endofchunk='ENDSEC'):
while True:
tag = next(tagreader)
if tag == DXFTag(0, stoptag):
return
tags = Tags([tag])
append = tags.append
end_tag = DXFTag(0, endofchunk)
while tag != end_tag:
tag = next(tagreader)
append(tag)
yield tags
|