nraynaud / webgcode

Online G-Code simulator, controller code for STM32F4-Discovery and google chrome extension to send the code to it.
http://nraynaud.github.io/webgcode/webapp/visucamTest.html#/
Other
376 stars 164 forks source link

Coordinate offsets subtracted not added #12

Closed richard-sim closed 7 years ago

richard-sim commented 7 years ago

I think that this might be inverted: https://github.com/nraynaud/webgcode/blob/gh-pages/webapp/cnc/gcode/parser.js#L288

i.e. it should add the offset to the new point, not subtract it.

If my thinking is correct, I'd expect this g-code to create a 10x5 box with a 8x3 box contained within, but right now it creates a 10x5 box with a 8x3 box offset(starting at X-2Y-1): G1X0Y0Z0 G1X10Y0 G1X10Y5 G1X0Y5 G1X0Y0 G10 L2 P1 X2Y1 G1X0Y0 G1X8Y0 G1X8Y3 G1X0Y3 G1X0Y0

nraynaud commented 7 years ago

Thanks for the report with the fix. After checking, I think you're entirely right.