mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-05 14:27:42 -07:00
ENH: Add limited filament maps to slice info
jira: none Change-Id: I7b08943ba5f4e7fa9be18ba3f64caee182888d45 (cherry picked from commit 85ebb469959499d5c2d7fe349e0d8e92045c9fab)
This commit is contained in:
parent
71b4962b83
commit
444d7fa81a
5 changed files with 31 additions and 1 deletions
|
|
@ -294,6 +294,7 @@ static constexpr const char* OTHER_LAYERS_PRINT_SEQUENCE_NUMS_ATTR = "other_laye
|
|||
static constexpr const char* SPIRAL_VASE_MODE = "spiral_mode";
|
||||
static constexpr const char* FILAMENT_MAP_MODE_ATTR = "filament_map_mode";
|
||||
static constexpr const char* FILAMENT_MAP_ATTR = "filament_maps";
|
||||
static constexpr const char* LIMIT_FILAMENT_MAP_ATTR = "limit_filament_maps";
|
||||
static constexpr const char* GCODE_FILE_ATTR = "gcode_file";
|
||||
static constexpr const char* THUMBNAIL_FILE_ATTR = "thumbnail_file";
|
||||
static constexpr const char* NO_LIGHT_THUMBNAIL_FILE_ATTR = "thumbnail_no_light_file";
|
||||
|
|
@ -7864,6 +7865,12 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
add_vector<int>(stream, plate_data->filament_maps);
|
||||
stream << "\"/>\n";
|
||||
|
||||
if (plate_data->limit_filament_maps.size() > 0) {
|
||||
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << LIMIT_FILAMENT_MAP_ATTR << "\" " << VALUE_ATTR << "=\"";
|
||||
add_vector<int>(stream, plate_data->limit_filament_maps);
|
||||
stream << "\"/>\n";
|
||||
}
|
||||
|
||||
for (auto it = plate_data->objects_and_instances.begin(); it != plate_data->objects_and_instances.end(); it++)
|
||||
{
|
||||
int obj_id = it->first;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,14 @@ struct PlateData
|
|||
bool toolpath_outside {false};
|
||||
bool is_label_object_enabled {false};
|
||||
int timelapse_warning_code = 0; // 1<<0 sprial vase, 1<<1 by object
|
||||
std::vector<int> filament_maps;
|
||||
std::vector<int> filament_maps; // 1 base
|
||||
|
||||
// Hexadecimal number,
|
||||
// the 0th digit corresponds to extruder 1
|
||||
// the 1th digit corresponds to extruder 2
|
||||
// ... and so on.
|
||||
// 0 means can be print on this extruder, 1 means cannot
|
||||
std::vector<int> limit_filament_maps;
|
||||
|
||||
std::vector<GCodeProcessorResult::SliceWarning> warnings;
|
||||
|
||||
|
|
|
|||
|
|
@ -699,8 +699,11 @@ GCodeProcessor::GCodeProcessor()
|
|||
|
||||
bool GCodeProcessor::check_multi_extruder_gcode_valid(const std::vector<Polygons> &unprintable_areas, const std::vector<int> &filament_map)
|
||||
{
|
||||
m_result.limit_filament_maps.clear();
|
||||
m_result.gcode_check_result.reset();
|
||||
|
||||
m_result.limit_filament_maps.resize(filament_map.size(), 0);
|
||||
|
||||
auto to_2d = [](const Vec3d &pos) -> Point {
|
||||
Point ps(scale_(pos.x()), scale_(pos.y()));
|
||||
return ps;
|
||||
|
|
@ -735,6 +738,15 @@ bool GCodeProcessor::check_multi_extruder_gcode_valid(const std::vector<Polygons
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < unprintable_areas.size(); ++i) {
|
||||
for (const Polygon &poly : unprintable_areas[i]) {
|
||||
if (!poly.bounding_box().overlap(bbox))
|
||||
continue;
|
||||
|
||||
m_result.limit_filament_maps[iter->first] |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Accurate calculation is not efficient
|
||||
for (const Polygon& poly : unprintable_areas[extruder_id]) {
|
||||
|
|
|
|||
|
|
@ -233,6 +233,7 @@ class Print;
|
|||
std::vector<float> filament_costs;
|
||||
std::vector<int> filament_vitrification_temperature;
|
||||
std::vector<int> filament_maps;
|
||||
std::vector<int> limit_filament_maps;
|
||||
PrintEstimatedStatistics print_statistics;
|
||||
std::vector<CustomGCode::Item> custom_gcode_per_print_z;
|
||||
std::vector<std::pair<float, std::pair<size_t, size_t>>> spiral_vase_layers;
|
||||
|
|
@ -273,6 +274,7 @@ class Print;
|
|||
warnings = other.warnings;
|
||||
bed_type = other.bed_type;
|
||||
gcode_check_result = other.gcode_check_result;
|
||||
limit_filament_maps = other.limit_filament_maps;
|
||||
filament_printable_reuslt = other.filament_printable_reuslt;
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
time = other.time;
|
||||
|
|
|
|||
|
|
@ -5474,6 +5474,7 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w
|
|||
plate_data_item->timelapse_warning_code = m_plate_list[i]->m_gcode_result->timelapse_warning_code;
|
||||
m_plate_list[i]->set_timelapse_warning_code(plate_data_item->timelapse_warning_code);
|
||||
plate_data_item->is_label_object_enabled = m_plate_list[i]->m_gcode_result->label_object_enabled;
|
||||
plate_data_item->limit_filament_maps = m_plate_list[i]->m_gcode_result->limit_filament_maps;
|
||||
Print *print = nullptr;
|
||||
m_plate_list[i]->get_print((PrintBase **) &print, nullptr, nullptr);
|
||||
if (print) {
|
||||
|
|
@ -5550,6 +5551,7 @@ int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list, int f
|
|||
m_plate_list[index]->set_timelapse_warning_code(plate_data_list[i]->timelapse_warning_code);
|
||||
m_plate_list[index]->slice_filaments_info = plate_data_list[i]->slice_filaments_info;
|
||||
gcode_result->warnings = plate_data_list[i]->warnings;
|
||||
gcode_result->filament_maps = plate_data_list[i]->filament_maps;
|
||||
if (m_plater && !plate_data_list[i]->thumbnail_file.empty()) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": plate %1%, load thumbnail from %2%.")%(i+1) %plate_data_list[i]->thumbnail_file;
|
||||
if (boost::filesystem::exists(plate_data_list[i]->thumbnail_file)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue