dkobozev/tatlin — Issue #4: gcode parser needs to support G28 and G92
Author: clemtaylor
Created: 2012-02-24 21:17:34+00:00
State: open

None of the gcode I have that was generated with slic3r, sfact, skeinforge or my own python script would load with tatlin. Commands like G28 (home) and G92 (set position) change the position state.

I added "self.prev_location = Vector3(0,0,0)" to GcodeParser.__init_ and now things load but the position is wrong.

```python
Traceback (most recent call last):
File "tatlin.py", line 419, in
app.open_and_display_file(sys.argv[1])
File "tatlin.py", line 367, in open_and_display_file
self.add_file_to_scene(self.model_file)
File "tatlin.py", line 393, in add_file_to_scene
self.scene.load_file(f)
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/scene.py", line 98, in load_file
self.model = model_file.load_model()
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/storage.py", line 90, in load_model
model = self._loaders[self.filetype]()
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/storage.py", line 96, in _load_gcode_model
model = GcodeModel(parser.parse())
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/gcodeparser.py", line 99, in parse
if self.is_new_layer(split_line): # start new layer if necessary
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/gcodeparser.py", line 167, in is_new_layer_from_gcode
if new_location.z - self.prev_location.z > 0.1:
AttributeError: 'NoneType' object has no attribute 'z'
```

I reverted to 9302142ad7af8d39051c207ea2f9e8cd9e588ed2 and it bombs with:

```python
Traceback (most recent call last):
File "tatlin.py", line 419, in
app.open_and_display_file(sys.argv[1])
File "tatlin.py", line 367, in open_and_display_file
self.add_file_to_scene(self.model_file)
File "tatlin.py", line 393, in add_file_to_scene
self.scene.load_file(f)
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/scene.py", line 98, in load_file
self.model = model_file.load_model()
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/storage.py", line 90, in load_model
model = self._loaders[self.filetype]()
File "/home/ctaylor/Stuff/3dprinter/tatlin.git/libtatlin/storage.py", line 94, in _load_gcode_model
start_location = Vector3(Platform.width / 2, -Platform.depth / 2, 10.0)
AttributeError: type object 'Platform' has no attribute 'width'
```