mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
Fix issues with non-bbl multi-head printers
This commit is contained in:
@@ -1161,7 +1161,7 @@ void GCodeProcessor::run_post_process()
|
||||
out += " S" + std::to_string(temperature) + "\n";
|
||||
return out;
|
||||
} else {
|
||||
const int real_tool = m_physical_extruder_map[tool_number];
|
||||
const int real_tool = tool_number < m_physical_extruder_map.size() ? m_physical_extruder_map[tool_number] : tool_number;
|
||||
std::string comment = "preheat T" + std::to_string(real_tool) +
|
||||
" time: " + std::to_string((int) std::round(time_diffs[0])) + "s";
|
||||
return GCodeWriter::set_temperature(temperature, this->m_flavor, false, real_tool, comment);
|
||||
@@ -1176,7 +1176,7 @@ void GCodeProcessor::run_post_process()
|
||||
|
||||
float val;
|
||||
if (gline.has_value('T', val) && gline.raw().find("cooldown") != std::string::npos) {
|
||||
if (static_cast<int>(val) == m_physical_extruder_map[tool_number])
|
||||
if (static_cast<int>(val) == (tool_number < m_physical_extruder_map.size() ? m_physical_extruder_map[tool_number] : tool_number))
|
||||
return std::string("; removed M104\n");
|
||||
}
|
||||
}
|
||||
@@ -1781,7 +1781,7 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const int
|
||||
//bbox.merge(bbox_custom); // merge the custom gcode pos with other pos*/
|
||||
// check printable area
|
||||
// Simplified use bounding_box, Accurate calculation is not efficient
|
||||
if (!unprintable_areas[extruder_id].empty())
|
||||
if ((extruder_id < unprintable_areas.size()) && !unprintable_areas[extruder_id].empty())
|
||||
for (Polygon poly : unprintable_areas[extruder_id]) {
|
||||
poly.translate(plate_offset);
|
||||
if (poly.bounding_box().overlap(bbox)) {
|
||||
@@ -2300,7 +2300,7 @@ void GCodeProcessor::reset()
|
||||
m_e_local_positioning_type = EPositioningType::Absolute;
|
||||
m_extruder_offsets = std::vector<Vec3f>(MIN_EXTRUDERS_COUNT, Vec3f::Zero());
|
||||
m_flavor = gcfRepRapSprinter;
|
||||
m_nozzle_volume = {0.f,0.f};
|
||||
m_nozzle_volume = std::vector<float>(MAXIMUM_EXTRUDER_NUMBER, 0.f);
|
||||
|
||||
m_start_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
m_end_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
@@ -2310,7 +2310,7 @@ void GCodeProcessor::reset()
|
||||
m_flushing = false;
|
||||
m_virtual_flushing = false;
|
||||
m_wipe_tower = false;
|
||||
m_remaining_volume = { 0.f,0.f };
|
||||
m_remaining_volume = std::vector<float>(MAXIMUM_EXTRUDER_NUMBER, 0.f);
|
||||
// BBS: arc move related data
|
||||
m_move_path_type = EMovePathType::Noop_move;
|
||||
m_arc_center = Vec3f::Zero();
|
||||
@@ -2329,8 +2329,8 @@ void GCodeProcessor::reset()
|
||||
|
||||
m_extrusion_role = erNone;
|
||||
|
||||
m_filament_id = {static_cast<unsigned char>(-1),static_cast<unsigned char>(-1)};
|
||||
m_last_filament_id = {static_cast<unsigned char>(-1),static_cast<unsigned char>(-1) };
|
||||
m_filament_id = std::vector<unsigned char>(MAXIMUM_EXTRUDER_NUMBER, static_cast<unsigned char>(-1));
|
||||
m_last_filament_id = std::vector<unsigned char>(MAXIMUM_EXTRUDER_NUMBER, static_cast<unsigned char>(-1));
|
||||
m_extruder_id = static_cast<unsigned char>(-1);
|
||||
m_extruder_colors.resize(MIN_EXTRUDERS_COUNT);
|
||||
for (size_t i = 0; i < MIN_EXTRUDERS_COUNT; ++i) {
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Slic3r {
|
||||
|
||||
m_nozzle_height_to_rod = print_->config().extruder_clearance_height_to_rod;
|
||||
m_nozzle_clearance_radius = print_->config().extruder_clearance_radius;
|
||||
if (print_->config().nozzle_diameter.size() > 1) {
|
||||
if (print_->config().nozzle_diameter.size() > 1 && print_->config().extruder_printable_height.size() > 1) {
|
||||
m_extruder_height_gap = std::abs(print_->config().extruder_printable_height.values[0] - print_->config().extruder_printable_height.values[1]);
|
||||
m_liftable_extruder_id = print_->config().extruder_printable_height.values[0] < print_->config().extruder_printable_height.values[1] ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,9 @@ static FilamentChangeStats calc_filament_change_info_by_toolorder(const PrintCon
|
||||
{
|
||||
FilamentChangeStats ret;
|
||||
std::unordered_map<int, int> flush_volume_per_filament;
|
||||
std::vector<unsigned int>last_filament_per_extruder(2, -1);
|
||||
int max_extruder_id = *std::max_element(filament_map.begin(), filament_map.end());
|
||||
assert(max_extruder_id >= 0);
|
||||
std::vector<unsigned int>last_filament_per_extruder(max_extruder_id + 1, -1);
|
||||
|
||||
int total_filament_change_count = 0;
|
||||
float total_filament_flush_weight = 0;
|
||||
@@ -1081,7 +1083,7 @@ std::vector<int> ToolOrdering::get_recommended_filament_maps(const std::vector<s
|
||||
std::vector<int>ret(filament_nums, master_extruder_id);
|
||||
bool ignore_ext_filament = false; // TODO: read from config
|
||||
// if mutli_extruder, calc group,otherwise set to 0
|
||||
if (extruder_nums == 2) {
|
||||
if (extruder_nums == 2 && print->is_BBL_printer()) {
|
||||
std::vector<std::string> extruder_ams_count_str = print_config.extruder_ams_count.values;
|
||||
auto extruder_ams_counts = get_extruder_ams_count(extruder_ams_count_str);
|
||||
std::vector<int> group_size = calc_max_group_size(extruder_ams_counts, ignore_ext_filament);
|
||||
@@ -1135,6 +1137,12 @@ std::vector<int> ToolOrdering::get_recommended_filament_maps(const std::vector<s
|
||||
fg.get_custom_seq = get_custom_seq;
|
||||
ret = fg.calc_filament_group();
|
||||
}
|
||||
} else if (extruder_nums > 1) {
|
||||
// For non-bbl multi-extruder printers we don't support filament group yet, and we use filament id as extruder id
|
||||
assert(extruder_nums == filament_nums);
|
||||
for (int i = 0; i < filament_nums; i++) {
|
||||
ret[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1227,6 +1235,7 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
|
||||
}
|
||||
std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) { return value - 1; });
|
||||
|
||||
if (m_print->is_BBL_printer())
|
||||
check_filament_printable_after_group(used_filaments, filament_maps, print_config);
|
||||
}
|
||||
else {
|
||||
@@ -1268,6 +1277,7 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
|
||||
return false;
|
||||
};
|
||||
|
||||
if (m_print->is_BBL_printer() || number_of_extruders == 1){
|
||||
reorder_filaments_for_minimum_flush_volume(
|
||||
filament_lists,
|
||||
filament_maps,
|
||||
@@ -1276,6 +1286,10 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
|
||||
get_custom_seq,
|
||||
&filament_sequences
|
||||
);
|
||||
} else {
|
||||
// For non-bbl multi-extruder printers we don't support filament group yet, so we keep the layer sequence because we don't flush based on order
|
||||
filament_sequences = layer_filaments;
|
||||
}
|
||||
|
||||
auto curr_flush_info = calc_filament_change_info_by_toolorder(print_config, filament_maps, nozzle_flush_mtx, filament_sequences);
|
||||
if (nozzle_nums <= 1)
|
||||
|
||||
Reference in New Issue
Block a user