how do I calculate the E-parameter for Start G-Code
-
If I want to enter a first line of 595mm in the starting G-code...how do I calculate the E-parameter?
Here is my current startup G-Code that I would like to adapt:G28 ;Home
G92 E1 ;Reset ExtruderG1 Z2.0 F3000 ;Move Z Axis up
G1 X5 0.5 Z0.3 F5000.0 ;Move to start position
G1 X600 Y0.5 Z0.32 F1500.0 E50 ;Draw the first line
G1 X600 Y2.0 Z0.32 F5000.0 ;Move to side a little
G1 X5 Y2 Z0.32 F1500.0 E100 ;Draw the second line
G92 E1 ;Reset Extruder
G1 Z2.0 F3000 ;Move Z Axis upand here my driver parameters from config.g
; Drives
;M569 P4 R-1 ; Treiber 4 deaktivieren
;M569 P3 R-1 ; Treiber 4 deaktivieren
M569 P0 S1 ; physical drive 0 goes forwards
M569 P1 S1 ; physical drive 1 goes forwards
M569 P2 S1 ; physical drive 2 goes forwards
M569 P3 S1 ; physical drive 3 goes forwards
M569 P4 S0 ; physical drive 3 goes forwards
;M584 X0 Z2 E1 ; set drive mapping
M584 X0:4 Y1 Z2 E3 ; set drive mapping
M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
M92 X80.00 Y80.00 Z640 E322.58 ; set steps per mm
M566 X900.00 Y900.00 Z100.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
M203 X6000.00 Y6000.00 Z300.00 E1200.00 ; set maximum speeds (mm/min)
;M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2)
M201 X500.00 Y500.00 Z40.00 E250.00 ; set accelerations (mm/s^2)
M906 X1900 Y2300 Z1800 E1600 I30 ; set motor currents (mA) and motor idle factor in per cent
M84 S30 ; Set idle timeout; Axis Limits
M208 X0 Y0 Z0 S1 ; set axis minima
M208 X750 Y640 Z1220 S0 ; set axis maxima -
You could create a simple 3D model, say, a rectangle of 595mm by 10mm by 10mm, convert it to STL, process that with your slicer and examine the generated print code.
Perhaps this STL file will work for you:
Frederick
-
@axiom the current move is 600mm, with 50mm of extrusion. Changing it to 595mm is a difference of less than 1%, and will be barely noticeable in extrusion, especially as it’s a purge line. I’d say leave as is. Or change it to 50 x 0.99 = 49.5mm.
Also, this move needs a ‘Y’ in it:
G1 X5 0.5 Z0.3 F5000.0 ;Move to start position
Ian
-
@axiom
I do a similar thing using this macro, which I call from the slicer (Prusa Slicer)
It's overkill for doing a trivial thing like a prime line that probably won't change, but I did it as the basis for doing dynamic generation of some test files I was working on.
The line you're interested in isvar amount = ((var.d*var.height*var.l) + (pi*pow(var.height/2,2)*var.l)) / (pi*pow(var.FD/2,2)) * var.SF
I can't guarantee if the way I calculate the extrusion amount is 100% correct as compared to a slicer, but it works well enough for a purge line and means I can change the length of the line easily.
You must pass the following parameters.
S = extrusion factor
D = nozzle diameter
F = Filament diameter
O = Origin X and Y points as an array
L = Line lengthe.g. in Prusa Slicer / Super Slicer I use the following after homing etc.
G1 X0 Y{"{move.axes[1].max}"} Z0.6 F1500 ; Move to back corner while heating M568 P{current_extruder} R{"{heat.coldExtrudeTemperature+5}"} S{first_layer_temperature[current_extruder]} A2 ; (set standby and active temperatures for active tool. Standby is 5 degrees above cold extrude temp ) M118 P3 S" Waiting for temps..." G4 S1 ; Wait 1 Second M116 ; Wait for all temps to stabilise G1 X0 Y{"{move.axes[1].max -5}"} Z0.26 F1200 ; move to edge to wipe any oozed filament M98 P"0:/macros/print/doPrimeLine.g" S{extrusion_multiplier[current_extruder]} D{nozzle_diameter[current_extruder]} F{filament_diameter[current_extruder]} O{"{1,0}"} L150; does prime line with calculated extrusion amount G10 ; Retract G1 Z0.1 ; lower head G1 X{move.axes[0].machinePosition + 50} F1200 ; wipe G1 Z10 ; raise head G92 E0 ; reset extruder
note that in order to pass an array as a parameter from Prusa Slicer you have to enclose the array in double quotes O{"{0,10}"}
; doPrimeLine.g ; example of calling from Prusa Slicer ;M98 P"0:/macros/print/doPrimeLine.g" S{extrusion_multiplier[current_extruder]} D{nozzle_diameter[current_extruder]} F{filament_diameter[current_extruder]} O{"{0,10}"} L150; if state.currentTool = -1 abort "No tool selected" var ThisHeater = tools[state.currentTool].heaters[0] if {heat.heaters[var.ThisHeater].state != "active"} abort "Heater " ^ var.ThisHeater ^ " on " ^ tools[state.currentTool].name ^ " not active" if {heat.heaters[var.ThisHeater].active < heat.coldExtrudeTemperature} abort "Heater " ^ var.ThisHeater ^ " on " ^ tools[state.currentTool].name ^ " set below min extrude temp" if !exists(param.S) abort "no ""S"" (extrusion factor) parameter sent to macro in M98" if !exists(param.D) abort "no ""D"" (nozzle diameter) parameter sent to macro in M98" if !exists(param.F) abort "no ""F"" (filament diameter) parameter sent to macro in M98" if !exists(param.O) echo "no ""O"" (Origin) parameter sent to macro in M98. Defaults will be used" if !exists(param.L) echo "no ""L"" (Length) parameter sent to macro in M98. Defaults will be used" echo "wait for heaters" M116 ; wait for heaters to settle echo "heaters done" G4 P500 echo "set height" var height = 0.2 ; create a variable then set it depending on slicer commanded position prior to calling this macro if move.axes[2].machinePosition <= 0.4 set var.height = move.axes[2].machinePosition else set var.height = 0.3 echo "move to Z" ^ var.height M400 echo "check extrusion percentage" var SF = 100 if param.S <=1 ; check if slicer sends percentage of 1 or 100 set var.SF = param.S ; extrusion multiplier as a percentage of 1 else set var.SF = param.S / 100 echo "check filament dianeter" var FD = 1.75 ; set filament diameter set var.FD = param.F echo "calculate distance and extrusion amount" var startPos = {0,move.axes[1].min + 10} ; create a default start point if exists(param.O) set var.startPos = param.O var start = var.startPos[1] var end = {move.axes[1].max - 10} ; extrude line end default position var l = var.end - var.start ; default line length if exists(param.L) set var.l = param.L set var.end = var.start + var.l ; do a sanity check to ensure we're within bounds if var.end > move.axes[1].max set var.end = move.axes[1].max set var.l = var.end - var.start var d = param.D*1.00 ; nozzle diameter that is passed to macro as paramater var amount = ((var.d*var.height*var.l) + (pi*pow(var.height/2,2)*var.l)) / (pi*pow(var.FD/2,2)) * var.SF ; calculate how many mm of filament to extrude - Owen's calculation echo "flow rate value " ^ var.SF ^ " with " ^ var.d ^ "mm nozzle, " ^ var.FD ^ "mm filament dia over " ^ var.l ^ "mm length = E" ^ var.amount ^ "mm" M83 ; set relative extrusion G92 E0 echo "moving to X" ^ var.startPos[0] ^ " Y" ^ var.startPos[1] ^ " Z" ^ var.height G1 X{var.startPos[0]} Y{var.startPos[1]} Z{var.height} F1200 ; move to edge to wipe any oozed filament M400 G92 E0 echo "Move and extrude to Y"^var.end ^ " E" ^ var.amount G1 X{var.startPos[0]} Y{var.end} E{var.amount} F600; move and extrude M400 G92 E0 echo "move over one nozzle width" G1 X{var.d} ; move by one nozle width M400 G92 E0 echo "Move and extrude - other direction" G1 Y{var.start} F600 E{var.amount}; move and extrude M400 G92 E0 echo "retract" G10 ; retract M400 G92 E0 echo "exit PrimLine" G4 P500
-
@OwenD Thaks a lot!!!