Nikolay-Kha / PyCNC

Python CNC machine controller for Raspberry Pi and other ARM Linux boards
MIT License
594 stars 189 forks source link

Convert gcode to x,y,z coordinates #36

Open ivandrodri opened 5 years ago

ivandrodri commented 5 years ago

Hi,

I wanted to know how to convert gcode lines to x,y,z coordinates in order to implement them in a 3d simulation.

Given a g-code "line" I parse it with

g = GCode.parse_line(line)

but I don't know how to get the x,y,z coordinates from the g.params .

thanks for any help!

Nikolay-Kha commented 5 years ago

Hi. g.params is a simple dict with capitalized string parameters. I.e. to get X from the line, just call g.get('X')