Update the codes to 01.01.00.10 for the formal release

1. first formal version of macos
2. add the bambu networking plugin install logic
3. auto compute the wipe volume when filament change
4. add the logic of wiping into support
5. refine the GUI layout and icons, improve the gui apperance in lots of
   small places
6. serveral improve to support
7. support AMS auto-mapping
8. disable lots of unstable features: such as params table, media file download, HMS
9. fix serveral kinds of bugs
10. update the document of building
11. ...
This commit is contained in:
lane.wei 2022-07-22 17:46:10 +08:00 committed by Lane.Wei
parent e1528e4299
commit e9e4d75877
267 changed files with 10326 additions and 32228 deletions

View file

@ -1,50 +0,0 @@
#include "SpeedGenerator.hpp"
#include "libslic3r/ExtrusionEntity.hpp"
#include "libslic3r/Utils.hpp"
#define BOOST_SPIRIT_THREADSAFE
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/date_time.hpp>
#include <boost/foreach.hpp>
namespace Slic3r {
SpeedGenerator::SpeedGenerator() {
// default is 100 speed
for (int i = 0; i < 6; i++) {
speed_table[i] = 100;
}
std::string config_file = resources_dir() + "/PerimeterSpeedConfig.json";
std::string encoded_path = encode_path(config_file.c_str());
boost::property_tree::read_json<boost::property_tree::ptree>(encoded_path, root);
if (root.count("speed_table")) {
int i = 0;
auto array6 = root.get_child("speed_table");
for (auto pos = array6.begin(); pos != array6.end() && i < 6; pos++, i++)
speed_table[i] = pos->second.get_value<int>();
}
}
double SpeedGenerator::calculate_speed(const ExtrusionPath& path, double max_speed, double min_speed) {
// limit the speed in case of F0 generated in gcode when user set 0 speed in UI
// which cause printer stopped. 1mm/s is slow enough and can make printer not really stopped.
max_speed = max_speed < 1 ? 1 : max_speed;
min_speed = min_speed < 1 ? 1 : min_speed;
// switch min and max speed if user set the max speed to be slower than min_speed
if (max_speed < min_speed) {
double temp = max_speed;
max_speed = min_speed;
min_speed = temp;
}
speed_table[0] = max_speed;
int overhang_degree = path.get_overhang_degree();
assert(overhang_degree >= 0 && overhang_degree <= 6);
double speed = (double)speed_table[overhang_degree];
speed = std::max(speed, min_speed);
speed = std::min(speed, max_speed);
return speed;
}
}

View file

@ -1,22 +0,0 @@
#ifndef libslic3r_SpeedGenerator_hpp_
#define libslic3r_SpeedGenerator_hpp_
#include <string>
namespace Slic3r {
class ExtrusionPath;
class SpeedGenerator {
public:
SpeedGenerator();
double calculate_speed(const ExtrusionPath& path, double max_speed, double min_speed);
private:
boost::property_tree::ptree root;
int speed_table[6];
};
}
#endif // libslic3r_SpeedGenerator_hpp_

View file

