Expected behavior of Scripts

I ran a test as explained below but the scripts in Repetier-Host did not behave as I expected. Apologies for the length of the message. My overall aim is to make some scripts that facilitate calibrating my printer in an easier way as it is a temperamental home build 3D printer and I'm very new to 3D printing.

      Repetier=Host Mac
          Version 1.2.0 (105)
     /Applications/Repetier-Host-Mac.app/Contents/Resources/defaultPrepend.gcode contains following code
          M117 defaultPrepend_Gcode
          G0 X15 Z15 Y5 F500
     /Applications/Repetier-Host-Mac.app/Contents/Resources/defaultAppend.gcode contains following code
          M117 defaultAppend_Gcode
          G0 X12 Y12 Z6 F500
     G-Code ( user defined script )
          M117 G-Code
          G28 Y12 Z6 F500
     Start Code ( user defined script )
          M117 Start_code
          G0 X5 Y5 Z5 F500
     End Code ( user defined script )
          M117 End_code
          G28 X
     Script 1 ( user defined script )
          M117 Script1
          G28 Z

With the " Script 1 " window in the G-code menu open  click the " Run " Icon on the menu
> 3:02:03 PM: M117 Start_code
> 3:02:03 PM: N6189 G0 X5.00 Y5.00 Z5.000 F500.000 *34
> 3:02:03 PM: M117 G-Code
> 3:02:03 PM: N6190 G28 Y12.00 Z6.000 F500.000 *70
> 3:02:03 PM: M117 End_code
> 3:02:07 PM: N6191 G28 X0.00 *106
< 3:02:07 PM: Error:Line Number is not Last Line Number+1, Last Line: 6190
< 3:02:07 PM: Resend: 6191
  3:02:07 PM: Resend: N6191 G28 X0.00 *106

Both files "defaultPrepend.gcode" end "defaultAppend.gcode" seems to be added only when slicing is used and has nothing to do with user-defined "Start Code" and "End Code" scripts.
The order of scripts seem to be:
     1) Start code
     2) defaultPrepend.gcode (only when the slicer is used)
     3) Slicer generated code or handwritten or saved G-code if slicer is not used 
     4) defaultAppend.gcode (only when the slicer is used)
     5) End code

Q1 Is the above script order a correct assumption?
Q2 How to run Script 1 or Script X? ( Tried all of the scripts and they react the same as one would expect)
Q3 After execution my printer display indicated the printer head to be at position [X 0 Y 12 Z 6]
     (which seems correct according to the results of the code sent to the printer)
     The printer panel in the Repetier-Host app states the printer head to be at [X 0 Y 0 Z 0]
     (which seems incorrect)
Q4 How can I avoid the "Error:Line Number is not Last Line Number+1, Last Line: XX".
     I tried various syntaxes and codes but without any success.
Q5 Apologies but I read what I could find online and failed to make this work, hence this question.
     So please explain in simple terms what this newbie is doing wrong?

Hoped for behavior:
I was hoping for behavior in which Script 1-5 executes on its own or at least there would be an option for each of these scripts to include or exclude the "Start code" and "End code" scripts. 

Thanks a lot in advance ... for anybody that can provide some help.
Even letting me know if you could replicate this or not is useful.


  • "defaultPrepend.gcode" end "defaultAppend.gcode"  should not be used at all. They are from old versions and not editable in gcode editor which indicates they should not be used. Use the slic3r frontend to configure start/end code added by slicer instead. Apart from this order is correct.

    Regarding missed line number it looks like com error since resending exactly same string was accepted. Can happen.

    Don't understand the script 1-5 question. Just send them with Printer Menu->Script 1-5 or command+ 1 - 5

    Homing make app assume position defined in dimensions which is entered min or max value. Newer firmwares do not do this any more always and might stop at other positions. The next G1 move with given axis will correct that position.
  • Thanks again for your clarification. I misunderstood how the scripts work, which makes the question look silly now. All is clear to me now.
    The homing was not really a problem, just confusing.
    Thanks for all your help.
Sign In or Register to comment.