Execute python script befor every print

Hello everyone,

we use Repetier Server in a small institute with around 25 people to manage the 3d printers. We just set up the server but i am worried that somebody might start a print while another part is still inside the printer. Thats why i would like to add a small python script that moves the printer befor every print through a light barrier to check the for parts on the build plate. The light barrier would be operated either by the printer board or an additional arduino.
I realize i need to use the api for this problem. Is it possible to halt a print before the homing starts after getting a print started callback?

Best regards
Christian Pommer

Comments

  • That is tricky. While you can start external scripts in gcode using execute, the server would not wait for them to finish. They are started asynchrnously to not disturb the print. You here want it as a synchronous operation.

    One solution would be to make it in firmware and block until it is cleaned. If you send in firmware every 2 seconds "busy: Clean bed" the server will also not time out.

    Is that a solution you coul dget working? Or do you think a sync execute would be better. I could add that for the future.
  • Well i do not think an synchronous operation would realy be neccesarry. It would certainly be enough to add a server option to execute a phyton script(or call a command) befor the first g-code is send but i think this would be an additional feature. For the start i will check your suggestion. Working in the firmware is allways a hazzle but i will check.
  • That sounds more like adding a sync command. Executing a python script as option is too special. What if it is a perl user or bash script. In fact the command could made to be checked for response code and stop print on error (here bed full). All you do is add the @execute then as first line in the start script of the server. Then you have exactly what you wanted.
  • Perfect, thank you very mich
  • Ok, I have added it to the next release. In the definition in extcommands you need to add 
    sync="true" stopOnFail="true" to change from default behaviour.
Sign In or Register to comment.