Merge branch 'main' into dev/outline-2

This commit is contained in:
Noisyfox
2024-08-30 21:43:26 +08:00
109 changed files with 10594 additions and 10481 deletions
-1
View File
@@ -1190,7 +1190,6 @@ int CLI::run(int argc, char **argv)
//BBS: add plate data related logic
PlateDataPtrs plate_data_src;
std::vector<plate_obj_size_info_t> plate_obj_size_infos;
int arrange_option;
int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0;
bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false;
bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false;
+29 -7
View File
@@ -10,12 +10,15 @@
namespace Slic3r {
template<typename LINE_T>
int stagger_seam_index(int ind, LINE_T line)
int stagger_seam_index(int ind, LINE_T line, double shift, bool dir)
{
Point const *point = &line.points[ind];
double dist = 0;
while (dist < 0.5 / SCALING_FACTOR) {
ind = (ind + 1) % line.points.size();
while (dist < shift / SCALING_FACTOR) {
if (dir)
ind = (ind + 1) % line.points.size();
else
ind = ind > 0 ? --ind : line.points.size() - 1;
Point const &next = line.points[ind];
dist += point->distance_to(next);
point = &next;
@@ -23,6 +26,8 @@ int stagger_seam_index(int ind, LINE_T line)
return ind;
}
#define STAGGER_SEAM_THRESHOLD 0.9
void FillConcentric::_fill_surface_single(
const FillParams &params,
unsigned int thickness_layers,
@@ -55,8 +60,20 @@ void FillConcentric::_fill_surface_single(
// split paths using a nearest neighbor search
size_t iPathFirst = polylines_out.size();
Point last_pos(0, 0);
double min_nozzle_diameter;
bool dir;
if (this->print_config != nullptr && params.density >= STAGGER_SEAM_THRESHOLD) {
min_nozzle_diameter = *std::min_element(print_config->nozzle_diameter.values.begin(), print_config->nozzle_diameter.values.end());
dir = rand() % 2;
}
for (const Polygon &loop : loops) {
polylines_out.emplace_back(loop.split_at_index(stagger_seam_index(last_pos.nearest_point_index(loop.points), loop)));
int ind = (this->print_config != nullptr && params.density > STAGGER_SEAM_THRESHOLD) ?
stagger_seam_index(last_pos.nearest_point_index(loop.points), loop, min_nozzle_diameter / 2, dir) :
last_pos.nearest_point_index(loop.points);
polylines_out.emplace_back(loop.split_at_index(ind));
last_pos = polylines_out.back().last_point();
}
@@ -118,13 +135,18 @@ void FillConcentric::_fill_surface_single(const FillParams& params,
// Split paths using a nearest neighbor search.
size_t firts_poly_idx = thick_polylines_out.size();
Point last_pos(0, 0);
bool dir = rand() % 2;
for (const Arachne::ExtrusionLine* extrusion : all_extrusions) {
if (extrusion->empty())
continue;
ThickPolyline thick_polyline = Arachne::to_thick_polyline(*extrusion);
if (extrusion->is_closed)
thick_polyline.start_at_index(stagger_seam_index(last_pos.nearest_point_index(thick_polyline.points), thick_polyline));
if (extrusion->is_closed) {
int ind = (params.density >= STAGGER_SEAM_THRESHOLD) ?
stagger_seam_index(last_pos.nearest_point_index(thick_polyline.points), thick_polyline, min_nozzle_diameter / 2, dir) :
last_pos.nearest_point_index(thick_polyline.points);
thick_polyline.start_at_index(ind);
}
thick_polylines_out.emplace_back(std::move(thick_polyline));
last_pos = thick_polylines_out.back().last_point();
}
-1
View File
@@ -878,7 +878,6 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool extract_object_model()
{
mz_zip_archive archive;
mz_zip_archive_file_stat stat;
mz_zip_zero_struct(&archive);
if (!open_zip_reader(&archive, zip_path)) {
+5 -2
View File
@@ -5568,6 +5568,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
size_t start_index = fitting_result[fitting_index].start_point_index;
size_t end_index = fitting_result[fitting_index].end_point_index;
for (size_t point_index = start_index + 1; point_index < end_index + 1; point_index++) {
tempDescription = description;
const Line line = Line(path.polyline.points[point_index - 1], path.polyline.points[point_index]);
const double line_length = line.length() * SCALING_FACTOR;
if (line_length < EPSILON)
@@ -5891,8 +5892,10 @@ std::string GCode::travel_to(const Point& point, ExtrusionRole role, std::string
// generate G-code for the travel move
if (needs_retraction) {
if (m_config.reduce_crossing_wall && could_be_wipe_disabled)
m_wipe.reset_path();
// ORCA: Fix scenario where wipe is disabled when avoid crossing perimeters was enabled even though a retraction move was performed.
// This replicates the existing behaviour of always wiping when retracting
/*if (m_config.reduce_crossing_wall && could_be_wipe_disabled)
m_wipe.reset_path();*/
Point last_post_before_retract = this->last_pos();
gcode += this->retract(false, false, lift_type);
+3 -63
View File
@@ -521,62 +521,6 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std::
return per_extruder_adjustments;
}
// Slow down an extruder range proportionally down to slow_down_layer_time.
// Return the total time for the complete layer.
static inline float extruder_range_slow_down_proportional(
std::vector<PerExtruderAdjustments*>::iterator it_begin,
std::vector<PerExtruderAdjustments*>::iterator it_end,
// Elapsed time for the extruders already processed.
float elapsed_time_total0,
// Initial total elapsed time before slow down.
float elapsed_time_before_slowdown,
// Target time for the complete layer (all extruders applied).
float slow_down_layer_time)
{
// Total layer time after the slow down has been applied.
float total_after_slowdown = elapsed_time_before_slowdown;
// Now decide, whether the external perimeters shall be slowed down as well.
float max_time_nep = elapsed_time_total0;
for (auto it = it_begin; it != it_end; ++ it)
max_time_nep += (*it)->maximum_time_after_slowdown(false);
if (max_time_nep > slow_down_layer_time) {
// It is sufficient to slow down the non-external perimeter moves to reach the target layer time.
// Slow down the non-external perimeters proportionally.
float non_adjustable_time = elapsed_time_total0;
for (auto it = it_begin; it != it_end; ++ it)
non_adjustable_time += (*it)->non_adjustable_time(false);
// The following step is a linear programming task due to the minimum movement speeds of the print moves.
// Run maximum 5 iterations until a good enough approximation is reached.
for (size_t iter = 0; iter < 5; ++ iter) {
float factor = (slow_down_layer_time - non_adjustable_time) / (total_after_slowdown - non_adjustable_time);
assert(factor > 1.f);
total_after_slowdown = elapsed_time_total0;
for (auto it = it_begin; it != it_end; ++ it)
total_after_slowdown += (*it)->slow_down_proportional(factor, false);
if (total_after_slowdown > 0.95f * slow_down_layer_time)
break;
}
} else {
// Slow down everything. First slow down the non-external perimeters to maximum.
for (auto it = it_begin; it != it_end; ++ it)
(*it)->slowdown_to_minimum_feedrate(false);
// Slow down the external perimeters proportionally.
float non_adjustable_time = elapsed_time_total0;
for (auto it = it_begin; it != it_end; ++ it)
non_adjustable_time += (*it)->non_adjustable_time(true);
for (size_t iter = 0; iter < 5; ++ iter) {
float factor = (slow_down_layer_time - non_adjustable_time) / (total_after_slowdown - non_adjustable_time);
assert(factor > 1.f);
total_after_slowdown = elapsed_time_total0;
for (auto it = it_begin; it != it_end; ++ it)
total_after_slowdown += (*it)->slow_down_proportional(factor, true);
if (total_after_slowdown > 0.95f * slow_down_layer_time)
break;
}
}
return total_after_slowdown;
}
// Slow down an extruder range to slow_down_layer_time.
// Return the total time for the complete layer.
static inline void extruder_range_slow_down_non_proportional(
@@ -674,9 +618,8 @@ float CoolingBuffer::calculate_layer_slowdown(std::vector<PerExtruderAdjustments
adj.time_maximum = adj.maximum_time_after_slowdown(true);
if (adj.cooling_slow_down_enabled && adj.lines.size() > 0) {
by_slowdown_time.emplace_back(&adj);
if (! m_cooling_logic_proportional)
// sorts the lines, also sets adj.time_non_adjustable
adj.sort_lines_by_decreasing_feedrate();
// sorts the lines, also sets adj.time_non_adjustable
adj.sort_lines_by_decreasing_feedrate();
} else
elapsed_time_total0 += adj.elapsed_time_total();
}
@@ -700,10 +643,7 @@ float CoolingBuffer::calculate_layer_slowdown(std::vector<PerExtruderAdjustments
for (auto it = cur_begin; it != by_slowdown_time.end(); ++ it)
max_time += (*it)->time_maximum;
if (max_time > slow_down_layer_time) {
if (m_cooling_logic_proportional)
extruder_range_slow_down_proportional(cur_begin, by_slowdown_time.end(), elapsed_time_total0, total, slow_down_layer_time);
else
extruder_range_slow_down_non_proportional(cur_begin, by_slowdown_time.end(), slow_down_layer_time - total);
extruder_range_slow_down_non_proportional(cur_begin, by_slowdown_time.end(), slow_down_layer_time - total);
} else {
// Slow down to maximum possible.
for (auto it = cur_begin; it != by_slowdown_time.end(); ++ it)
-3
View File
@@ -54,9 +54,6 @@ private:
// the PrintConfig slice of FullPrintConfig is constant, thus no thread synchronization is required.
const PrintConfig &m_config;
unsigned int m_current_extruder;
// Old logic: proportional.
bool m_cooling_logic_proportional = false;
//BBS: current fan speed
int m_current_fan_speed;
};
+2 -17
View File
@@ -47,7 +47,6 @@ static const float DEFAULT_FILAMENT_DIAMETER = 1.75f;
static const int DEFAULT_FILAMENT_HRC = 0;
static const float DEFAULT_FILAMENT_DENSITY = 1.245f;
static const float DEFAULT_FILAMENT_COST = 29.99f;
static const float DEFAULT_FILAMENT_FLOW_RATIOS = 1.0f;
static const int DEFAULT_FILAMENT_VITRIFICATION_TEMPERATURE = 0;
static const Slic3r::Vec3f DEFAULT_EXTRUDER_OFFSET = Slic3r::Vec3f::Zero();
@@ -955,7 +954,6 @@ void GCodeProcessorResult::reset() {
required_nozzle_HRC = std::vector<int>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_HRC);
filament_densities = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY);
filament_costs = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_COST);
filament_flow_ratios = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_FLOW_RATIOS);
custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
spiral_vase_layers = std::vector<std::pair<float, std::pair<size_t, size_t>>>();
bed_match_result = BedMatchResult(true);
@@ -1078,7 +1076,6 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_result.filament_densities.resize(extruders_count);
m_result.filament_vitrification_temperature.resize(extruders_count);
m_result.filament_costs.resize(extruders_count);
m_result.filament_flow_ratios.resize(extruders_count);
m_extruder_temps.resize(extruders_count);
m_extruder_temps_config.resize(extruders_count);
m_extruder_temps_first_layer_config.resize(extruders_count);
@@ -1098,7 +1095,6 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_result.filament_densities[i] = static_cast<float>(config.filament_density.get_at(i));
m_result.filament_vitrification_temperature[i] = static_cast<float>(config.temperature_vitrification.get_at(i));
m_result.filament_costs[i] = static_cast<float>(config.filament_cost.get_at(i));
m_result.filament_flow_ratios[i] = static_cast<float>(config.filament_flow_ratio.get_at(i));
}
if (m_flavor == gcfMarlinLegacy || m_flavor == gcfMarlinFirmware || m_flavor == gcfKlipper || m_flavor == gcfRepRapFirmware) {
@@ -1262,15 +1258,6 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
m_result.filament_costs.emplace_back(DEFAULT_FILAMENT_COST);
}
// Orca: filament flow ratio
const ConfigOptionFloats* filament_flow_ratios = config.option<ConfigOptionFloats>("filament_flow_ratio");
if (filament_flow_ratios != nullptr) {
m_result.filament_flow_ratios.clear();
m_result.filament_flow_ratios.resize(filament_flow_ratios->values.size());
for (size_t i = 0; i < filament_flow_ratios->values.size(); ++i)
m_result.filament_flow_ratios[i]=static_cast<float>(filament_flow_ratios->values[i]);
}
//BBS
const ConfigOptionInts* filament_vitrification_temperature = config.option<ConfigOptionInts>("temperature_vitrification");
if (filament_vitrification_temperature != nullptr) {
@@ -2930,7 +2917,6 @@ void GCodeProcessor::process_G0(const GCodeReader::GCodeLine& line)
void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line, const std::optional<unsigned int>& remaining_internal_g1_lines)
{
float filament_diameter = (static_cast<size_t>(m_extruder_id) < m_result.filament_diameters.size()) ? m_result.filament_diameters[m_extruder_id] : m_result.filament_diameters.back();
float filament_flowratio = (static_cast<size_t>(m_extruder_id) < m_result.filament_flow_ratios.size()) ? m_result.filament_flow_ratios[m_extruder_id] : m_result.filament_flow_ratios.back();
float filament_radius = 0.5f * filament_diameter;
float area_filament_cross_section = static_cast<float>(M_PI) * sqr(filament_radius);
auto absolute_position = [this, area_filament_cross_section](Axis axis, const GCodeReader::GCodeLine& lineG1) {
@@ -3008,7 +2994,7 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line, const std::o
m_used_filaments.increase_model_caches(volume_extruded_filament);
}
// volume extruded filament / tool displacement = area toolpath cross section
m_mm3_per_mm = area_toolpath_cross_section * filament_flowratio;
m_mm3_per_mm = area_toolpath_cross_section;
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_mm3_per_mm_compare.update(area_toolpath_cross_section, m_extrusion_role);
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
@@ -3359,7 +3345,6 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line, const std::o
void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line)
{
float filament_diameter = (static_cast<size_t>(m_extruder_id) < m_result.filament_diameters.size()) ? m_result.filament_diameters[m_extruder_id] : m_result.filament_diameters.back();
float filament_flowratio = (static_cast<size_t>(m_extruder_id) < m_result.filament_flow_ratios.size()) ? m_result.filament_flow_ratios[m_extruder_id] : m_result.filament_flow_ratios.back();
float filament_radius = 0.5f * filament_diameter;
float area_filament_cross_section = static_cast<float>(M_PI) * sqr(filament_radius);
auto absolute_position = [this, area_filament_cross_section](Axis axis, const GCodeReader::GCodeLine& lineG2_3) {
@@ -3488,7 +3473,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line)
m_used_filaments.increase_model_caches(volume_extruded_filament);
}
//BBS: volume extruded filament / tool displacement = area toolpath cross section
m_mm3_per_mm = area_toolpath_cross_section * filament_flowratio;
m_mm3_per_mm = area_toolpath_cross_section;
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_mm3_per_mm_compare.update(area_toolpath_cross_section, m_extrusion_role);
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
-2
View File
@@ -215,7 +215,6 @@ class Print;
std::vector<int> required_nozzle_HRC;
std::vector<float> filament_densities;
std::vector<float> filament_costs;
std::vector<float> filament_flow_ratios;
std::vector<int> filament_vitrification_temperature;
PrintEstimatedStatistics print_statistics;
std::vector<CustomGCode::Item> custom_gcode_per_print_z;
@@ -251,7 +250,6 @@ class Print;
filament_diameters = other.filament_diameters;
filament_densities = other.filament_densities;
filament_costs = other.filament_costs;
filament_flow_ratios = other.filament_flow_ratios;
print_statistics = other.print_statistics;
custom_gcode_per_print_z = other.custom_gcode_per_print_z;
spiral_vase_layers = other.spiral_vase_layers;
+16
View File
@@ -640,6 +640,22 @@ Transform3d Transformation::get_matrix_no_scaling_factor() const
return copy.get_matrix();
}
// Orca: Implement prusa's filament shrink compensation approach
Transform3d Transformation::get_matrix_with_applied_shrinkage_compensation(const Vec3d &shrinkage_compensation) const {
const Transform3d shrinkage_trafo = Geometry::scale_transform(shrinkage_compensation);
const Vec3d trafo_offset = this->get_offset();
const Vec3d trafo_offset_xy = Vec3d(trafo_offset.x(), trafo_offset.y(), 0.);
Transformation copy(*this);
copy.set_offset(Axis::X, 0.);
copy.set_offset(Axis::Y, 0.);
Transform3d trafo_after_shrinkage = (shrinkage_trafo * copy.get_matrix());
trafo_after_shrinkage.translation() += trafo_offset_xy;
return trafo_after_shrinkage;
}
Transformation Transformation::operator * (const Transformation& other) const
{
return Transformation(get_matrix() * other.get_matrix());
+3
View File
@@ -466,6 +466,9 @@ public:
Transform3d get_matrix_no_offset() const;
Transform3d get_matrix_no_scaling_factor() const;
// Orca: Implement prusa's filament shrink compensation approach
Transform3d get_matrix_with_applied_shrinkage_compensation(const Vec3d &shrinkage_compensation) const;
void set_matrix(const Transform3d& transform) { m_matrix = transform; }
Transformation operator * (const Transformation& other) const;
+18
View File
@@ -2779,6 +2779,24 @@ void ModelVolume::convert_from_meters()
this->source.is_converted_from_meters = true;
}
// Orca: Implement prusa's filament shrink compensation approach
// Returns 0-based indices of extruders painted by multi-material painting gizmo.
std::vector<size_t> ModelVolume::get_extruders_from_multi_material_painting() const {
if (!this->is_mm_painted())
return {};
assert(static_cast<size_t>(TriangleStateType::Extruder1) - 1 == 0);
const TriangleSelector::TriangleSplittingData &data = this->mmu_segmentation_facets.get_data();
std::vector<size_t> extruders;
for (size_t state_idx = static_cast<size_t>(EnforcerBlockerType::Extruder1); state_idx < data.used_states.size(); ++state_idx) {
if (data.used_states[state_idx])
extruders.emplace_back(state_idx - 1);
}
return extruders;
}
void ModelInstance::transform_mesh(TriangleMesh* mesh, bool dont_translate) const
{
mesh->transform(dont_translate ? get_matrix_no_offset() : get_matrix());
+4
View File
@@ -991,6 +991,10 @@ public:
bool is_fdm_support_painted() const { return !this->supported_facets.empty(); }
bool is_seam_painted() const { return !this->seam_facets.empty(); }
bool is_mm_painted() const { return !this->mmu_segmentation_facets.empty(); }
// Orca: Implement prusa's filament shrink compensation approach
// Returns 0-based indices of extruders painted by multi-material painting gizmo.
std::vector<size_t> get_extruders_from_multi_material_painting() const;
protected:
friend class Print;
+1 -1
View File
@@ -840,7 +840,7 @@ static std::vector<std::string> s_Preset_filament_options {
"filament_wipe_distance", "additional_cooling_fan_speed",
"nozzle_temperature_range_low", "nozzle_temperature_range_high",
//SoftFever
"enable_pressure_advance", "pressure_advance","adaptive_pressure_advance","adaptive_pressure_advance_model","adaptive_pressure_advance_overhangs", "adaptive_pressure_advance_bridges","chamber_temperature", "filament_shrink", "support_material_interface_fan_speed", "filament_notes" /*,"filament_seam_gap"*/,
"enable_pressure_advance", "pressure_advance","adaptive_pressure_advance","adaptive_pressure_advance_model","adaptive_pressure_advance_overhangs", "adaptive_pressure_advance_bridges","chamber_temperature", "filament_shrink","filament_shrinkage_compensation_z", "support_material_interface_fan_speed", "filament_notes" /*,"filament_seam_gap"*/,
"filament_loading_speed", "filament_loading_speed_start",
"filament_unloading_speed", "filament_unloading_speed_start", "filament_toolchange_delay", "filament_cooling_moves", "filament_stamping_loading_speed", "filament_stamping_distance",
"filament_cooling_initial_speed", "filament_cooling_final_speed", "filament_ramming_parameters",
+63 -4
View File
@@ -234,6 +234,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
opt_key == "initial_layer_print_height"
|| opt_key == "nozzle_diameter"
|| opt_key == "filament_shrink"
|| opt_key == "filament_shrinkage_compensation_z"
|| opt_key == "resolution"
|| opt_key == "precise_z_height"
// Spiral Vase forces different kind of slicing than the normal model:
@@ -1120,13 +1121,29 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
const PrintObject &print_object = *m_objects[print_object_idx];
//FIXME It is quite expensive to generate object layers just to get the print height!
if (auto layers = generate_object_layers(print_object.slicing_parameters(), layer_height_profile(print_object_idx), print_object.config().precise_z_height.value);
! layers.empty() && layers.back() > this->config().printable_height + EPSILON) {
return
!layers.empty()) {
Vec3d test =this->shrinkage_compensation();
const double shrinkage_compensation_z = this->shrinkage_compensation().z();
if (shrinkage_compensation_z != 1. && layers.back() > (this->config().printable_height / shrinkage_compensation_z + EPSILON)) {
// The object exceeds the maximum build volume height because of shrinkage compensation.
return StringObjectException{
Slic3r::format(_u8L("While the object %1% itself fits the build volume, it exceeds the maximum build volume height because of material shrinkage compensation."), print_object.model_object()->name),
print_object.model_object(),
""
};
} else if (layers.back() > this->config().printable_height + EPSILON) {
// Test whether the last slicing plane is below or above the print volume.
{ 0.5 * (layers[layers.size() - 2] + layers.back()) > this->config().printable_height + EPSILON ?
return StringObjectException{
0.5 * (layers[layers.size() - 2] + layers.back()) > this->config().printable_height + EPSILON ?
Slic3r::format(_u8L("The object %1% exceeds the maximum build volume height."), print_object.model_object()->name) :
Slic3r::format(_u8L("While the object %1% itself fits the build volume, its last layer exceeds the maximum build volume height."), print_object.model_object()->name) +
" " + _u8L("You might want to reduce the size of your model or change current print settings and retry.") };
" " + _u8L("You might want to reduce the size of your model or change current print settings and retry."),
print_object.model_object(),
""
};
}
}
}
@@ -1568,6 +1585,10 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
BOOST_LOG_TRIVIAL(warning) << "Orca: validate motion ability failed: " << e.what() << std::endl;
}
}
if (!this->has_same_shrinkage_compensations()){
warning->string = L("Filament shrinkage will not be used because filament shrinkage for the used filaments differs significantly.");
warning->opt_key = "";
}
return {};
}
@@ -2949,6 +2970,44 @@ std::string PrintStatistics::finalize_output_path(const std::string &path_in) co
return final_path;
}
// Orca: Implement prusa's filament shrink compensation approach
// Returns if all used filaments have same shrinkage compensations.
bool Print::has_same_shrinkage_compensations() const {
const std::vector<unsigned int> extruders = this->extruders();
if (extruders.empty())
return false;
const double filament_shrinkage_compensation_xy = m_config.filament_shrink.get_at(extruders.front());
const double filament_shrinkage_compensation_z = m_config.filament_shrinkage_compensation_z.get_at(extruders.front());
for (unsigned int extruder : extruders) {
if (filament_shrinkage_compensation_xy != m_config.filament_shrink.get_at(extruder) ||
filament_shrinkage_compensation_z != m_config.filament_shrinkage_compensation_z.get_at(extruder)) {
return false;
}
}
return true;
}
// Orca: Implement prusa's filament shrink compensation approach, but amended so 100% from the user is the equivalent to 0 in orca.
// Returns scaling for each axis representing shrinkage compensations in each axis.
Vec3d Print::shrinkage_compensation() const
{
if (!this->has_same_shrinkage_compensations())
return Vec3d::Ones();
const unsigned int first_extruder = this->extruders().front();
const double xy_shrinkage_percent = m_config.filament_shrink.get_at(first_extruder);
const double z_shrinkage_percent = m_config.filament_shrinkage_compensation_z.get_at(first_extruder);
const double xy_compensation = 100.0 / xy_shrinkage_percent;
const double z_compensation = 100.0 / z_shrinkage_percent;
return { xy_compensation, xy_compensation, z_compensation };
}
const std::string PrintStatistics::FilamentUsedG = "filament used [g]";
const std::string PrintStatistics::FilamentUsedGMask = "; filament used [g] =";
+8 -1
View File
@@ -401,7 +401,8 @@ public:
// The slicing parameters are dependent on various configuration values
// (layer height, first layer height, raft settings, print nozzle diameter etc).
const SlicingParameters& slicing_parameters() const { return m_slicing_params; }
static SlicingParameters slicing_parameters(const DynamicPrintConfig &full_config, const ModelObject &model_object, float object_max_z);
// Orca: XYZ shrinkage compensation has introduced the const Vec3d &object_shrinkage_compensation parameter to the function below
static SlicingParameters slicing_parameters(const DynamicPrintConfig &full_config, const ModelObject &model_object, float object_max_z, const Vec3d &object_shrinkage_compensation);
size_t num_printing_regions() const throw() { return m_shared_regions->all_regions.size(); }
const PrintRegion& printing_region(size_t idx) const throw() { return *m_shared_regions->all_regions[idx].get(); }
@@ -981,6 +982,12 @@ public:
bool is_all_objects_are_short() const {
return std::all_of(this->objects().begin(), this->objects().end(), [&](PrintObject* obj) { return obj->height() < scale_(this->config().nozzle_height.value); });
}
// Orca: Implement prusa's filament shrink compensation approach
// Returns if all used filaments have same shrinkage compensations.
bool has_same_shrinkage_compensations() const;
// Returns scaling for each axis representing shrinkage compensations in each axis.
Vec3d shrinkage_compensation() const;
protected:
// Invalidates the step, and its depending steps in Print.
+8 -3
View File
@@ -131,7 +131,8 @@ struct PrintObjectTrafoAndInstances
};
// Generate a list of trafos and XY offsets for instances of a ModelObject
static std::vector<PrintObjectTrafoAndInstances> print_objects_from_model_object(const ModelObject &model_object)
// Orca: Updated to include XYZ filament shrinkage compensation
static std::vector<PrintObjectTrafoAndInstances> print_objects_from_model_object(const ModelObject &model_object, const Vec3d &shrinkage_compensation)
{
std::set<PrintObjectTrafoAndInstances> trafos;
PrintObjectTrafoAndInstances trafo;
@@ -139,7 +140,10 @@ static std::vector<PrintObjectTrafoAndInstances> print_objects_from_model_object
int index = 0;
for (ModelInstance *model_instance : model_object.instances) {
if (model_instance->is_printable()) {
trafo.trafo = model_instance->get_matrix();
// Orca: Updated with XYZ filament shrinkage compensation
Geometry::Transformation model_instance_transformation = model_instance->get_transformation();
trafo.trafo = model_instance_transformation.get_matrix_with_applied_shrinkage_compensation(shrinkage_compensation);
auto shift = Point::new_scale(trafo.trafo.data()[12], trafo.trafo.data()[13]);
// Reset the XY axes of the transformation.
trafo.trafo.data()[12] = 0;
@@ -1358,7 +1362,8 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
// Walk over all new model objects and check, whether there are matching PrintObjects.
for (ModelObject *model_object : m_model.objects) {
ModelObjectStatus &model_object_status = const_cast<ModelObjectStatus&>(model_object_status_db.reuse(*model_object));
model_object_status.print_instances = print_objects_from_model_object(*model_object);
// Orca: Updated for XYZ filament shrink compensation
model_object_status.print_instances = print_objects_from_model_object(*model_object, this->shrinkage_compensation());
std::vector<const PrintObjectStatus*> old;
old.reserve(print_object_status_db.count(*model_object));
for (const PrintObjectStatus &print_object_status : print_object_status_db.get_range(*model_object))
+36 -8
View File
@@ -1052,7 +1052,16 @@ void PrintConfigDef::init_fff_params()
def = this->add("slowdown_for_curled_perimeters", coBool);
def->label = L("Slow down for curled perimeters");
def->category = L("Speed");
def->tooltip = L("Enable this option to slow printing down in areas where potential curled perimeters may exist");
def->tooltip = L("Enable this option to slow down printing in areas where perimeters may have curled upwards."
"For example, additional slowdown will be applied when printing overhangs on sharp corners like the "
"front of the Benchy hull, reducing curling which compounds over multiple layers.\n\n "
"It is generally recommended to have this option switched on unless your printer cooling is powerful enough or the "
"print speed slow enough that perimeter curling does not happen. If printing with a high external perimeter speed, "
"this parameter may introduce slight artifacts when slowing down due to the large variance in print speeds. "
"If you notice artifacts, ensure your pressure advance is tuned correctly.\n\n"
"Note: When this option is enabled, overhang perimeters are treated like overhangs, meaning the overhang speed is "
"applied even if the overhanging perimeter is part of a bridge. For example, when the perimeters are 100% overhanging"
", with no wall supporting them from underneath, the 100% overhang speed will be applied.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool{ false });
@@ -1105,7 +1114,10 @@ void PrintConfigDef::init_fff_params()
def = this->add("bridge_speed", coFloat);
def->label = L("External");
def->category = L("Speed");
def->tooltip = L("Speed of bridge and completely overhang wall");
def->tooltip = L("Speed of the externally visible bridge extrusions. "
"\n\nIn addition, if Slow down for curled perimeters is disabled or Classic overhang mode is enabled, "
"it will be the print speed of overhang walls that are supported by less than 13%, whether they are part of a bridge "
"or an overhang.");
def->sidetext = L("mm/s");
def->min = 1;
def->mode = comAdvanced;
@@ -1114,7 +1126,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("internal_bridge_speed", coFloatOrPercent);
def->label = L("Internal");
def->category = L("Speed");
def->tooltip = L("Speed of internal bridge. If the value is expressed as a percentage, it will be calculated based on the bridge_speed. Default value is 150%.");
def->tooltip = L("Speed of internal bridges. If the value is expressed as a percentage, it will be calculated based on the bridge_speed. Default value is 150%.");
def->sidetext = L("mm/s or %");
def->ratio_over = "bridge_speed";
def->min = 1;
@@ -1895,7 +1907,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloats{ 0.4157 });
def = this->add("filament_shrink", coPercents);
def->label = L("Shrinkage");
def->label = L("Shrinkage (XY)");
// xgettext:no-c-format, no-boost-format
def->tooltip = L("Enter the shrinkage percentage that the filament will get after cooling (94% if you measure 94mm instead of 100mm)."
" The part will be scaled in xy to compensate."
@@ -1906,6 +1918,16 @@ void PrintConfigDef::init_fff_params()
def->min = 10;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPercents{ 100 });
def = this->add("filament_shrinkage_compensation_z", coPercents);
def->label = L("Shrinkage (Z)");
def->tooltip = L("Enter the shrinkage percentage that the filament will get after cooling (94% if you measure 94mm instead of 100mm)."
" The part will be scaled in Z to compensate.");
def->sidetext = L("%");
def->ratio_over = "";
def->min = 10;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionPercents{ 100 });
def = this->add("filament_loading_speed", coFloats);
def->label = L("Loading speed");
@@ -4743,15 +4765,21 @@ void PrintConfigDef::init_fff_params()
def = this->add("activate_chamber_temp_control",coBools);
def->label = L("Activate temperature control");
def->tooltip = L("Enable this option for chamber temperature control. An M191 command will be added before \"machine_start_gcode\"\nG-code commands: M141/M191 S(0-255)");
def->tooltip = L("Enable this option for automated chamber temperature control. This option activates the emitting of an M191 command before the \"machine_start_gcode\"\n which sets the "
"chamber temperature and waits until it is reached. In addition, it emits an M141 command at the end of the print to turn off the chamber heater, if present. \n\n"
"This option relies on the firmware supporting the M191 and M141 commands either via macros or natively and is usually used when an active chamber heater is installed.");
def->mode = comSimple;
def->set_default_value(new ConfigOptionBools{false});
def = this->add("chamber_temperature", coInts);
def->label = L("Chamber temperature");
def->tooltip = L("Higher chamber temperature can help suppress or reduce warping and potentially lead to higher interlayer bonding strength for high temperature materials like ABS, ASA, PC, PA and so on."
"At the same time, the air filtration of ABS and ASA will get worse.While for PLA, PETG, TPU, PVA and other low temperature materials,"
"the actual chamber temperature should not be high to avoid cloggings, so 0 which stands for turning off is highly recommended"
def->tooltip = L("For high-temperature materials like ABS, ASA, PC, and PA, a higher chamber temperature can help suppress or reduce warping and potentially lead to higher interlayer bonding strength. "
"However, at the same time, a higher chamber temperature will reduce the efficiency of air filtration for ABS and ASA. \n\n"
"For PLA, PETG, TPU, PVA, and other low-temperature materials, this option should be disabled (set to 0) as the chamber temperature should be low to avoid extruder clogging caused "
"by material softening at the heat break.\n\n"
"If enabled, this parameter also sets a gcode variable named chamber_temperature, which can be used to pass the desired chamber temperature to your print start macro, "
"or a heat soak macro like this: PRINT_START (other variables) CHAMBER_TEMP=[chamber_temperature]. This may be useful if your printer does not support M141/M191 commands, or if you desire "
"to handle heat soaking in the print start macro if no active chamber heater is installed."
);
def->sidetext = L("°C");
def->full_label = L("Chamber temperature");
+1
View File
@@ -1274,6 +1274,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionBool, independent_support_layer_height))
// SoftFever
((ConfigOptionPercents, filament_shrink))
((ConfigOptionPercents, filament_shrinkage_compensation_z))
((ConfigOptionBool, gcode_label_objects))
((ConfigOptionBool, exclude_object))
((ConfigOptionBool, gcode_comments))
+9 -6
View File
@@ -2966,12 +2966,15 @@ void PrintObject::generate_support_preview()
void PrintObject::update_slicing_parameters()
{
if (!m_slicing_params.valid)
m_slicing_params = SlicingParameters::create_from_config(
this->print()->config(), m_config, this->model_object()->max_z(), this->object_extruders());
// Orca: updated function call for XYZ shrinkage compensation
if (!m_slicing_params.valid) {
m_slicing_params = SlicingParameters::create_from_config(this->print()->config(), m_config, this->model_object()->max_z(),
this->object_extruders(), this->print()->shrinkage_compensation());
}
}
SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig& full_config, const ModelObject& model_object, float object_max_z)
// Orca: XYZ shrinkage compensation has introduced the const Vec3d &object_shrinkage_compensation parameter to the function below
SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig &full_config, const ModelObject &model_object, float object_max_z, const Vec3d &object_shrinkage_compensation)
{
PrintConfig print_config;
PrintObjectConfig object_config;
@@ -3006,7 +3009,7 @@ SlicingParameters PrintObject::slicing_parameters(const DynamicPrintConfig& full
if (object_max_z <= 0.f)
object_max_z = (float)model_object.raw_bounding_box().size().z();
return SlicingParameters::create_from_config(print_config, object_config, object_max_z, object_extruders);
return SlicingParameters::create_from_config(print_config, object_config, object_max_z, object_extruders, object_shrinkage_compensation);
}
// returns 0-based indices of extruders used to print the object (without brim, support and other helper extrusions)
@@ -3049,7 +3052,7 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c
// Must not be of even length.
((layer_height_profile.size() & 1) != 0 ||
// Last entry must be at the top of the object.
std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_parameters.object_print_z_max + slicing_parameters.object_print_z_min) > 1e-3))
std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_parameters.object_print_z_uncompensated_max + slicing_parameters.object_print_z_min) > 1e-3))
layer_height_profile.clear();
if (layer_height_profile.empty() || layer_height_profile[1] != slicing_parameters.first_object_layer_height) {
-16
View File
@@ -449,22 +449,6 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
});
}
// SoftFever: ported from SuperSlicer
// filament shrink
for (const std::unique_ptr<PrintRegion>& pr : print_object_regions.all_regions) {
if (pr.get()) {
std::vector<ExPolygons>& region_polys = slices_by_region[pr->print_object_region_id()];
const size_t extruder_id = pr->extruder(FlowRole::frPerimeter) - 1;
double scale = print_config.filament_shrink.values[extruder_id] * 0.01;
if (scale != 1) {
scale = 1 / scale;
for (ExPolygons& polys : region_polys)
for (ExPolygon& poly : polys)
poly.scale(scale);
}
}
}
return slices_by_region;
}
+25 -15
View File
@@ -60,10 +60,11 @@ coordf_t Slicing::max_layer_height_from_nozzle(const DynamicPrintConfig &print_c
}
SlicingParameters SlicingParameters::create_from_config(
const PrintConfig &print_config,
const PrintObjectConfig &object_config,
coordf_t object_height,
const std::vector<unsigned int> &object_extruders)
const PrintConfig &print_config,
const PrintObjectConfig &object_config,
coordf_t object_height,
const std::vector<unsigned int> &object_extruders,
const Vec3d &object_shrinkage_compensation)
{
coordf_t initial_layer_print_height = (print_config.initial_layer_print_height.value <= 0) ?
object_config.layer_height.value : print_config.initial_layer_print_height.value;
@@ -81,7 +82,10 @@ SlicingParameters SlicingParameters::create_from_config(
params.first_print_layer_height = initial_layer_print_height;
params.first_object_layer_height = initial_layer_print_height;
params.object_print_z_min = 0.;
params.object_print_z_max = object_height;
// Orca: XYZ filament compensation
params.object_print_z_max = object_height * object_shrinkage_compensation.z();
params.object_print_z_uncompensated_max = object_height;
params.object_shrinkage_compensation_z = object_shrinkage_compensation.z();
params.base_raft_layers = object_config.raft_layers.value;
params.soluble_interface = soluble_interface;
@@ -153,6 +157,7 @@ SlicingParameters SlicingParameters::create_from_config(
coordf_t print_z = params.raft_contact_top_z + params.gap_raft_object;
params.object_print_z_min = print_z;
params.object_print_z_max += print_z;
params.object_print_z_uncompensated_max += print_z;
}
params.valid = true;
@@ -225,10 +230,10 @@ std::vector<coordf_t> layer_height_profile_from_ranges(
lh_append(hi, height);
}
if (coordf_t z = last_z(); z < slicing_params.object_print_z_height()) {
if (coordf_t z = last_z(); z < slicing_params.object_print_z_uncompensated_height()) {
// Insert a step of normal layer height up to the object top.
lh_append(z, slicing_params.layer_height);
lh_append(slicing_params.object_print_z_height(), slicing_params.layer_height);
lh_append(slicing_params.object_print_z_uncompensated_height(), slicing_params.layer_height);
}
return layer_height_profile;
@@ -450,12 +455,12 @@ void adjust_layer_height_profile(
std::pair<coordf_t, coordf_t> z_span_variable =
std::pair<coordf_t, coordf_t>(
slicing_params.first_object_layer_height_fixed() ? slicing_params.first_object_layer_height : 0.,
slicing_params.object_print_z_height());
slicing_params.object_print_z_uncompensated_height());
if (z < z_span_variable.first || z > z_span_variable.second)
return;
assert(layer_height_profile.size() >= 2);
assert(std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_params.object_print_z_height()) < EPSILON);
assert(std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_params.object_print_z_uncompensated_height()) < EPSILON);
// 1) Get the current layer thickness at z.
coordf_t current_layer_height = slicing_params.layer_height;
@@ -616,7 +621,7 @@ void adjust_layer_height_profile(
assert(layer_height_profile.size() > 2);
assert(layer_height_profile.size() % 2 == 0);
assert(layer_height_profile[0] == 0.);
assert(std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_params.object_print_z_height()) < EPSILON);
assert(std::abs(layer_height_profile[layer_height_profile.size() - 2] - slicing_params.object_print_z_uncompensated_height()) < EPSILON);
#ifdef _DEBUG
for (size_t i = 2; i < layer_height_profile.size(); i += 2)
assert(layer_height_profile[i - 2] <= layer_height_profile[i]);
@@ -739,6 +744,8 @@ std::vector<coordf_t> generate_object_layers(
out.push_back(print_z);
}
// Orca: XYZ shrinkage compensation
const coordf_t shrinkage_compensation_z = slicing_params.object_shrinkage_compensation_z;
size_t idx_layer_height_profile = 0;
// loop until we have at least one layer and the max slice_z reaches the object height
coordf_t slice_z = print_z + 0.5 * slicing_params.min_layer_height;
@@ -747,17 +754,20 @@ std::vector<coordf_t> generate_object_layers(
if (idx_layer_height_profile < layer_height_profile.size()) {
size_t next = idx_layer_height_profile + 2;
for (;;) {
if (next >= layer_height_profile.size() || slice_z < layer_height_profile[next])
// Orca: XYZ shrinkage compensation
if (next >= layer_height_profile.size() || slice_z < layer_height_profile[next] * shrinkage_compensation_z)
break;
idx_layer_height_profile = next;
next += 2;
}
coordf_t z1 = layer_height_profile[idx_layer_height_profile];
coordf_t h1 = layer_height_profile[idx_layer_height_profile + 1];
// Orca: XYZ shrinkage compensation
const coordf_t z1 = layer_height_profile[idx_layer_height_profile] * shrinkage_compensation_z;
const coordf_t h1 = layer_height_profile[idx_layer_height_profile + 1];
height = h1;
if (next < layer_height_profile.size()) {
coordf_t z2 = layer_height_profile[next];
coordf_t h2 = layer_height_profile[next + 1];
// Orca: XYZ shrinkage compensation
const coordf_t z2 = layer_height_profile[next] * shrinkage_compensation_z;
const coordf_t h2 = layer_height_profile[next + 1];
height = lerp(h1, h2, (slice_z - z1) / (z2 - z1));
assert(height >= slicing_params.min_layer_height - EPSILON && height <= slicing_params.max_layer_height + EPSILON);
}
+17 -4
View File
@@ -28,11 +28,13 @@ struct SlicingParameters
{
SlicingParameters() = default;
// Orca: XYZ filament compensation introduced object_shrinkage_compensation
static SlicingParameters create_from_config(
const PrintConfig &print_config,
const PrintObjectConfig &object_config,
coordf_t object_height,
const std::vector<unsigned int> &object_extruders);
const PrintConfig &print_config,
const PrintObjectConfig &object_config,
coordf_t object_height,
const std::vector<unsigned int> &object_extruders,
const Vec3d &object_shrinkage_compensation);
// Has any raft layers?
bool has_raft() const { return raft_layers() > 0; }
@@ -43,6 +45,10 @@ struct SlicingParameters
// Height of the object to be printed. This value does not contain the raft height.
coordf_t object_print_z_height() const { return object_print_z_max - object_print_z_min; }
// Height of the object to be printed. This value does not contain the raft height.
// This value isn't scaled by shrinkage compensation in the Z-axis.
coordf_t object_print_z_uncompensated_height() const { return object_print_z_uncompensated_max - object_print_z_min; }
bool valid { false };
@@ -95,7 +101,14 @@ struct SlicingParameters
coordf_t raft_contact_top_z { 0 };
// In case of a soluble interface, object_print_z_min == raft_contact_top_z, otherwise there is a gap between the raft and the 1st object layer.
coordf_t object_print_z_min { 0 };
// This value of maximum print Z is scaled by shrinkage compensation in the Z-axis.
coordf_t object_print_z_max { 0 };
// Orca: XYZ shrinkage compensation
// This value of maximum print Z isn't scaled by shrinkage compensation.
coordf_t object_print_z_uncompensated_max { 0 };
// Scaling factor for compensating shrinkage in Z-axis.
coordf_t object_shrinkage_compensation_z { 0 };
};
static_assert(IsTriviallyCopyable<SlicingParameters>::value, "SlicingParameters class is not POD (and it should be - see constructor).");
+2 -2
View File
@@ -4122,13 +4122,13 @@ wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent)
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(10));
m_scrolled_preset_window = new wxScrolledWindow(parent);
m_scrolled_preset_window->SetScrollRate(5, 5);
m_scrolled_preset_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(660), FromDIP(400)));
m_scrolled_preset_window->SetSize(wxSize(FromDIP(660), FromDIP(400)));
wxBoxSizer *scrolled_window = new wxBoxSizer(wxHORIZONTAL);
m_presets_window = new wxPanel(m_scrolled_preset_window, wxID_ANY);
m_presets_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
m_presets_window->SetBackgroundColour(*wxWHITE);
wxBoxSizer *select_printer_sizer = new wxBoxSizer(wxVERTICAL);
m_preset_sizer = new wxGridSizer(3, FromDIP(5), FromDIP(5));
+1 -1
View File
@@ -5662,7 +5662,7 @@ void DeviceManager::parse_user_print_info(std::string body)
}
}
}
catch (std::exception& e) {
catch (std::exception&) {
;
}
}
+7 -2
View File
@@ -666,8 +666,9 @@ void GLCanvas3D::LayersEditing::update_slicing_parameters()
{
if (m_slicing_parameters == nullptr) {
m_slicing_parameters = new SlicingParameters();
*m_slicing_parameters = PrintObject::slicing_parameters(*m_config, *m_model_object, m_object_max_z);
*m_slicing_parameters = PrintObject::slicing_parameters(*m_config, *m_model_object, m_object_max_z, m_shrinkage_compensation);
}
}
float GLCanvas3D::LayersEditing::thickness_bar_width(const GLCanvas3D & canvas)
@@ -1489,6 +1490,11 @@ void GLCanvas3D::set_config(const DynamicPrintConfig* config)
{
m_config = config;
m_layers_editing.set_config(config);
// Orca: Filament shrinkage compensation
const Print *print = fff_print();
if (print != nullptr)
m_layers_editing.set_shrinkage_compensation(fff_print()->shrinkage_compensation());
}
void GLCanvas3D::set_process(BackgroundSlicingProcess *process)
@@ -8440,7 +8446,6 @@ void GLCanvas3D::_render_assemble_info() const
auto canvas_h = float(get_canvas_size().get_height());
float space_size = imgui->get_style_scaling() * 8.0f;
float caption_max = imgui->calc_text_size(_L("Total Volume:")).x + 3 * space_size;
char buf[3][64];
ImGuiIO& io = ImGui::GetIO();
ImFont* font = io.Fonts->Fonts[0];
+6
View File
@@ -216,6 +216,9 @@ class GLCanvas3D
};
static const float THICKNESS_BAR_WIDTH;
// Orca: Shrinkage compensation
void set_shrinkage_compensation(const Vec3d &shrinkage_compensation) { m_shrinkage_compensation = shrinkage_compensation; };
private:
bool m_enabled{ false };
@@ -229,6 +232,9 @@ class GLCanvas3D
// Owned by LayersEditing.
SlicingParameters* m_slicing_parameters{ nullptr };
std::vector<double> m_layer_height_profile;
// Orca: Shrinkage compensation to apply when we need to use object_max_z with Z compensation.
Vec3d m_shrinkage_compensation{ Vec3d::Ones() };
mutable float m_adaptive_quality{ 0.5f };
mutable HeightProfileSmoothingParams m_smooth_params;
-1
View File
@@ -470,7 +470,6 @@ void GLTexture::reset()
bool GLTexture::generate_from_text_string(const std::string& text_str, wxFont &font, wxColor background, wxColor foreground)
{
int w,h,hl;
return generate_from_text(text_str, font, background, foreground);
}
+5 -7
View File
@@ -1026,7 +1026,7 @@ void GUI_App::post_init()
try {
std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
files_vec.push_back({ lw_t, temp_path.filename().string() });
} catch (const std::exception &ex) {
} catch (const std::exception &) {
}
}
std::sort(files_vec.begin(), files_vec.end(), [](
@@ -3365,7 +3365,7 @@ if (res) {
mainframe->refresh_plugin_tips();
// BBS: remove SLA related message
}
} catch (std::exception &e) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
}
@@ -3379,7 +3379,7 @@ void GUI_App::ShowDownNetPluginDlg() {
return;
DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in"));
dlg.ShowModal();
} catch (std::exception &e) {
} catch (std::exception &) {
;
}
}
@@ -3396,7 +3396,7 @@ void GUI_App::ShowUserLogin(bool show)
login_dlg = new ZUserLogin();
}
login_dlg->ShowModal();
} catch (std::exception &e) {
} catch (std::exception &) {
;
}
} else {
@@ -3418,7 +3418,7 @@ void GUI_App::ShowOnlyFilament() {
// BBS: remove SLA related message
}
} catch (std::exception &e) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "", MB_OK);
}
}
@@ -6507,8 +6507,6 @@ static bool del_win_registry(HKEY hkeyHive, const wchar_t *pszVar, const wchar_t
return false;
if (!bDidntExist) {
DWORD dwDisposition;
HKEY hkey;
iRC = ::RegDeleteKeyExW(hkeyHive, pszVar, KEY_ALL_ACCESS, 0);
if (iRC == ERROR_SUCCESS) {
return true;
-1
View File
@@ -1977,7 +1977,6 @@ void MenuFactory::append_menu_item_set_printable(wxMenu* menu)
for (wxDataViewItem item : sels) {
ItemType type = list->GetModel()->GetItemType(item);
bool check;
if (type != itInstance && type != itObject)
continue;
else {
+1 -1
View File
@@ -2006,7 +2006,7 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo
try {
model = Model::read_from_file(input_file, nullptr, nullptr, LoadStrategy::LoadModel);
}
catch (std::exception& e) {
catch (std::exception&) {
// auto msg = _L("Error!") + " " + input_file + " : " + e.what() + ".";
auto msg = _L("Error!") + " " + _L("Failed to get the model data in the current file.");
show_error(parent, msg);
+1 -2
View File
@@ -150,7 +150,6 @@ void PrintJob::process(Ctl &ctl)
ctl.call_on_main_thread([this] { prepare(); }).wait();
int result = -1;
unsigned int http_code;
std::string http_body;
int total_plate_num = plate_data.plate_count;
@@ -312,7 +311,7 @@ void PrintJob::process(Ctl &ctl)
try {
stl_design_id = std::stoi(wxGetApp().model().stl_design_id);
}
catch (const std::exception& e) {
catch (const std::exception&) {
stl_design_id = 0;
}
params.stl_design_id = stl_design_id;
-1
View File
@@ -111,7 +111,6 @@ void SendJob::process(Ctl &ctl)
NetworkAgent* m_agent = wxGetApp().getAgent();
AppConfig* config = wxGetApp().app_config;
int result = -1;
unsigned int http_code;
std::string http_body;
if (this->connection_type == "lan") {
+18 -4
View File
@@ -2822,10 +2822,17 @@ void MainFrame::init_menubar_as_editor()
auto flowrate_menu = new wxMenu();
append_menu_item(
flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
m_topbar->GetCalibMenu()->AppendSubMenu(flowrate_menu, _L("Flow rate"));
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
@@ -2909,13 +2916,20 @@ void MainFrame::init_menubar_as_editor()
// Flowrate
auto flowrate_menu = new wxMenu();
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_submenu(calib_menu,flowrate_menu,wxID_ANY,_L("Flow rate"),_L("Flow rate"),"",
[this]() {return m_plater->is_view3D_shown();; });
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO (perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
// PA
append_menu_item(calib_menu, wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
+1 -1
View File
@@ -133,7 +133,7 @@ namespace GUI {
}
}
catch (std::exception& e) {
catch (std::exception&) {
// wxMessageBox(e.what(), "json Exception", MB_OK);
}
}
+8 -5
View File
@@ -492,13 +492,16 @@ bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
wxCoord h_pos2 = get_title_width() * m_em_unit;
wxCoord v_pos = 0;
size_t invisible_lines = 0;
bool has_visible_lines = false;
for (CtrlLine& line : ctrl_lines) {
line.update_visibility(mode);
if (line.is_visible)
if (line.is_visible) {
v_pos += (wxCoord)line.height;
else
invisible_lines++;
if (!line.is_separator()) { // Ignore separators
has_visible_lines = true;
}
}
}
// BBS: multi-line title
SetFont(Label::Head_16);
@@ -513,7 +516,7 @@ bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
this->SetMinSize(wxSize(h_pos, v_pos));
return invisible_lines != ctrl_lines.size();
return has_visible_lines;
}
// BBS: call by Tab/Page
+5 -5
View File
@@ -470,7 +470,7 @@ void PartPlate::calc_gridlines(const ExPolygon& poly, const BoundingBox& pp_bbox
int count = 0;
int step = 10;
// Orca: use 500 x 500 bed size as baseline.
auto grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
const Point grid_counts = pp_bbox.size() / ((coord_t) scale_(step * 50));
// if the grid is too dense, we increase the step
if (grid_counts.minCoeff() > 1) {
step = static_cast<int>(grid_counts.minCoeff() + 1) * 10;
@@ -2522,7 +2522,7 @@ void PartPlate::generate_print_polygon(ExPolygon &print_polygon)
{
auto compute_points = [&print_polygon](Vec2d& center, double radius, double start_angle, double stop_angle, int count)
{
double angle, angle_steps;
double angle_steps;
angle_steps = (stop_angle - start_angle) / (count - 1);
for(int j = 0; j < count; j++ )
{
@@ -2541,7 +2541,7 @@ void PartPlate::generate_print_polygon(ExPolygon &print_polygon)
{
const Vec2d& p = m_shape[i];
Vec2d center;
double start_angle, stop_angle, angle_steps, radius_x, radius_y, radius;
double start_angle, stop_angle, radius_x, radius_y, radius;
switch (i) {
case 0:
radius = 5.f;
@@ -2592,7 +2592,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)
{
auto compute_exclude_points = [&exclude_polygon](Vec2d& center, double radius, double start_angle, double stop_angle, int count)
{
double angle, angle_steps;
double angle_steps;
angle_steps = (stop_angle - start_angle) / (count - 1);
for(int j = 0; j < count; j++ )
{
@@ -2611,7 +2611,7 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)
{
const Vec2d& p = m_exclude_area[i];
Vec2d center;
double start_angle, stop_angle, angle_steps, radius_x, radius_y, radius;
double start_angle, stop_angle, radius;
switch (i) {
case 0:
radius = 5.f;
+70 -30
View File
@@ -9083,7 +9083,7 @@ void Plater::import_model_id(wxString download_info)
}
}
catch (const std::exception& error)
catch (const std::exception&)
{
//wxString sError = error.what();
}
@@ -9125,7 +9125,6 @@ void Plater::import_model_id(wxString download_info)
// if (!m_agent) return;
int res = 0;
unsigned int http_code;
std::string http_body;
msg = _L("prepare 3mf file...");
@@ -9164,7 +9163,7 @@ void Plater::import_model_id(wxString download_info)
if (sFile == filename) is_already_exist = true;
}
}
catch (const std::exception& error)
catch (const std::exception&)
{
//wxString sError = error.what();
}
@@ -9646,21 +9645,11 @@ void Plater::_calib_pa_select_added_objects() {
}
}
void Plater::calib_flowrate(int pass) {
if (pass != 1 && pass != 2)
return;
const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if(pass == 1)
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
// Adjust settings for flowrate calibration
// For linear mode, pass 1 means normal version while pass 2 mean "for perfectionists" version
void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, int pass)
{
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
@@ -9670,37 +9659,47 @@ void Plater::calib_flowrate(int pass) {
assert(nozzle_diameter_config->values.size() > 0);
float nozzle_diameter = nozzle_diameter_config->values[0];
float xyScale = nozzle_diameter / 0.6;
//scale z to have 7 layers
//scale z to have 10 layers
// 2 bottom, 5 top, 3 sparse infill
double first_layer_height = print_config->option<ConfigOptionFloat>("initial_layer_print_height")->value;
double layer_height = nozzle_diameter / 2.0; // prefer 0.2 layer height for 0.4 nozzle
first_layer_height = std::max(first_layer_height, layer_height);
float zscale = (first_layer_height + 6 * layer_height) / 1.4;
float zscale = (first_layer_height + 9 * layer_height) / 2;
// only enlarge
if (xyScale > 1.2) {
for (auto _obj : model().objects)
for (auto _obj : objects)
_obj->scale(xyScale, xyScale, zscale);
}
else {
for (auto _obj : model().objects)
for (auto _obj : objects)
_obj->scale(1, 1, zscale);
}
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
double max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
double max_infill_speed;
if (linear)
max_infill_speed = filament_max_volumetric_speed /
(infill_flow.mm3_per_mm() * (cur_flowrate + (pass == 2 ? 0.035 : 0.05)) / cur_flowrate);
else
max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
double internal_solid_speed = std::floor(std::min(print_config->opt_float("internal_solid_infill_speed"), max_infill_speed));
double top_surface_speed = std::floor(std::min(print_config->opt_float("top_surface_speed"), max_infill_speed));
// adjust parameters
for (auto _obj : model().objects) {
for (auto _obj : objects) {
_obj->ensure_on_bed();
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(3));
_obj->config.set_key_value("wall_loops", new ConfigOptionInt(1));
_obj->config.set_key_value("only_one_wall_top", new ConfigOptionBool(true));
_obj->config.set_key_value("thick_internal_bridges", new ConfigOptionBool(false));
_obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(35));
_obj->config.set_key_value("min_width_top_surface", new ConfigOptionFloatOrPercent(100,true));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(1));
_obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(2));
_obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(5));
_obj->config.set_key_value("top_shell_thickness", new ConfigOptionFloat(0));
_obj->config.set_key_value("bottom_shell_thickness", new ConfigOptionFloat(0));
_obj->config.set_key_value("detect_thin_wall", new ConfigOptionBool(true));
_obj->config.set_key_value("filter_out_gap_fill", new ConfigOptionFloat(0));
_obj->config.set_key_value("sparse_infill_pattern", new ConfigOptionEnum<InfillPattern>(ipRectilinear));
@@ -9724,14 +9723,18 @@ void Plater::calib_flowrate(int pass) {
if (obj_name[0] == 'm')
obj_name[0] = '-';
auto modifier = stof(obj_name);
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/100.f));
if(linear)
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat((cur_flowrate + modifier)/cur_flowrate));
else
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/100.f));
}
print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height));
print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(first_layer_height));
print_config->set_key_value("reduce_crossing_wall", new ConfigOptionBool(true));
//filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{ 9. });
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->update_dirty();
@@ -9741,6 +9744,43 @@ void Plater::calib_flowrate(int pass) {
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_flowrate(bool is_linear, int pass) {
if (pass != 1 && pass != 2)
return;
wxString calib_name;
if (is_linear) {
calib_name = L"Orca YOLO Flow Calibration";
if (pass == 2)
calib_name += L" - Perfectionist version";
} else
calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if (is_linear) {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow_fine.3mf").string());
} else {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
}
adjust_settings_for_flowrate_calib(model().objects, is_linear, pass);
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_temp(const Calib_Params& params) {
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");
new_project(false, false, calib_temp_name);
@@ -12563,7 +12603,7 @@ int Plater::send_gcode(int plate_idx, Export3mfProgressFn proFn)
p->m_print_job_data._3mf_path = fs::path(plate->get_tmp_gcode_path());
p->m_print_job_data._3mf_path.replace_extension("3mf");
}
catch (std::exception& e) {
catch (std::exception&) {
BOOST_LOG_TRIVIAL(error) << "generate 3mf path failed";
return -1;
}
@@ -12596,7 +12636,7 @@ int Plater::export_config_3mf(int plate_idx, Export3mfProgressFn proFn)
try {
p->m_print_job_data._3mf_config_path = fs::path(plate->get_temp_config_3mf_path());
}
catch (std::exception& e) {
catch (std::exception&) {
BOOST_LOG_TRIVIAL(error) << "generate 3mf path failed";
return -1;
}
+1 -1
View File
@@ -259,7 +259,7 @@ public:
// SoftFever
void calib_pa(const Calib_Params& params);
void calib_flowrate(int pass);
void calib_flowrate(bool is_linear, int pass);
void calib_temp(const Calib_Params& params);
void calib_max_vol_speed(const Calib_Params& params);
void calib_retraction(const Calib_Params& params);
+3 -1
View File
@@ -799,8 +799,10 @@ bool PlaterPresetComboBox::switch_to_tab()
//BBS Select NoteBook Tab params
if (tab->GetParent() == wxGetApp().params_panel())
wxGetApp().mainframe->select_tab(MainFrame::tp3DEditor);
else
else {
wxGetApp().params_dialog()->Popup();
tab->OnActivate();
}
tab->restore_last_select_item();
const Preset* selected_filament_preset = nullptr;
+1 -1
View File
@@ -266,7 +266,7 @@ void ProjectPanel::OnScriptMessage(wxWebViewEvent& evt)
}
}
catch (std::exception& e) {
catch (std::exception&) {
// wxMessageBox(e.what(), "json Exception", MB_OK);
}
}
-1
View File
@@ -816,7 +816,6 @@ void SearchDialog::OnCheck(wxCommandEvent &event)
void SearchDialog::OnMotion(wxMouseEvent &event)
{
wxDataViewItem item;
wxDataViewColumn *col;
wxWindow * win = this;
// search_list->HitTest(wxGetMousePosition() - win->GetScreenPosition(), item, col);
+33 -30
View File
@@ -468,14 +468,7 @@ void Tab::create_preset_tab()
// so that the cursor jumps to the last item.
// BBS: bold selection
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGING, [this](wxCommandEvent& event) {
if (m_disable_tree_sel_changed_event)
return;
const auto sel_item = m_tabctrl->GetSelection();
//OutputDebugStringA("wxEVT_TAB_SEL_CHANGING ");
//OutputDebugStringA(m_title.c_str());
//const auto selection = sel_item >= 0 ? m_tabctrl->GetItemText(sel_item) : "";
//OutputDebugString(selection);
//OutputDebugStringA("\n");
m_tabctrl->SetItemBold(sel_item, false);
});
m_tabctrl->Bind(wxEVT_TAB_SEL_CHANGED, [this](wxCommandEvent& event) {
@@ -2010,23 +2003,23 @@ void TabPrint::build()
auto page = add_options_page(L("Quality"), "custom-gcode_quality"); // ORCA: icon only visible on placeholders
auto optgroup = page->new_optgroup(L("Layer height"), L"param_layer_height");
optgroup->append_single_option_line("layer_height");
optgroup->append_single_option_line("initial_layer_print_height");
optgroup->append_single_option_line("layer_height","quality_settings_layer_height");
optgroup->append_single_option_line("initial_layer_print_height","quality_settings_layer_height");
optgroup = page->new_optgroup(L("Line width"), L"param_line_width");
optgroup->append_single_option_line("line_width");
optgroup->append_single_option_line("initial_layer_line_width");
optgroup->append_single_option_line("outer_wall_line_width");
optgroup->append_single_option_line("inner_wall_line_width");
optgroup->append_single_option_line("top_surface_line_width");
optgroup->append_single_option_line("sparse_infill_line_width");
optgroup->append_single_option_line("internal_solid_infill_line_width");
optgroup->append_single_option_line("support_line_width");
optgroup->append_single_option_line("line_width","quality_settings_line_width");
optgroup->append_single_option_line("initial_layer_line_width","quality_settings_line_width");
optgroup->append_single_option_line("outer_wall_line_width","quality_settings_line_width");
optgroup->append_single_option_line("inner_wall_line_width","quality_settings_line_width");
optgroup->append_single_option_line("top_surface_line_width","quality_settings_line_width");
optgroup->append_single_option_line("sparse_infill_line_width","quality_settings_line_width");
optgroup->append_single_option_line("internal_solid_infill_line_width","quality_settings_line_width");
optgroup->append_single_option_line("support_line_width","quality_settings_line_width");
optgroup = page->new_optgroup(L("Seam"), L"param_seam");
optgroup->append_single_option_line("seam_position", "seam");
optgroup->append_single_option_line("staggered_inner_seams", "seam");
optgroup->append_single_option_line("seam_gap","seam");
optgroup->append_single_option_line("seam_position", "quality_settings_seam");
optgroup->append_single_option_line("staggered_inner_seams", "quality_settings_seam");
optgroup->append_single_option_line("seam_gap","quality_settings_seam");
optgroup->append_single_option_line("seam_slope_type", "seam#scarf-joint-seam");
optgroup->append_single_option_line("seam_slope_conditional", "seam#scarf-joint-seam");
optgroup->append_single_option_line("scarf_angle_threshold", "seam#scarf-joint-seam");
@@ -2038,10 +2031,10 @@ void TabPrint::build()
optgroup->append_single_option_line("seam_slope_steps", "seam#scarf-joint-seam");
optgroup->append_single_option_line("scarf_joint_flow_ratio", "seam#scarf-joint-seam");
optgroup->append_single_option_line("seam_slope_inner_walls", "seam#scarf-joint-seam");
optgroup->append_single_option_line("role_based_wipe_speed","seam");
optgroup->append_single_option_line("wipe_speed", "seam");
optgroup->append_single_option_line("wipe_on_loops","seam");
optgroup->append_single_option_line("wipe_before_external_loop","seam");
optgroup->append_single_option_line("role_based_wipe_speed","quality_settings_seam");
optgroup->append_single_option_line("wipe_speed", "quality_settings_seam");
optgroup->append_single_option_line("wipe_on_loops","quality_settings_seam");
optgroup->append_single_option_line("wipe_before_external_loop","quality_settings_seam");
optgroup = page->new_optgroup(L("Precision"), L"param_precision");
@@ -3252,6 +3245,7 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_density");
optgroup->append_single_option_line("filament_shrink");
optgroup->append_single_option_line("filament_shrinkage_compensation_z");
optgroup->append_single_option_line("filament_cost");
//BBS
optgroup->append_single_option_line("temperature_vitrification");
@@ -4746,19 +4740,28 @@ void Tab::rebuild_page_tree()
// To avoid redundant clear/activate functions call
// suppress activate page before page_tree rebuilding
m_disable_tree_sel_changed_event = true;
m_tabctrl->DeleteAllItems();
int curr_item = 0;
for (auto p : m_pages)
{
if (!p->get_show())
continue;
auto itemId = m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
m_tabctrl->SetItemTextColour(itemId, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
if (m_tabctrl->GetCount() <= curr_item) {
m_tabctrl->AppendItem(translate_category(p->title(), m_type), p->iconID());
} else {
m_tabctrl->SetItemText(curr_item, translate_category(p->title(), m_type));
}
m_tabctrl->SetItemTextColour(curr_item, p->get_item_colour() == m_modified_label_clr ? p->get_item_colour() : StateColor(
std::make_pair(0x6B6B6C, (int) StateColor::NotChecked),
std::make_pair(p->get_item_colour(), (int) StateColor::Normal)));
if (translate_category(p->title(), m_type) == selected)
item = itemId;
item = curr_item;
curr_item++;
}
while (m_tabctrl->GetCount() > curr_item) {
m_tabctrl->DeleteItem(m_tabctrl->GetCount() - 1);
}
// BBS: on mac, root is selected, this fix it
m_tabctrl->Unselect();
// BBS: not select on hide tab
@@ -5273,10 +5276,10 @@ bool Tab::update_current_page_in_background(int& item)
// clear pages from the controlls
// BBS: fix after new layout, clear page in backgroud
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
for (auto p : m_pages)
p->clear();
if (m_parent->is_active_and_shown_tab((wxPanel*)this))
m_parent->clear_page();
update_undo_buttons();
+1 -1
View File
@@ -41,7 +41,7 @@ int UserManager::parse_json(std::string payload)
//bind
if (j_pre["bind"]["command"].get<std::string>() == "bind") {
std::string dev_id;
std:; string result;
std::string result;
if (j_pre["bind"].contains("dev_id")) {
dev_id = j_pre["bind"]["dev_id"].get<std::string>();
+1 -1
View File
@@ -227,7 +227,7 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt)
auto plugin_folder = (boost::filesystem::path(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data()) / "plugins").make_preferred().string();
desktop_open_any_folder(plugin_folder);
}
} catch (std::exception &e) {
} catch (std::exception &) {
// wxMessageBox(e.what(), "json Exception", MB_OK);
}
}
+25 -1
View File
@@ -117,7 +117,31 @@ int TabCtrl::AppendItem(const wxString &item,
bool TabCtrl::DeleteItem(int item)
{
return false;
if (item < 0 || item >= btns.size()) {
return false;
}
const bool selection_changed = sel >= item;
if (selection_changed) {
sendTabCtrlEvent(true);
}
Button* btn = btns[item];
btn->Destroy();
btns.erase(btns.begin() + item);
sizer->Remove(item * 2);
if (btns.size() > 1)
sizer->GetItem(sizer->GetItemCount() - 1)->SetMinSize({0, 0});
if (selection_changed) {
sel--; // `relayout()` uses `sel` so we need to update this before calling `relayout()`
}
relayout();
if (selection_changed) {
sendTabCtrlEvent();
}
return true;
}
void TabCtrl::DeleteAllItems()
+1 -1
View File
@@ -373,7 +373,7 @@ bool WebView::RunScript(wxWebView *webView, wxString const &javascript)
}, NULL);
return true;
#endif
} catch (std::exception &e) {
} catch (std::exception &) {
return false;
}
}