Skip to content

Default U1 change filament gcode causes head crashes in object by object printing #859

Description

@Minecrafter8001

Is there an existing issue for this feature request?

  • I have searched the existing issues

Is your feature request related to a problem?

the default code can cause a head crash
the current code is this:

;===== date: 20251213=====================
; Change Tool[previous_extruder] -> Tool[next_extruder] (layer [layer_num])
{
local max_speed_toolchange = 350.0;
local wait_for_extruder_temp = true;
position[2] = position[2] + 2.0;
local speed_toolchange = max_speed_toolchange;
if travel_speed < max_speed_toolchange then
      speed_toolchange = travel_speed;
endif
"G91
G1 Z1.5 F1800
G90
";
"G1 F" + (speed_toolchange * 60) + "
";
if wait_for_extruder_temp and not((layer_num < 0) and (next_extruder == initial_tool)) then
      "
";
      "; " + layer_num + "
";
      if layer_num == 0 then
            "M109 S" + first_layer_temperature[next_extruder] + " T" + next_extruder + "
";
      else
            "M109 S" + temperature[next_extruder] + " T" + next_extruder + "
";
      endif
endif
"M400" + "
";
"T" + next_extruder + "
";
if filament_type[next_extruder] == "PVA" then
"SET_VELOCITY_LIMIT ACCEL=3000
";
else
endif
if previous_extruder != next_extruder and initial_extruder != next_extruder then
"SM_PRINT_PREEXTRUDE_FILAMENT INDEX=" + next_extruder + "
";
endif
"G90
";
}

which only lowers the Z axis by 2mm, this can cause issues if another object is in the path

Which printers will be beneficial to this feature?

All

Describe the solution you'd like

a simple modification, replacing this section:

position[2] = position[2] + 2.0;
local speed_toolchange = max_speed_toolchange;
if travel_speed < max_speed_toolchange then
      speed_toolchange = travel_speed;
endif
"G91
G1 Z1.5 F1800
G90
";

with this

position[2] = position[2] + 2.0;
local speed_toolchange = max_speed_toolchange;
if travel_speed < max_speed_toolchange then
      speed_toolchange = travel_speed;
endif
if print_sequence == "by object" then
      local safe_z = position[2];
      if safe_z < max_layer_z + 2.0 then
            safe_z = max_layer_z + 2.0;
      endif
      "G90
G1 Z" + safe_z + " F1800
";
else
      "G91
G1 Z1.5 F1800
G90
";
endif

this lowers the plate by the entire model Hight if printing by object, removing the risk of head crashes

Describe alternatives you've considered

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions