Jump to content
  • 0

Voron 2.4R2 start g code macro/Orcaslicer help needed


SamppaD

Question

Hi. I was fighting this issue for two days now and cant get this to work as i want it. Problem is as follow
When i send gcode from Orca slicer to printer it will not do forced homing  XYZ I have to do it manually before print will start. 
After that it will run a gantry level and start printing. No mesh,wait for heating or purge line is done. 
If i change macro start gcode/macro is ignored. So it doesn't work as i would like it to work. 
What i expected is when print is send to printer, force XYZ command will be issued automatically if not already homed. 
When this is done,bed will start to heat up to 100C and wait for chamber temperature of 45C to be reached before heating up the extruder to 150C.
After this is done level gantry and do a bed mesh.Then set extruder temperature to 260C and draw a purge line at the front of the bed and start printing. 
I'm doing something wrong here and help is needed and appreciated. Thanks in advance.

Orcaslicer start gcode is 

; M190 S0
; M109 S0 ; uncomment to remove  & wait temp gcode added automatically after this start gcode
PRINT_START EXTRUDER=260 BED=100 CHAMBER=45

 

Printer.cfg.zip

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0

Hi. I tried so many configurations that i reset all to stock and seems like G28 was not added at that point. 
It has a G32 macro that includes G28,it should work with this?
Will add G28 to the printer.cfg macro . Yes this macro in printer.cfg and orca start g code are defaults. 
Just macro and the way it works is something that is hard to come around. 
Normally i would just put necessary commands in to slicer. But now all commands that i set in slicer are bypassed by macro.

Edited by SamppaD
Link to comment
Share on other sites

  • 0

Just tested adding G28 to start macro,send a file to print,bed heated to 100C,extruder to 260C , G28 was ignored,
got error need to home all axis and then Klipper turned heaters off.However after 20 sec printer started printing file without 
heating hotend or bed. Something is wrong with the macro or the slicer start gcode,i would expect that forced g28 would be issued
after heating but no,it looks like i need to home printer manually and why heaters turned off and still try to print?   
Friday i was setting pressure advance with a gcode generated by elis link and it was working fine. 
So issue is when i send file for printing generated by orca slicer. Strange..

  • Like 1
Link to comment
Share on other sites

  • 0

Before going into the details... you need to make a decision...

Do I want to do all or part of my print preparation in the slicer or do I want to do it in my PRINT_START macro. Or... do I want to do some of it in the slicer or some in the macro and if so what.

I would recommend doing most/all your prep. in the PRINT_START macro. Here's why, slicers come and go, every time a new-better slicer comes around you will have to insert all of your print prep stuff into the new slicer and get it working again. However, if all your prep is in your PRINT_START macro, you only need to call the macro from the slicer and you're done.

Now that we know where code is going to go... Here's what I would do...

1st thing to do is make sure that the G32 macro functions properly. Easy enough... Just type G32 on the command line and hit enter. All of the commands should execute in order as per your G32 macro below.

This is from your printer.cfg, my comments are in red.

[gcode_macro G32]
gcode:
    SAVE_GCODE_STATE NAME=STATE_G32         ;saves the old G32 so that it can reset it back at the end of the macro
    G90                                                                       ;sets printer to absolute
    G28                                                                       ;home all axis
    QUAD_GANTRY_LEVEL                                        ;QGL Level the bed
    G28                                                                       ;home all axis again
    PARK                                                                      ;move printhead to the position defined in the "PARK" macro.
    RESTORE_GCODE_STATE NAME=STATE_G32   ;restore G32 

Everything needs to work in this macro before moving forward if you want to use G32 in your PRINT_START macro. You don't have to (I don't) but it should work without issue. FWIW... Klipper doesn't have a G32 code natively. In RepRap it's the Z-Probe command. Just know you don't need to use it.

Your Orca Slicer start G-Code:

You only need 3 things...

1) To call your PRINT_START macro, 2) Get the nozzle temp and 3) get the bed temp.

Copy and paste this into Orca.

PRINT_START EXTRUDER_TEMP=[nozzle_temperature_initial_layer] BED_TEMP=[bed_temperature_initial_layer_single]

When you print this will run your PRINT_START macro and also set two variables The nozzle temp you set in Orca and the Bed temp you set in Orca.

 

Your PRINT_START macro:

I don't know what probe you use so, I'll assume it's either a TAP or Beacon and...

You're closer than you think.

First the order of things...

1. Home

2. QGL

3. Heat bed using the bed temp variable from Orca

4. Heat nozzle to 150c

5. Bed Mesh

6. Park

7. Heat Nozzle to nozzle temp variable from Orca

8. Prime

END OF MACRO