@ -304,6 +304,7 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto
layer_tools.extruders.push_back(extruder_interface);
if (has_support || has_interface) {
layer_tools.has_support = true;
layer_tools.wiping_extrusions().is_support_overriddable_and_mark(role, object);
}
}
@ -321,6 +322,7 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto
layer_tools.extruders.push_back(extruder_interface);
if (has_support || has_interface) {
layer_tools.has_support = true;
layer_tools.wiping_extrusions().is_support_overriddable_and_mark(role, object);
}
}
@ -797,6 +799,19 @@ void WipingExtrusions::set_extruder_override(const ExtrusionEntity* entity, size
copies_vector[copy_id] = extruder;
}
// BBS
void WipingExtrusions::set_support_extruder_override(const PrintObject* object, size_t copy_id, int extruder, size_t num_of_copies)
{
something_overridden = true;
support_map.emplace(object, extruder);
}
void WipingExtrusions::set_support_interface_extruder_override(const PrintObject* object, size_t copy_id, int extruder, size_t num_of_copies)
{
something_overridden = true;
support_intf_map.emplace(object, extruder);
}
// Finds first non-soluble extruder on the layer
int WipingExtrusions::first_nonsoluble_extruder_on_layer(const PrintConfig& print_config) const
{
@ -834,6 +849,25 @@ bool WipingExtrusions::is_overriddable(const ExtrusionEntityCollection& eec, con
return true;
}
// BBS
bool WipingExtrusions::is_support_overriddable(const ExtrusionRole role, const PrintObject& object) const
{
if (!object.config().flush_into_support)
return false;
if (role == erMixed) {
return object.config().support_filament == 0 || object.config().support_interface_filament == 0;
}
else if (role == erSupportMaterial || role == erSupportTransition) {
return object.config().support_filament == 0;
}
else if (role == erSupportMaterialInterface) {
return object.config().support_interface_filament == 0;
}
return false;
}
// Following function iterates through all extrusions on the layer, remembers those that could be used for wiping after toolchange
// and returns volume that is left to be wiped on the wipe tower.
float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int old_extruder, unsigned int new_extruder, float volume_to_wipe)
@ -844,6 +878,10 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
if (! this->something_overridable || volume_to_wipe <= 0. || print.config().filament_soluble.get_at(old_extruder) || print.config().filament_soluble.get_at(new_extruder))
return std::max(0.f, volume_to_wipe); // Soluble filament cannot be wiped in a random infill, neither the filament after it
// BBS
if (print.config().filament_is_support.get_at(old_extruder))
return std::max(0.f, volume_to_wipe); // Support filament cannot be used to print support, infill, wipe_tower, etc.
// we will sort objects so that dedicated for wiping are at the beginning:
ConstPrintObjectPtrs object_list = print.objects().vector();
std::sort(object_list.begin(), object_list.end(), [](const PrintObject* a, const PrintObject* b) { return a->config().flush_into_objects; });
@ -876,7 +914,7 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
for (const LayerRegion *layerm : this_layer->regions()) {
const auto &region = layerm->region();
if (!object->config().flush_into_infill && !object->config().flush_into_objects)
if (!object->config().flush_into_infill && !object->config().flush_into_objects && !object->config().flush_into_support)
continue;
bool wipe_into_infill_only = !object->config().flush_into_objects && object->config().flush_into_infill;
bool is_infill_first = print.config().wall_infill_order == WallInfillOrder::InfillInnerOuter ||
@ -918,6 +956,46 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
}
}
}
// BBS
if (object->config().flush_into_support) {
auto& object_config = object->config();
const SupportLayer* this_support_layer = object->get_support_layer_at_printz(lt.print_z, EPSILON);
const TreeSupportLayer* this_tree_support_layer = object->get_tree_support_layer_at_printz(lt.print_z, EPSILON);
do {
if (this_support_layer == nullptr && this_tree_support_layer == nullptr)
break;
bool support_overriddable = object_config.support_filament == 0;
bool support_intf_overriddable = object_config.support_interface_filament == 0;
if (!support_overriddable && !support_intf_overriddable)
break;
auto& entities = this_support_layer != nullptr ? this_support_layer->support_fills.entities : this_tree_support_layer->support_fills.entities;
if (support_overriddable && !is_support_overridden(object)) {
set_support_extruder_override(object, copy, new_extruder, num_of_copies);
for (const ExtrusionEntity* ee : entities) {
if (ee->role() == erSupportMaterial || ee->role() == erSupportTransition)
volume_to_wipe -= ee->total_volume();
if (volume_to_wipe <= 0.f)
return 0.f;
}
}
if (support_intf_overriddable && !is_support_interface_overridden(object)) {
set_support_interface_extruder_override(object, copy, new_extruder, num_of_copies);
for (const ExtrusionEntity* ee : entities) {
if (ee->role() == erSupportMaterialInterface)
volume_to_wipe -= ee->total_volume();
if (volume_to_wipe <= 0.f)
return 0.f;
}
}
} while (0);
}
}
}
// Some purge remains to be done on the Wipe Tower.
@ -1010,4 +1088,24 @@ const WipingExtrusions::ExtruderPerCopy* WipingExtrusions::get_extruder_override
return overrides;
}
// BBS
int WipingExtrusions::get_support_extruder_overrides(const PrintObject* object)
{
auto iter = support_map.find(object);
if (iter != support_map.end())
return iter->second;
return -1;
}
int WipingExtrusions::get_support_interface_extruder_overrides(const PrintObject* object)
{
auto iter = support_intf_map.find(object);
if (iter != support_intf_map.end())
return iter->second;
return -1;
}
} // namespace Slic3r

View file

@ -32,6 +32,8 @@ public:
// This is called from GCode::process_layer - see implementation for further comments:
const ExtruderPerCopy* get_extruder_overrides(const ExtrusionEntity* entity, int correct_extruder_id, size_t num_of_copies);
int get_support_extruder_overrides(const PrintObject* object);
int get_support_interface_extruder_overrides(const PrintObject* object);
// This function goes through all infill entities, decides which ones will be used for wiping and
// marks them by the extruder id. Returns volume that remains to be wiped on the wipe tower:
@ -46,6 +48,22 @@ public:
return out;
}
// BBS
bool is_support_overriddable(const ExtrusionRole role, const PrintObject& object) const;
bool is_support_overriddable_and_mark(const ExtrusionRole role, const PrintObject& object) {
bool out = this->is_support_overriddable(role, object);
this->something_overridable |= out;
return out;
}
bool is_support_overridden(const PrintObject* object) const {
return support_map.find(object) != support_map.end();
}
bool is_support_interface_overridden(const PrintObject* object) const {
return support_intf_map.find(object) != support_intf_map.end();
}
void set_layer_tools_ptr(const LayerTools* lt) { m_layer_tools = lt; }
private:
@ -54,6 +72,9 @@ private:
// This function is called from mark_wiping_extrusions and sets extruder that it should be printed with (-1 .. as usual)
void set_extruder_override(const ExtrusionEntity* entity, size_t copy_id, int extruder, size_t num_of_copies);
// BBS
void set_support_extruder_override(const PrintObject* object, size_t copy_id, int extruder, size_t num_of_copies);
void set_support_interface_extruder_override(const PrintObject* object, size_t copy_id, int extruder, size_t num_of_copies);
// Returns true in case that entity is not printed with its usual extruder for a given copy:
bool is_entity_overridden(const ExtrusionEntity* entity, size_t copy_id) const {
@ -62,6 +83,9 @@ private:
}
std::map<const ExtrusionEntity*, ExtruderPerCopy> entity_map; // to keep track of who prints what
// BBS
std::map<const PrintObject*, int> support_map;
std::map<const PrintObject*, int> support_intf_map;
bool something_overridable = false;
bool something_overridden = false;
const LayerTools* m_layer_tools = nullptr; // so we know which LayerTools object this belongs to