FIX: fix build error

This commit is contained in:
zhimin.zeng 2024-12-11 20:41:55 +08:00 committed by lane.wei
parent 5aecc67874
commit 885e96d8db
8 changed files with 17 additions and 134 deletions

View File

@ -543,7 +543,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
}
else if (line == reserved_tag(ETags::Used_Filament_Weight_Placeholder)) {
std::map<size_t, double>total_weight_per_extruder;
for (const auto& pair : context.used_filaments.total_volumes_per_extruder) {
for (const auto& pair : context.used_filaments.total_volumes_per_filament) {
auto filament_id = pair.first;
auto volume = pair.second;
auto iter = std::find_if(context.filament_lists.begin(), context.filament_lists.end(), [filament_id](const Extruder& filament) { return filament.id() == filament_id; });
@ -557,7 +557,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
}
else if (line == reserved_tag(ETags::Used_Filament_Volume_Placeholder)) {
std::map<size_t, double>total_volume_per_extruder;
for (const auto& pair : context.used_filaments.total_volumes_per_extruder) {
for (const auto &pair : context.used_filaments.total_volumes_per_filament) {
auto filament_id = pair.first;
auto volume = pair.second;
auto iter = std::find_if(context.filament_lists.begin(), context.filament_lists.end(), [filament_id](const Extruder& filament) { return filament.id() == filament_id; });
@ -569,7 +569,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
}
else if (line == reserved_tag(ETags::Used_Filament_Length_Placeholder)) {
std::map<size_t, double>total_length_per_extruder;
for (const auto& pair : context.used_filaments.total_volumes_per_extruder) {
for (const auto &pair : context.used_filaments.total_volumes_per_filament) {
auto filament_id = pair.first;
auto volume = pair.second;
auto iter = std::find_if(context.filament_lists.begin(), context.filament_lists.end(), [filament_id](const Extruder& filament) { return filament.id() == filament_id; });

View File

@ -500,39 +500,6 @@ namespace Slic3r {
void calculate_time(size_t keep_last_n_blocks = 0, float additional_time = 0.0f, ExtrusionRole target_role = ExtrusionRole::erNone);
};
struct TimeProcessor
{
struct Planner
{
// Size of the firmware planner queue. The old 8-bit Marlins usually just managed 16 trapezoidal blocks.
// Let's be conservative and plan for newer boards with more memory.
static constexpr size_t queue_size = 64;
// The firmware recalculates last planner_queue_size trapezoidal blocks each time a new block is added.
// We are not simulating the firmware exactly, we calculate a sequence of blocks once a reasonable number of blocks accumulate.
static constexpr size_t refresh_threshold = queue_size * 4;
};
// extruder_id is currently used to correctly calculate filament load / unload times into the total print time.
// This is currently only really used by the MK3 MMU2:
// extruder_unloaded = true means no filament is loaded yet, all the filaments are parked in the MK3 MMU2 unit.
bool extruder_unloaded;
// allow to skip the lines M201/M203/M204/M205 generated by GCode::print_machine_envelope() for non-Normal time estimate mode
bool machine_envelope_processing_enabled;
MachineEnvelopeConfig machine_limits;
// Additional load / unload times for a filament exchange sequence.
float filament_load_times;
float filament_unload_times;
float extruder_change_times;
std::array<TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> machines;
void reset();
// post process the file with the given filename to add remaining time lines M73
// and updates moves' gcode ids accordingly
void post_process(const std::string& filename, std::vector<GCodeProcessorResult::MoveVertex>& moves, std::vector<size_t>& lines_ends, size_t total_layer_num);
};
struct UsedFilaments // filaments per ColorChange
{
double color_change_cache;
@ -608,6 +575,7 @@ namespace Slic3r {
// Additional load / unload times for a filament exchange sequence.
float filament_load_times;
float filament_unload_times;
float extruder_change_times;
std::array<TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> machines;
@ -759,7 +727,7 @@ namespace Slic3r {
bool m_wiping;
bool m_flushing;
bool m_wipe_tower;
float m_remaining_volume;
std::vector<float> m_remaining_volume;
std::vector<Extruder> m_filament_lists;
//BBS: x, y offset for gcode generated

View File

@ -1857,7 +1857,7 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
used = 0.f;
m_old_temperature = -1; // reset last temperature written in the gcode
int index = 0;
std::vector<WipeTower::ToolChangeResult> layer_result;
int index = 0;
for (auto layer : m_plan)

View File

@ -6208,7 +6208,6 @@ bool DeviceManager::set_selected_machine(std::string dev_id, bool need_disconnec
for (auto& data : it->second->m_nozzle_filament_data) {
data.second.checked_filament.clear();
}
it->second->m_checked_filament.clear();
}
selected_machine = dev_id;
return true;

View File

@ -828,7 +828,6 @@ public:
//bool is_support_p1s_plus{false};
bool is_support_nozzle_blob_detection{false};
bool is_support_air_print_detection{false};
bool is_support_filament_setting_inprinting{false};
bool is_support_agora{false};
bool is_support_upgrade_kit{false};
bool is_support_filament_setting_inprinting{false};

View File

@ -9645,20 +9645,20 @@ void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
text = object_clashed_text;
error = ErrorType::PLATER_ERROR;
break;
case EWarning::FilamentUnPrintableOnFirstLayer: {
std::string warning;
const std::vector<int> &conflict_filament = m_gcode_viewer.filament_printable_reuslt.conflict_filament;
auto iter = conflict_filament.begin();
for (int filament : conflict_filament) {
warning += std::to_string(filament + 1);
warning+=" ";
}
text = (boost::format(_u8L("filaments %s cannot be printed directly on the surface of this plate.")) % warning ).str();
error = ErrorType::SLICING_ERROR;
break;
case EWarning::ObjectLimited:
text = object_limited_text;
break;
case EWarning::FilamentUnPrintableOnFirstLayer: {
std::string warning;
const std::vector<int> &conflict_filament = m_gcode_viewer.filament_printable_reuslt.conflict_filament;
auto iter = conflict_filament.begin();
for (int filament : conflict_filament) {
warning += std::to_string(filament + 1);
warning += " ";
}
text = (boost::format(_u8L("filaments %s cannot be printed directly on the surface of this plate.")) % warning).str();
error = ErrorType::SLICING_ERROR;
break;
}
}
//BBS: this may happened when exit the app, plater is null

View File

@ -6221,26 +6221,6 @@ void ObjectList::enable_layers_editing()
}
}
void ObjectList::enable_layers_editing()
{
wxDataViewItemArray sels;
GetSelections(sels);
if (sels.IsEmpty())
return;
wxDataViewItem frst_item = sels[0];
ItemType type = m_objects_model->GetItemType(frst_item);
if (!(type & itObject))
return;
//take_snapshot("");
auto view3d = wxGetApp().plater()->get_view3D_canvas3D();
if (view3d != nullptr && m_objects_model->IsVariableHeight(frst_item)){
view3d->enable_layers_editing(true);
}
}
ModelObject* ObjectList::object(const int obj_idx) const
{
if (obj_idx < 0)

View File

@ -348,69 +348,6 @@ void PartPlate::calc_bounding_boxes() const {
}
}
void PartPlate::calc_triangles(const ExPolygon& poly)
{
auto triangles =triangulate_expolygon_2f(poly, NORMALS_UP);
m_triangles.reset();
if (!m_triangles.init_model_from_poly(triangles, GROUND_Z))
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create plate triangles\n";
}
void PartPlate::calc_exclude_triangles(const ExPolygon& poly) {
if (poly.empty()) {
m_exclude_triangles.reset();
return;
}
auto triangles = triangulate_expolygon_2f(poly, NORMALS_UP);
m_exclude_triangles.reset();
if (!m_exclude_triangles.init_model_from_poly(triangles, GROUND_Z))
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create plate triangles\n";
}
void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox) {
Polylines axes_lines, axes_lines_bolder;
int count = 0;
for (coord_t x = pp_bbox.min(0); x <= pp_bbox.max(0); x += scale_(10.0)) {
Polyline line;
line.append(Point(x, pp_bbox.min(1)));
line.append(Point(x, pp_bbox.max(1)));
if ( (count % 5) == 0 )
axes_lines_bolder.push_back(line);
else
axes_lines.push_back(line);
count ++;
}
count = 0;
for (coord_t y = pp_bbox.min(1); y <= pp_bbox.max(1); y += scale_(10.0)) {
Polyline line;
line.append(Point(pp_bbox.min(0), y));
line.append(Point(pp_bbox.max(0), y));
axes_lines.push_back(line);
if ( (count % 5) == 0 )
axes_lines_bolder.push_back(line);
else
axes_lines.push_back(line);
count ++;
}
// clip with a slightly grown expolygon because our lines lay on the contours and may get erroneously clipped
Lines gridlines = to_lines(intersection_pl(axes_lines, offset(poly, (float)SCALED_EPSILON)));
Lines gridlines_bolder = to_lines(intersection_pl(axes_lines_bolder, offset(poly, (float)SCALED_EPSILON)));
// append bed contours
Lines contour_lines = to_lines(poly);
std::copy(contour_lines.begin(), contour_lines.end(), std::back_inserter(gridlines));
m_gridlines.reset();
if (!m_gridlines.init_model_from_lines(gridlines, GROUND_Z))
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Unable to create bed grid lines\n";
m_gridlines_bolder.reset();
if (!m_gridlines_bolder.init_model_from_lines(gridlines_bolder, GROUND_Z))
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "Unable to create bed grid lines\n";
}
void PartPlate::calc_height_limit() {
Lines3 bottom_h_lines, top_lines, top_h_lines, common_lines;
int shape_count = m_shape.size();