If you're using TAP or Beacon/Cartographer/etc. you 100% need to probe at bed temp and have the nozzle at 150c. Now you can skip the setting of variables in Orca and using them in print_start but I wouldn't as every slicer has this capability just stick use the same variable name, in this case it's EXTRUDER_TEMP and BED_TEMP.

Let's make a macro.

 

[gcode_macro PRINT_START]
gcode:
    {% set BED_TEMP = params.BED_TEMP|default(100)|float %}
    {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
    
    BED_MESH_CLEAR

    G28                                          ; #1 Home all Axis

    QUAD_GANTRY_LEVEL          ; #2 QGL
    
    M140 S{BED_TEMP}               ; #3 Heat bed using variable BED_TEMP from slicer
    M109 S150                               ; #4 Heat nozzle to 150c Probing Temp
    M190 S{BED_TEMP}                ; Wait for bed to reach temperature  
    
    BED_MESH_CALIBRATE          ; #5 Bed Mesh

    G0 X20 Y20 Z50 S2000         ;#6 Park the head wherever you want it to be for nozzle heating
    

    M104 S{EXTRUDER_TEMP}                    ; #7 Heat nozzle using EXTRUDER_TEMP variable from slicer
    M109 S{EXTRUDER_TEMP}                    ; wait for extruder temp

    PRIME_BLOB                                           ; #8 if you have a priming macro it goes here.
    G92 E0.0                                                  ; reset extruder distance position to cancel out any changes made by the prime macro

 

...And that is it.

Step thru one by one and you should have everything working!

 

 

 

  • Like 3
Link to comment
Share on other sites

  • 0

 HiI just got back from workI'm using klicky probe. I would like to use macros to control printer start and end script,I think its the best thing to do if i can get it to work.  

Sent G32 in Mainsail web interface nothing happeningG28 works,QGL,bed mesh when command send via Mainsail web interface.. Added below line to Orca slicer as you advised and also added start macro to printer.cfg to test.
PRINT_START EXTRUDER_TEMP=[nozzle_temperature_initial_layerBED_TEMP=[bed_temperature_initial_layer_single]

gcode:
    {% set BED_TEMP = params.BED_TEMP|default(100)|float %}
    {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(150)|float %}
   
    BED_MESH_CLEAR
    G28                                          ; #1 Home all Axis
    QUAD_GANTRY_LEVEL          ; #2 QGL
    
    M140 S{BED_TEMP}               ; #3 Heat bed using variable BED_TEMP from slicer
    M109 S150                               ; #4 Heat nozzle to 150c Probing Temp
    M190 S{BED_TEMP}                ; Wait for bed to reach temperature  
    
    BED_MESH_CALIBRATE          ; #5 Bed Mesh
    G0 X150 Y150 Z30 S2000         ;#6 Park the head wherever you want it to be for nozzle heating
    
    M104 S{EXTRUDER_TEMP}                    ; #7 Heat nozzle using EXTRUDER_TEMP variable from slicer
    M109 S{EXTRUDER_TEMP}                    ; wait for extruder temp
    G92 E0.0                                                  ; reset extruder distance position to cancel out any changes made by the prime macro

Sent file to print,printer started heating bed to 100 and extruder to 260C then klipper issued error need to be homed ,so didn't home automatically and then klipper turned heaters off

I  homed XYZ and done QUAD_GANTRY_LEVEL.Restart printing file and now its printing normallySo G32 not working,and when print is send to printer will not do auto home XYZ,QGL before print start. Im sure that im doing something wrong here ..hmm...

Print completed printer stopped but didnt lift the extruder or park the head.

errors with klipper i had to move the head with  Z+25.  So start and end macros have issues..hmm interesting 🙂

 

17.42
Done printing file
17.42
Unknown command:"M141"
17.42
Unknown command:"PRINT_END"
17.42
Unknown command:"STATE_PRINT_END"
17.42
Unknown command:"EXCLUDE_OBJECT_END"
17.41
Unknown command:"EXCLUDE_OBJECT_START"
17.41
Unknown command:"EXCLUDE_OBJECT_END"
17.39
Unknown command:"EXCLUDE_OBJECT_START"

 

 

Edited by SamppaD
Link to comment
Share on other sites

  • 0
31 minutes ago, SamppaD said:

Sended file to print,printer started heating bed to 100 and extruder to 260C then klipper issued error need to be homed ,so didn't home automatically and then klipper turned heaters off

Can you copy and paste for PRINT_START & PRINT_END macros so we can have a look?

(p.s. I'm guessing English is your second language, Pro-Tip: use the word "Sent" instead of "sended") I sent you a letter versus I sended you a letter. 😉👍

 

OK, Let's take a look at the errors you have posted.

There is no native "M141" in klipper. If there is a call to it in a macro it's because an M141 gcode macro was created.

Example below:

[gcode_macro M141]
gcode:
    {% set s = params.S|default(0)|float %}
    SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={s}

M141 is used to turn on and control the speed of the exhaust fan among other things.

Link to Voron Document

The rest of the errors are because the PRINT_END macro was not found and as a result you get the unknown command error.

In the end the only things you want in your Orca slicer Machine_Start and Machine_End g-code windows is the following...

Start window:

PRINT_START EXTRUDER_TEMP=[nozzle_temperature_initial_layerBED_TEMP=[bed_temperature_initial_layer_single]

and in the End Window:

PRINT_END

In your printer.cfg

You need to have both a PRINT_START and a PRINT_END macro.

Again, copy paste your macros and if you have extra commands in Orca... remove them or comment them out with a ; (semicolon)

COMMAND ---> commented out command ----> ;COMMAND

 

  • Like 1
Link to comment
Share on other sites

  • 0

HiYes English is not my native language,sorry and thanks for the tip . Here is my start and end macro .
Yes i have chamber temperature controlled script in use.

 

[gcode_macro PRINT_START]
gcode:
    {% set BED_TEMP = params.BED_TEMP|default(100)|float %}
    {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(150)|float %}
    
    BED_MESH_CLEAR

    G28                     ; Home all Axis

    QUAD_GANTRY_LEVEL       ; QGL
    
    M140 S{BED_TEMP}        ; Heat bed using variable BED_TEMP from slicer
    M109 S150               ; Heat nozzle to 150c Probing Temp
    M190 S{BED_TEMP}        ; Wait for bed to reach temperature  
    
    BED_MESH_CALIBRATE      ; Bed Mesh

    G0 X150 Y150 Z30 S2000  ;Park the head wherever you want it to be for nozzle heating
    

    M104 S{EXTRUDER_TEMP}   ;Heat nozzle using EXTRUDER_TEMP variable from slicer
    M109 S{EXTRUDER_TEMP}   ;wait for extruder temp
    G92 E0.0                ; reset extruder distance position to cancel out any changes made by the prime macro
   
    
    [gcode_macro PRINT_END]
#   Use PRINT_END for the slicer ending script - please customise for your slicer of choice
gcode:
    # safe anti-stringing move coords
    {% set th = printer.toolhead %}
    {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
    {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
    {% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}
    
    SAVE_GCODE_STATE NAME=STATE_PRINT_END

    M400                           ; wait for buffer to clear
    G92 E0                         ; zero the extruder
    G1 E-5.0 F1800                 ; retract filament
    
    TURN_OFF_HEATERS

    G90                                      ; absolute positioning
    G0 X{x_safe} Y{y_safe} Z{z_safe} F20000  ; move nozzle to remove stringing
    G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600  ; park nozzle at rear
    M107; turn off fan
    
    BED_MESH_CLEAR

    # The purpose of the SAVE_GCODE_STATE/RESTORE_GCODE_STATE
    # command pair is to restore the printer's coordinate system
    # and speed settings since the commands above change them.
    # However, to prevent any accidental, unintentional toolhead
    # moves when restoring the state, explicitly set MOVE=0.
    RESTORE_GCODE_STATE NAME=STATE_PRINT_END MOVE=0
 

 

Link to comment
Share on other sites

  • 0

Got it to work now,with this...

M117
M190 S0
M109 S0
PRINT_START EXTRUDER_TEMP=[first_layer_temperature] BED_TEMP=[first_layer_bed_temperature]

 

So auto-start up,heating,leveling,meshing and printing no issues,however at the end of the print got this new Klipper error 
Error evaluating 'gcode_macro G32:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'BED_TEMP' 
and z dropped like 5mm and hit one of the printing models? It looked like its parking head at the back center and actually lowered the toolhead when doing this? 
Lucky I was watching it and aborted the print on time. So what is this error at the end of the print? It looks like a seperate issue?  Any solution on this issue?

 

 

[gcode_macro PRINT_START]-->OK
gcode:
  {% set BED = params.BED_TEMP|int %}
  {% set EXTRUDER = params.EXTRUDER_TEMP|int %}
  M190 S{BED}  ;Set bed temperature and wait
  _WAIT TIME=1800  ;Wait x seconds
  _CHOME  ;Home all axes if not homed
  QUAD_GANTRY_LEVEL  ;Quad Gantry Level
  BED_MESH_CLEAR  ;Clear Bed Mesh
  BED_MESH_CALIBRATE  ;Bed Mesh Calibration
  M109 S{EXTRUDER}  ;Set extruder temperature and wait
  _PURGE_LINE  ;Front Purge

[gcode_macro PRINT_END]--> Under testing
gcode:
  G0 Z10 F1800  ;Move Up
  G1 E-2 F1800  ;Retract filament
  G0 Z10 F1800  ;Move Up
  PARK_CENTER_REAR  ;Park central rear
  TURN_OFF_HEATERS  ;Turn off heaters
  M84  ;Disable motors

 

[gcode_macro PARK_CENTER_REAR]
gcode:
    {% if printer["gcode_macro status_busy"] != null %}
      status_busy
    {% endif %}
    {% set th = printer.toolhead %}
    {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
    {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}

 

    G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600  
    {% if printer["gcode_macro status_ready"] != null %}
    status_ready
    {% endif %}

 

Update PRINT_END code,will test and report back. For Error evaluating 'gcode_macro G32:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'BED_TEMP' no solution yet..

 

 

 

start.cfg config-20250214-203150.zip Test_print_ABS_16m37s.gcode

Edited by SamppaD
Update
  • Like 1
Link to comment
Share on other sites

  • 0

Making progress.

5 hours ago, SamppaD said:

So auto-start up,heating,leveling,meshing and printing no issues,however at the end of the print got this new Klipper error 
Error evaluating 'gcode_macro G32:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'BED_TEMP' 
and z dropped like 5mm and hit one of the printing models? It looked like its parking head at the back center and actually lowered the toolhead when doing this? 
Lucky I was watching it and aborted the print on time. So what is this error at the end of the print? It looks like a seperate issue?  Any solution on this issue?

I looked at your code and I can't see any reference to G32. You certainly don't want to home and QGL when there's a part stuck to the bed.

You don't really need a lot for your print end. The code below is literally my print end sequence.

It does the following...

[gcode_macro PRINT_END]
gcode:

G91                    ;Set to Relative Positioning
G1 E-5 f2000   ; Retract filament 5mm
G1 Z10 F600     ; Lift nozzle 10mm/s
G1 E-10 f600    ; Retract filament 10mm <--- You don't need this
M104 S0            ; turn off hotend
M140 S0            ; turn off bed heater
M107                  ; turn off part cooling fan
G90                   ;Set to Absolute Positioning
G0 X165 Y300  F6000      ; move toolhead to back center <--- Change the X & Y values to the center rear of your printer X150 Y300 for a 300x300 Voron
RSCS_off                           ; Turn off RSCS fans <--- You don't need this
exhaustfan_on                  ; Turn on Rear Exhaust fan 
G4 P60000                       ; //Dwell/Wait for 1 min
exhaustfan_off                  ; Turn off Rear Exhaust fan

  • Like 1
Link to comment
Share on other sites

  • 0

Hi. Yes you are correct.It was strange,print was completed and toolhead was starting parking,after clearing first print model toolhead 
got down about 5mm and continued to move to park position hitting a model behind.
I was expecting that something might go wrong so i was ready... My end print macro had a move away option enabled after print completed  so I think that was the issue.
However still getting this error Error evaluating 'gcode_macro G32:gcode': jinja2.exceptions.UndefinedError: 'dict object' has no attribute 
'BED_TEMP'  
I was looking at my printer.cfg macros and i noticed that there is this code that is still in use but G32 button on the mainsail console is 
not doing anything when pressed? So issue might be related with G32 macro? Something is missing but i cant find it...Im so close to get this to work....

I modify your end script and tested but klipper had issues with it. 

 

 

[gcode_macro G32]
gcode:
    SAVE_GCODE_STATE NAME=STATE_G32
    G90
    G28
    QUAD_GANTRY_LEVEL
    G28
    PARK
    RESTORE_GCODE_STATE NAME=STATE_G32

    [gcode_macro M141]
gcode:
    {% set s = params.S|default(0)|float %}
    SET_TEMPERATURE_FAN_TARGET temperature_fan="chamber" target={s}
   

 

 

Edited by SamppaD
Link to comment
Share on other sites

  • 0

Update,after making a new start.cfg G32 error disappeared. Old start.cfg must had some error in the code,it should be the same as the new one,but apparently its not. 
After testing noticed that print start and print end was working fine but after print completed, toolhead was trying to go to Z10,even when G0 Z10 F1800  ; was supposed to be processed.  
Lucky I antisipated posible issues in advance and design thin wall test prints that have a low adhesion to the bed just in case to make sure no damage happens to the bed or the printer if i fail to abort print on time.
Inspected my g code and noticed that G91/G90 was missing from my end g code. 
Updated the end macro will test tomorow and report back.

Edited by SamppaD
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...