fix Z offset:

fix crash (comes from commit 0a65e1b0d6a234bb9c9d58047940bed85260d700)
fix slicing preview
also fix a toolchange missing (just notifying the writer)
supermerill/SuperSlicer#1347
This commit is contained in:
remi durand 2021-06-24 18:50:27 +02:00
parent e371b3088f
commit bb6c3a2d79
2 changed files with 5 additions and 5 deletions

View File

@ -1451,7 +1451,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
for (LayerToPrint &ltp : layers_to_print) {
std::vector<LayerToPrint> lrs;
lrs.emplace_back(std::move(ltp));
this->process_layer(file, print, print.m_print_statistics, lrs, tool_ordering.tools_for_layer(ltp.print_z() + print.config().z_offset), nullptr, *print_object_instance_sequential_active - object.instances().data());
this->process_layer(file, print, print.m_print_statistics, lrs, tool_ordering.tools_for_layer(ltp.print_z()), nullptr, *print_object_instance_sequential_active - object.instances().data());
print.throw_if_canceled();
}
#ifdef HAS_PRESSURE_EQUALIZER
@ -4059,7 +4059,7 @@ std::string GCode::set_extruder(uint16_t extruder_id, double print_z, bool no_to
}
if (!no_toolchange) {
gcode+=toolchange(extruder_id, print_z);
}
}else m_writer.toolchange(extruder_id);
return gcode;
}
@ -4094,7 +4094,7 @@ std::string GCode::set_extruder(uint16_t extruder_id, double print_z, bool no_to
if (!no_toolchange) {
gcode += toolchange(extruder_id, print_z);
}
}else m_writer.toolchange(extruder_id);
// Set the temperature if the wipe tower didn't (not needed for non-single extruder MM)
// supermerill change: try to set the good temp, because the wipe tower don't use the gcode writer and so can write wrong stuff.

View File

@ -663,7 +663,7 @@ wxBoxSizer* Preview::create_layers_slider_sizer()
Info custom_gcode_per_print_z = m_layers_slider->GetTicksValues();
//remove z-shift from gcode output
const float z_shift = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_float("z_offset");
if (can_display_gcode() && z_shift != 0) {
if (can_display_gcode() && z_shift != 0 && ForceState::ForceExtrusions != current_force_state) {
for (CustomGCode::Item& tick : custom_gcode_per_print_z.gcodes) {
tick.print_z -= z_shift;
}
@ -751,7 +751,7 @@ void Preview::update_layers_slider(const std::vector<double>& layers_z, bool kee
{
//add z-shift from gcode output
const float z_shift = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_float("z_offset");
if (can_display_gcode() && z_shift != 0) {
if (can_display_gcode() && z_shift != 0 && ForceState::ForceExtrusions != current_force_state) {
for (CustomGCode::Item& tick : ticks_info_from_model.gcodes) {
tick.print_z += z_shift;
}