kliment / Printrun

Pronterface, Pronsole, and Printcore - Pure Python 3d printing host software
GNU General Public License v3.0
2.38k stars 996 forks source link

printing gcode from python #1187

Closed comes04 closed 3 years ago

comes04 commented 3 years ago

Hi there! One more time i need your help with a proyect; I'm trying to print a gcode from python, actually a run it trought pycharm in windows. I just copied the example in this website as following:

`from printrun.printcore import printcore from printrun import gcoder

p = printcore() p.connect('COM4', 115200)

gcode = [i.strip() for i in open('prueba_lecturas_pasos_cortos.gcode')] gcode = gcoder.LightGCode(gcode) p.startprint(gcode)`

with this, it doesnt print anything. Any idea what i'm doing wrong? Thanks in advance.

comes04 commented 3 years ago

Ok, I just need to give time to conect with while not p.online: time.sleep(0.1)

The following works

`p = printcore() p.connect('COM4', 115200)

while not p.online: time.sleep(0.1)

gcode = [i.strip() for i in open('prueba_lecturas_pasos_cortos.gcode')] gcode = gcoder.LightGCode(gcode) p.startprint(gcode)`

volconst commented 3 years ago

Thanks @comes04 , I updated the README with your fix.