Skip to content

Commit

Permalink
Merge pull request sorted01#20 from gennro/main
Browse files Browse the repository at this point in the history
  • Loading branch information
sorted01 authored Sep 12, 2023
2 parents 37f3898 + 4815891 commit 2b0fb6c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 99 deletions.
49 changes: 11 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ Check the orientation of the hole for the M2.5 screw in the knife holder. It nee


### Add heat inserts

Tip here for the heat set that goes above the cutter I would suggest drilling the threads out with a ~2.5mm drill bit. On the hotend holder side below the cutter make sure you flare out the PTFE tube to help guide the filament.
#### Main body
![image](https://github.com/sorted01/Filametrix/assets/83211473/8324c808-83cd-4b8d-a89a-45ca6b4836d8)
#### SB cutting Printhead back
Expand All @@ -139,41 +141,12 @@ I need some time to finalize assembly instructions. If you have questions you'll

## Code

**!! I AM OPEN FOR ANY SUGGESTIONS OF IMPROVEMENT TO THIS CODE !!**

[thisiscam](https://github.com/thisiscam) has created the ercf_additional.cfg which, once you include it in your printer.cfg should do the work and the modification of the ercf_software.cfg listed below is no longer needed. As I am currently rebuilding my ERCF this is untested by me and thisiscam already announced an update :)

-> For know I will leave the code below as information.

I use [Happy Hare](https://github.com/moggieuk/ERCF-Software-V3) with my ERCF. So I only tested it with this code. On your running ERCF config you'll need to modify the "_ERCF_FORM_TIP_STANDALONE" macro in your "ercf_software.cfg"


As I am still testing I am really open for improvements of the Code. As I have no drag chain due to canbus the best position for me was in the back of my printer. If you use a drag chain you maybe need to adjust the gcode below to avoid any collision with your drag chain.

In the Machine start g-Code you need to add this (i a separate line)
```
ERCF_CHANGE_TOOL TOOL={initial_tool} STANDALONE=1
```

### Modification of "ercf_software.cfg"
We will use the STANDALONE=1 mode and repleace the tip forming macro. So set the
```
variable_standalone = 1 # 0 slicer, 1 Happy Hare macro (turn off in slicer)
```
Adjustment of the Tip Forming macro
```
########################################################################
# Standalone Tip Forming (for rapid tuning of Slicer values)
########################################################################
[gcode_macro _ERCF_FORM_TIP_STANDALONE]
gcode:
G92 E0
G1 E-35 F3000 #Retraced before the cut based on your hotend. This is working for Dragon HF
G1 X50 Y357 F5000 #Start position for the cutting procedure based on your position of the cutting point
G1 X0 Y357 F2000 #Cut position for the cutting procedure based on your position of the cutting point
G1 X50 Y357 F7000 #Return to starting point of cutting procedure
G92 E0
G1 E-80 F3000 #Retract filament out of your extruder. Based on your setup
G92 E0
G90
```
***The code only works with https://github.com/moggieuk/Happy-Hare** If you haven't updated yet you really should.

Copy mmu_additional.cfg to your printer config directory mmu/base/ and include it in your printer.cfg below all of the mmu includes via [include mmu/base/mmu_additional.cfg]

You will need to adjust the parameters in mmu_addtional as well, like setting up your cutter location, speeds, etc. More information in the cfg file itself.




Binary file added STL/Bambu Toolhead/Bambu Adapter M5 nut.stl
Binary file not shown.
84 changes: 23 additions & 61 deletions ercf_additional.cfg → mmu_additional.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[gcode_macro CUT_FILAMENT]
description: Cut filament by pressing the cutter on a fixed pin with a horizontal movement.
description: Cut filament by pressing the cutter on a fixed pin with a horizontal movement. Based on Thiscams macro but updated to work with HHv2

#Modify the below settings in mmu_parameters.cfg

#toolhead_sensor_to_nozzle: 62 this will need to be reduced to compensate for the extra filament letf in the nozzle so probably to 5 to 15mm shorter based on the variable_retract_length: below.
#force_form_tip_standalone: will need to be set to 1 and all tip forming settings will need to be disabled in your slicer including ramming.
#slicer_tip_park_pos: will need to be set just above the cutter slot.

# Distance to retract prior to making the cut, this reduces wasted filament but might cause clog
# if set too large and/or if there are gaps in the hotend assembly
Expand All @@ -8,8 +14,8 @@ variable_retract_length: 35

# The location of the pin, this should be the position of the toolhead when the cutter
# just lightly touches the pin
variable_pin_loc_x: 21
variable_pin_loc_y: 19
variable_pin_loc_x: 13
variable_pin_loc_y: 56

# The starting and end positions when making the cut
# In particular, instead of making the cut by traveling to the pin location above,
Expand All @@ -19,17 +25,17 @@ variable_pin_park_x_dist: 5.0

# Position of the toolhead when the cutter is fully compressed
# Should leave a small headroom to avoid banging the toolhead or gantry
variable_pin_loc_x_compressed: 5.0
variable_pin_loc_x_compressed: 0

# Speed related settings
# Note that if the cut speed is too fast, the steppers can lose steps
# Therefore, for a cut:
# - We first make a fast move to accumulate some momentum and get the cut blade to the initial contact with the filament
# - We then make a slow move for the actual cut to happen
variable_travel_spd: 7800
variable_travel_spd: 8000
variable_cut_fast_move_spd: 2000
variable_cut_slow_move_spd: 500
variable_evacuate_speed: 7800
variable_cut_slow_move_spd: 400
variable_evacuate_speed: 8000
variable_cut_dwell_time: 200 # time to dwell at the cut point in ms
variable_cut_fast_move_fraction: 0.5 # fraction of the move that uses fast move

Expand All @@ -39,35 +45,19 @@ variable_cut_fast_move_fraction: 0.5 # fraction of the move that uses fast move
variable_safe_margin_x: 30
variable_safe_margin_y: 30

# Whether or not to make a second cut
# The goal of the second cut is to avoid filament adding friction to the blade causing the lever unable to decompress
# If set to a positive value, we first retract this amount, make the second cut, then extrude back
# Set to 0 to disable to second cut
# You should only enable this if you cannot get the lever to reliabily decompress.
variable_second_cut_retract_length: 0
#this is the length of filament to move after filament has been cut, just need enough to move it away from the cutting slot.
variable_cut_retract_length: 2

# Whether to eject the filament at the end
variable_final_eject: 0

# Currently ERCF software assumes that tip forming move always moves the extruder (and consequently the encoder)
# Ideally, we should bring formal support of filament cutters to the ERCF software
# In the short term, we perform a "hack" where we wiggle the extruder a little after cutting,
# if the extruder did not make enough movement during the filament cutting phase.
variable_extruder_minimum_movement: 0 # the minimum extruder movement required for this tip forming move, this depends on the minimum distance that the encoder can reliably detect
# setting it to a lower value requires the ERCF encoder to be more sensitive.
variable_extruder_wiggle_length: 10 # the length to retract -> extrude during a wiggle, this needs to be large enough for the encoder to detect the movement
variable_extruder_wiggle_repeat: 3 # number of repeats for the wiggle

# State variables
variable_retracted_length_: 0 # a state variable to keep track of how much we have retracted during the last cut, this is useful for restoring the filament position

gcode:
{% set RETRACT_LENGTH = params.RETRACT_LENGTH | default(printer['gcode_macro CUT_FILAMENT']['retract_length']) | float %}
{% set FINAL_EJECT = params.FINAL_EJECT | default(printer['gcode_macro CUT_FILAMENT']['final_eject'], True) | int %}
{% set current_loc_x = printer.gcode_move.gcode_position.x %}
{% set current_loc_y = printer.gcode_move.gcode_position.y %}

SAVE_GCODE_STATE NAME=cut_filament_state
SET_PRESSURE_ADVANCE ADVANCE=0

{% if ("x" not in printer.toolhead.homed_axes) or ("y" not in printer.toolhead.homed_axes) %}
G28 X Y
Expand All @@ -85,35 +75,18 @@ gcode:
G1 E-{RETRACT_LENGTH} F3000 # retract to save filament waste
{% set _extruder_moved_dist = _extruder_moved_dist + RETRACT_LENGTH %}
{% endif %}
SET_GCODE_VARIABLE macro=CUT_FILAMENT variable=retracted_length_ value={RETRACT_LENGTH}

G90 # absolute positioning
_MOVE_TO_CUTTER_PIN PIN_PARK_X_LOC={pin_park_x_loc} PIN_PARK_Y_LOC={pin_park_y_loc}

# Make the main cut
_DO_CUT_MOTION PIN_PARK_X_LOC={pin_park_x_loc}
# Optional secondary cut to help decompressing the lever
{% if second_cut_retract_length > 0 %}
G1 E-{second_cut_retract_length} F3000
_DO_CUT_MOTION PIN_PARK_X_LOC={pin_park_x_loc}
G1 E{second_cut_retract_length} F3000
{% endif %}

{% if FINAL_EJECT == 1 %}
G1 E-80 F3000
{% set _extruder_moved_dist = _extruder_moved_dist + 80 %}
{% endif %}

{% if _extruder_moved_dist < extruder_minimum_movement %}
# make some wiggle moves so that the encoder catch them
{% for _ in range(extruder_wiggle_repeat) %}
G1 E-{extruder_wiggle_length} F3000
G1 E{extruder_wiggle_length} F3000
{% endfor %}
{% endif %}
G1 E-{cut_retract_length} F3000 #moves filament after cut, but not past the toolhead sensor

SET_PRESSURE_ADVANCE ADVANCE={prev_pa} # restore PA
RESTORE_GCODE_STATE NAME=cut_filament_state
M400
M117 Filament cut!
RESTORE_GCODE_STATE NAME=MMU_state MOVE=1 MOVE_SPEED={travel_spd} #restores MMU state to bring the toolhead back over the purge block after a cut so no oozing.

[gcode_macro _MOVE_TO_CUTTER_PIN]
description: helper to move the toolhead to the target pin in either safe or faster way, depending on toolhead clearance.
Expand Down Expand Up @@ -149,18 +122,7 @@ gcode:
G4 P{cut_dwell_time}
G1 X{pin_park_x_loc} F{evacuate_speed} # evacuate

[gcode_macro restore_cutted_filament]
description: extrudes an amount equal (or proportional) to the retraction during the last cut
gcode:
SAVE_GCODE_STATE NAME=restore_cutted_filament_state
{% set RETRACTED_LENGTH = printer['gcode_macro CUT_FILAMENT']['retracted_length_'] | float %}
M83 # relative extrusion
G1 E{RETRACTED_LENGTH} F3000
SET_GCODE_VARIABLE macro=CUT_FILAMENT variable=retracted_length_ value=0 # clear the retracted amount
RESTORE_GCODE_STATE NAME=restore_cutted_filament_state


[gcode_macro _ERCF_FORM_TIP_STANDALONE]

[gcode_macro _MMU_FORM_TIP_STANDALONE]
gcode:
CUT_FILAMENT {rawparams}

CUT_FILAMENT {rawparams}

0 comments on commit 2b0fb6c

Please sign in to comment.