Commit 4f4dc7a1 authored by sumpfralle's avatar sumpfralle

half of the lines were skipped before - this is fixed now


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@354 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 541826a6
...@@ -46,12 +46,18 @@ class DXFParser: ...@@ -46,12 +46,18 @@ class DXFParser:
self.inputstream = inputstream self.inputstream = inputstream
self.line_number = 0 self.line_number = 0
self.lines = [] self.lines = []
self._input_stack = []
self.parse_content() self.parse_content()
def get_model(self): def get_model(self):
return {"lines": self.lines} return {"lines": self.lines}
def _push_on_stack(self, key, value):
self._input_stack.append((key, value))
def _read_key_value(self): def _read_key_value(self):
if self._input_stack:
return self._input_stack.pop()
try: try:
line1 = self.inputstream.readline(self.MAX_CHARS_PER_LINE).strip() line1 = self.inputstream.readline(self.MAX_CHARS_PER_LINE).strip()
line2 = self.inputstream.readline(self.MAX_CHARS_PER_LINE).strip() line2 = self.inputstream.readline(self.MAX_CHARS_PER_LINE).strip()
...@@ -126,6 +132,9 @@ class DXFParser: ...@@ -126,6 +132,9 @@ class DXFParser:
pass pass
key, value = self._read_key_value() key, value = self._read_key_value()
end_line = self.line_number end_line = self.line_number
# the last lines were not used - they are just the marker for the next item
if not key is None:
self._push_on_stack(key, value)
if (None in p1) or (None in p2): if (None in p1) or (None in p2):
print >>sys.stderr, "Incomplete LINE definition between line " \ print >>sys.stderr, "Incomplete LINE definition between line " \
+ "%d and %d" % (start_line, end_line) + "%d and %d" % (start_line, end_line)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment