This commit is contained in:
bubnikv 2019-09-04 16:11:28 +02:00
commit d2ac827137
32 changed files with 1095 additions and 1163 deletions

View file

@ -1738,13 +1738,9 @@ void GCode::process_layer(
// This extrusion is part of certain Region, which tells us which extruder should be used for it:
int correct_extruder_id = Print::get_extruder(*fill, region);
//FIXME what is this?
entity_type=="infills" ?
std::max<int>(0, (is_solid_infill(fill->entities.front()->role()) ? region.config().solid_infill_extruder : region.config().infill_extruder) - 1) :
std::max<int>(region.config().perimeter_extruder.value - 1, 0);
// Let's recover vector of extruder overrides:
const ExtruderPerCopy* entity_overrides = const_cast<LayerTools&>(layer_tools).wiping_extrusions().get_extruder_overrides(fill, correct_extruder_id, (int)layer_to_print.object()->copies().size());
const ExtruderPerCopy* entity_overrides = const_cast<LayerTools&>(layer_tools).wiping_extrusions().get_extruder_overrides(fill, correct_extruder_id, layer_to_print.object()->copies().size());
// Now we must add this extrusion into the by_extruder map, once for each extruder that will print it:
for (unsigned int extruder : layer_tools.extruders)
@ -3027,7 +3023,7 @@ const std::vector<GCode::ObjectByExtruder::Island::Region>& GCode::ObjectByExtru
// This function takes the eec and appends its entities to either perimeters or infills of this Region (depending on the first parameter)
// It also saves pointer to ExtruderPerCopy struct (for each entity), that holds information about which extruders should be used for which copy.
void GCode::ObjectByExtruder::Island::Region::append(const std::string& type, const ExtrusionEntityCollection* eec, const ExtruderPerCopy* copies_extruder, unsigned int object_copies_num)
void GCode::ObjectByExtruder::Island::Region::append(const std::string& type, const ExtrusionEntityCollection* eec, const ExtruderPerCopy* copies_extruder, size_t object_copies_num)
{
// We are going to manipulate either perimeters or infills, exactly in the same way. Let's create pointers to the proper structure to not repeat ourselves:
ExtrusionEntityCollection* perimeters_or_infills = &infills;

View file

@ -246,7 +246,7 @@ protected:
std::vector<const ExtruderPerCopy*> perimeters_overrides;
// Appends perimeter/infill entities and writes don't indices of those that are not to be extruder as part of perimeter/infill wiping
void append(const std::string& type, const ExtrusionEntityCollection* eec, const ExtruderPerCopy* copy_extruders, unsigned int object_copies_num);
void append(const std::string& type, const ExtrusionEntityCollection* eec, const ExtruderPerCopy* copy_extruders, size_t object_copies_num);
};
std::vector<Region> by_region; // all extrusions for this island, grouped by regions

View file

@ -458,14 +458,14 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
continue;
}
const auto& object = object_list[i];
const PrintObject* object = object_list[i];
// Finds this layer:
auto this_layer_it = std::find_if(object->layers().begin(), object->layers().end(), [&lt](const Layer* lay) { return std::abs(lt.print_z - lay->print_z)<EPSILON; });
if (this_layer_it == object->layers().end())
continue;
const Layer* this_layer = *this_layer_it;
unsigned int num_of_copies = object->copies().size();
size_t num_of_copies = object->copies().size();
for (unsigned int copy = 0; copy < num_of_copies; ++copy) { // iterate through copies first, so that we mark neighbouring infills to minimize travel moves
@ -494,7 +494,7 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
if ((!is_entity_overridden(fill, copy) && fill->total_volume() > min_infill_volume)) { // this infill will be used to wipe this extruder
set_extruder_override(fill, copy, new_extruder, num_of_copies);
volume_to_wipe -= fill->total_volume();
volume_to_wipe -= float(fill->total_volume());
}
}
}
@ -512,7 +512,7 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
if ((!is_entity_overridden(fill, copy) && fill->total_volume() > min_infill_volume)) {
set_extruder_override(fill, copy, new_extruder, num_of_copies);
volume_to_wipe -= fill->total_volume();
volume_to_wipe -= float(fill->total_volume());
}
}
}
@ -540,9 +540,9 @@ void WipingExtrusions::ensure_perimeters_infills_order(const Print& print)
if (this_layer_it == object->layers().end())
continue;
const Layer* this_layer = *this_layer_it;
unsigned int num_of_copies = object->copies().size();
size_t num_of_copies = object->copies().size();
for (unsigned int copy = 0; copy < num_of_copies; ++copy) { // iterate through copies first, so that we mark neighbouring infills to minimize travel moves
for (size_t copy = 0; copy < num_of_copies; ++copy) { // iterate through copies first, so that we mark neighbouring infills to minimize travel moves
for (size_t region_id = 0; region_id < object->region_volumes.size(); ++ region_id) {
const auto& region = *object->print()->regions()[region_id];
@ -598,7 +598,7 @@ void WipingExtrusions::ensure_perimeters_infills_order(const Print& print)
// so -1 was used as "print as usual".
// The resulting vector has to keep track of which extrusions are the ones that were overridden and which were not. In the extruder is used as overridden,
// its number is saved as it is (zero-based index). Usual extrusions are saved as -number-1 (unfortunately there is no negative zero).
const std::vector<int>* WipingExtrusions::get_extruder_overrides(const ExtrusionEntity* entity, int correct_extruder_id, int num_of_copies)
const std::vector<int>* WipingExtrusions::get_extruder_overrides(const ExtrusionEntity* entity, int correct_extruder_id, size_t num_of_copies)
{
auto entity_map_it = entity_map.find(entity);
if (entity_map_it == entity_map.end())

View file

@ -24,7 +24,7 @@ public:
}
// This is called from GCode::process_layer - see implementation for further comments:
const std::vector<int>* get_extruder_overrides(const ExtrusionEntity* entity, int correct_extruder_id, int num_of_copies);
const std::vector<int>* get_extruder_overrides(const ExtrusionEntity* entity, int correct_extruder_id, size_t num_of_copies);
// 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:
@ -44,7 +44,7 @@ private:
void set_extruder_override(const ExtrusionEntity* entity, unsigned int copy_id, int extruder, unsigned int 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, int copy_id) const {
bool is_entity_overridden(const ExtrusionEntity* entity, size_t copy_id) const {
return (entity_map.find(entity) == entity_map.end() ? false : entity_map.at(entity).at(copy_id) != -1);
}

View file

@ -184,7 +184,7 @@ public:
if (f != 0.f && f != m_current_feedrate) {
if (limit_volumetric_flow) {
float e_speed = e / (((len == 0) ? std::abs(e) : len) / f * 60.f);
float e_speed = e / (((len == 0.f) ? std::abs(e) : len) / f * 60.f);
f /= std::max(1.f, e_speed / m_filpar[m_current_tool].max_e_speed);
}
m_gcode += set_format_F(f);
@ -194,7 +194,7 @@ public:
m_current_pos.y() = y;
// Update the elapsed time with a rough estimate.
m_elapsed_time += ((len == 0) ? std::abs(e) : len) / m_current_feedrate * 60.f;
m_elapsed_time += ((len == 0.f) ? std::abs(e) : len) / m_current_feedrate * 60.f;
m_gcode += "\n";
return *this;
}
@ -387,14 +387,14 @@ public:
}
WipeTowerWriter& set_fan(unsigned int speed)
WipeTowerWriter& set_fan(unsigned speed)
{
if (speed == m_last_fan_speed)
return *this;
if (speed == 0)
m_gcode += "M107\n";
else
m_gcode += "M106 S" + std::to_string((size_t)(255.0 * speed / 100.0)) + "\n";
m_gcode += "M106 S" + std::to_string(unsigned(255.0 * speed / 100.0)) + "\n";
m_last_fan_speed = speed;
return *this;
}
@ -417,7 +417,7 @@ private:
float m_y_shift = 0.f;
float m_wipe_tower_width = 0.f;
float m_wipe_tower_depth = 0.f;
float m_last_fan_speed = 0.f;
unsigned m_last_fan_speed = 0.f;
int current_temp = -1;
const float m_default_analyzer_line_width;
float m_used_filament_length = 0.f;
@ -466,12 +466,12 @@ private:
WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool) :
m_semm(config.single_extruder_multi_material.value),
m_wipe_tower_pos(config.wipe_tower_x, config.wipe_tower_y),
m_wipe_tower_width(config.wipe_tower_width),
m_wipe_tower_rotation_angle(config.wipe_tower_rotation_angle),
m_wipe_tower_width(float(config.wipe_tower_width)),
m_wipe_tower_rotation_angle(float(config.wipe_tower_rotation_angle)),
m_y_shift(0.f),
m_z_pos(0.f),
m_is_first_layer(false),
m_bridging(config.wipe_tower_bridging),
m_bridging(float(config.wipe_tower_bridging)),
m_gcode_flavor(config.gcode_flavor),
m_current_tool(initial_tool),
wipe_volumes(wiping_matrix)
@ -479,16 +479,16 @@ WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<fl
// If this is a single extruder MM printer, we will use all the SE-specific config values.
// Otherwise, the defaults will be used to turn off the SE stuff.
if (m_semm) {
m_cooling_tube_retraction = config.cooling_tube_retraction;
m_cooling_tube_length = config.cooling_tube_length;
m_parking_pos_retraction = config.parking_pos_retraction;
m_extra_loading_move = config.extra_loading_move;
m_set_extruder_trimpot = config.high_current_on_filament_swap;
m_cooling_tube_retraction = float(config.cooling_tube_retraction);
m_cooling_tube_length = float(config.cooling_tube_length);
m_parking_pos_retraction = float(config.parking_pos_retraction);
m_extra_loading_move = float(config.extra_loading_move);
m_set_extruder_trimpot = config.high_current_on_filament_swap;
}
// Calculate where the priming lines should be - very naive test not detecting parallelograms or custom shapes
const std::vector<Vec2d>& bed_points = config.bed_shape.values;
m_bed_shape = (bed_points.size() == 4 ? RectangularBed : CircularBed);
m_bed_width = BoundingBoxf(bed_points).size().x();
m_bed_width = float(BoundingBoxf(bed_points).size().x());
}
@ -505,21 +505,21 @@ void WipeTower::set_extruder(size_t idx, const PrintConfig& config)
// If this is a single extruder MM printer, we will use all the SE-specific config values.
// Otherwise, the defaults will be used to turn off the SE stuff.
if (m_semm) {
m_filpar[idx].loading_speed = config.filament_loading_speed.get_at(idx);
m_filpar[idx].loading_speed_start = config.filament_loading_speed_start.get_at(idx);
m_filpar[idx].unloading_speed = config.filament_unloading_speed.get_at(idx);
m_filpar[idx].unloading_speed_start = config.filament_unloading_speed_start.get_at(idx);
m_filpar[idx].delay = config.filament_toolchange_delay.get_at(idx);
m_filpar[idx].loading_speed = float(config.filament_loading_speed.get_at(idx));
m_filpar[idx].loading_speed_start = float(config.filament_loading_speed_start.get_at(idx));
m_filpar[idx].unloading_speed = float(config.filament_unloading_speed.get_at(idx));
m_filpar[idx].unloading_speed_start = float(config.filament_unloading_speed_start.get_at(idx));
m_filpar[idx].delay = float(config.filament_toolchange_delay.get_at(idx));
m_filpar[idx].cooling_moves = config.filament_cooling_moves.get_at(idx);
m_filpar[idx].cooling_initial_speed = config.filament_cooling_initial_speed.get_at(idx);
m_filpar[idx].cooling_final_speed = config.filament_cooling_final_speed.get_at(idx);
m_filpar[idx].cooling_initial_speed = float(config.filament_cooling_initial_speed.get_at(idx));
m_filpar[idx].cooling_final_speed = float(config.filament_cooling_final_speed.get_at(idx));
}
m_filpar[idx].filament_area = float((M_PI/4.f) * pow(config.filament_diameter.get_at(idx), 2)); // all extruders are assumed to have the same filament diameter at this point
float nozzle_diameter = config.nozzle_diameter.get_at(idx);
float nozzle_diameter = float(config.nozzle_diameter.get_at(idx));
m_filpar[idx].nozzle_diameter = nozzle_diameter; // to be used in future with (non-single) multiextruder MM
float max_vol_speed = config.filament_max_volumetric_speed.get_at(idx);
float max_vol_speed = float(config.filament_max_volumetric_speed.get_at(idx));
if (max_vol_speed!= 0.f)
m_filpar[idx].max_e_speed = (max_vol_speed / filament_area());
@ -548,7 +548,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
const std::vector<unsigned int> &tools,
// If true, the last priming are will be the same as the other priming areas, and the rest of the wipe will be performed inside the wipe tower.
// If false, the last priming are will be large enough to wipe the last extruder sufficiently.
bool last_wipe_inside_wipe_tower)
bool /*last_wipe_inside_wipe_tower*/)
{
this->set_layer(first_layer_height, first_layer_height, tools.size(), true, false);
this->m_current_tool = tools.front();
@ -683,7 +683,7 @@ WipeTower::ToolChangeResult WipeTower::tool_change(unsigned int tool, bool last_
box_coordinates cleaning_box(
Vec2f(m_perimeter_width / 2.f, m_perimeter_width / 2.f),
m_wipe_tower_width - m_perimeter_width,
(tool != (unsigned int)(-1) ? /*m_layer_info->depth*/wipe_area+m_depth_traversed-0.5*m_perimeter_width
(tool != (unsigned int)(-1) ? /*m_layer_info->depth*/wipe_area+m_depth_traversed-0.5f*m_perimeter_width
: m_wipe_tower_depth-m_perimeter_width));
WipeTowerWriter writer(m_layer_height, m_perimeter_width, m_gcode_flavor, m_filpar);
@ -789,7 +789,7 @@ WipeTower::ToolChangeResult WipeTower::toolchange_Brim(bool sideOnly, float y_of
// Extrude 4 rounds of a brim around the future wipe tower.
box_coordinates box(wipeTower_box);
for (size_t i = 0; i < 4; ++ i) {
box.expand(m_perimeter_width - m_layer_height*(1.f-M_PI_4)); // the brim shall have 'normal' spacing with no extra void space
box.expand(m_perimeter_width - m_layer_height*float(1.-M_PI_4)); // the brim shall have 'normal' spacing with no extra void space
writer.travel (box.ld, 7000)
.extrude(box.lu, 2100).extrude(box.ru)
.extrude(box.rd ).extrude(box.ld);
@ -898,8 +898,8 @@ void WipeTower::toolchange_Unload(
const float x = volume_to_length(m_filpar[m_current_tool].ramming_speed[i] * 0.25f, line_width, m_layer_height);
const float e = m_filpar[m_current_tool].ramming_speed[i] * 0.25f / filament_area(); // transform volume per sec to E move;
const float dist = std::min(x - e_done, remaining); // distance to travel for either the next 0.25s, or to the next turnaround
const float actual_time = dist/x * 0.25;
writer.ram(writer.x(), writer.x() + (m_left_to_right ? 1.f : -1.f) * dist, 0, 0, e * (dist / x), dist / (actual_time / 60.));
const float actual_time = dist/x * 0.25f;
writer.ram(writer.x(), writer.x() + (m_left_to_right ? 1.f : -1.f) * dist, 0.f, 0.f, e * (dist / x), dist / (actual_time / 60.f));
remaining -= dist;
if (remaining < WT_EPSILON) { // we reached a turning point
@ -1078,21 +1078,21 @@ void WipeTower::toolchange_Wipe(
float traversed_x = writer.x();
if (m_left_to_right)
writer.extrude(xr - (i % 4 == 0 ? 0 : 1.5*m_perimeter_width), writer.y(), wipe_speed * wipe_coeff);
writer.extrude(xr - (i % 4 == 0 ? 0 : 1.5f*m_perimeter_width), writer.y(), wipe_speed * wipe_coeff);
else
writer.extrude(xl + (i % 4 == 1 ? 0 : 1.5*m_perimeter_width), writer.y(), wipe_speed * wipe_coeff);
writer.extrude(xl + (i % 4 == 1 ? 0 : 1.5f*m_perimeter_width), writer.y(), wipe_speed * wipe_coeff);
if (writer.y()+EPSILON > cleaning_box.lu.y()-0.5f*m_perimeter_width)
if (writer.y()+float(EPSILON) > cleaning_box.lu.y()-0.5f*m_perimeter_width)
break; // in case next line would not fit
traversed_x -= writer.x();
x_to_wipe -= fabs(traversed_x);
x_to_wipe -= std::abs(traversed_x);
if (x_to_wipe < WT_EPSILON) {
writer.travel(m_left_to_right ? xl + 1.5*m_perimeter_width : xr - 1.5*m_perimeter_width, writer.y(), 7200);
writer.travel(m_left_to_right ? xl + 1.5f*m_perimeter_width : xr - 1.5f*m_perimeter_width, writer.y(), 7200);
break;
}
// stepping to the next line:
writer.extrude(writer.x() + (i % 4 == 0 ? -1.f : (i % 4 == 1 ? 1.f : 0.f)) * 1.5*m_perimeter_width, writer.y() + dy);
writer.extrude(writer.x() + (i % 4 == 0 ? -1.f : (i % 4 == 1 ? 1.f : 0.f)) * 1.5f*m_perimeter_width, writer.y() + dy);
m_left_to_right = !m_left_to_right;
}
@ -1175,7 +1175,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
writer.travel(fill_box.ld + Vec2f(m_perimeter_width * 2, 0.f))
.extrude(fill_box.lu + Vec2f(m_perimeter_width * 2, 0.f), 2900 * speed_factor);
const int n = 1+(right-left)/(m_bridging);
const int n = 1+int((right-left)/m_bridging);
const float dx = (right-left)/n;
for (int i=1;i<=n;++i) {
float x=left+dx*i;
@ -1254,7 +1254,7 @@ void WipeTower::plan_tower()
for (auto& layer : m_plan)
layer.depth = 0.f;
for (int layer_index = m_plan.size() - 1; layer_index >= 0; --layer_index)
for (int layer_index = int(m_plan.size()) - 1; layer_index >= 0; --layer_index)
{
float this_layer_depth = std::max(m_plan[layer_index].depth, m_plan[layer_index].toolchanges_depth());
m_plan[layer_index].depth = this_layer_depth;

View file

@ -108,7 +108,6 @@ static inline bool opts_equal(const DynamicConfig &config_old, const DynamicConf
std::vector<std::string> PlaceholderParser::config_diff(const DynamicPrintConfig &rhs)
{
const ConfigDef *def = rhs.def();
std::vector<std::string> diff_keys;
for (const t_config_option_key &opt_key : rhs.keys())
if (! opts_equal(m_config, rhs, opt_key))
@ -124,7 +123,6 @@ std::vector<std::string> PlaceholderParser::config_diff(const DynamicPrintConfig
// a current extruder ID is used.
bool PlaceholderParser::apply_config(const DynamicPrintConfig &rhs)
{
const ConfigDef *def = rhs.def();
bool modified = false;
for (const t_config_option_key &opt_key : rhs.keys()) {
if (! opts_equal(m_config, rhs, opt_key)) {

View file

@ -2049,7 +2049,7 @@ void PrintConfigDef::init_fff_params()
{
int threads = (unsigned int)boost::thread::hardware_concurrency();
def->set_default_value(new ConfigOptionInt(threads > 0 ? threads : 2));
def->cli == ConfigOptionDef::nocli;
def->cli = ConfigOptionDef::nocli;
}
def = this->add("toolchange_gcode", coString);

View file

@ -83,12 +83,14 @@ void PrintRegion::collect_object_printing_extruders(const PrintConfig &print_con
void PrintRegion::collect_object_printing_extruders(std::vector<unsigned int> &object_extruders) const
{
auto num_extruders = (int)print()->config().nozzle_diameter.size();
// PrintRegion, if used by some PrintObject, shall have all the extruders set to an existing printer extruder.
// If not, then there must be something wrong with the Print::apply() function.
#ifndef NDEBUG
auto num_extruders = (int)print()->config().nozzle_diameter.size();
assert(this->config().perimeter_extruder <= num_extruders);
assert(this->config().infill_extruder <= num_extruders);
assert(this->config().solid_infill_extruder <= num_extruders);
#endif
collect_object_printing_extruders(print()->config(), this->config(), object_extruders);
}

View file

@ -185,8 +185,6 @@ private:
SLAAutoSupports::Config m_config;
float m_supports_force_total = 0.f;
void process(const std::vector<ExPolygons>& slices, const std::vector<float>& heights);
void uniformly_cover(const ExPolygons& islands, Structure& structure, PointGrid3D &grid3d, bool is_new_island = false, bool just_one = false);
void project_onto_mesh(std::vector<sla::SupportPoint>& points) const;

View file

@ -676,7 +676,7 @@ std::string SLAPrint::validate() const
if(supports_en && !builtinpad.enabled && elv < pinhead_width )
return L(
"Elevation is too low for object. Use the \"Pad around "
"obect\" feature to print the object without elevation.");
"object\" feature to print the object without elevation.");
if(supports_en && builtinpad.enabled &&
cfg.pillar_base_safety_distance_mm < builtinpad.object_gap_mm) {

View file

@ -179,8 +179,7 @@ bool GUI_App::on_init_inner()
wxCHECK_MSG(wxDirExists(resources_dir), false,
wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));
//SetAppName(SLIC3R_APP_KEY);
SetAppName(SLIC3R_APP_KEY "-beta");
SetAppName(SLIC3R_APP_KEY);
SetAppDisplayName(SLIC3R_APP_NAME);
// Enable this to get the default Win32 COMCTRL32 behavior of static boxes.

View file

@ -135,7 +135,7 @@ wxSizer* ObjectLayers::create_layer(const t_layer_height_range& range)
auto temp = new wxStaticText(m_parent, wxID_ANY, _(L("mm")));
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
temp->SetFont(wxGetApp().normal_font());
sizer->Add(temp, 0, wxLEFT|wxRIGHT, wxGetApp().em_unit());
sizer->Add(temp, 0, wxLEFT, wxGetApp().em_unit());
m_grid_sizer->Add(sizer);
@ -154,16 +154,16 @@ void ObjectLayers::create_layers_list()
sizer->Add(del_btn, 0, wxRIGHT | wxLEFT, em_unit(m_parent));
del_btn->Bind(wxEVT_BUTTON, [this, range](wxEvent &event) {
del_btn->Bind(wxEVT_BUTTON, [range](wxEvent &) {
wxGetApp().obj_list()->del_layer_range(range);
});
auto add_btn = new ScalableButton(m_parent, wxID_ANY, m_bmp_add);
add_btn->SetToolTip(_(L("Add layer range")));
sizer->Add(add_btn, 0, wxRIGHT, em_unit(m_parent));
sizer->Add(add_btn);
add_btn->Bind(wxEVT_BUTTON, [this, range](wxEvent &event) {
add_btn->Bind(wxEVT_BUTTON, [range](wxEvent &) {
wxGetApp().obj_list()->add_layer_range_after_current(range);
});
}

View file

@ -2500,15 +2500,18 @@ void ObjectList::remove()
auto delete_item = [this](wxDataViewItem item)
{
wxDataViewItem parent = m_objects_model->GetParent(item);
if (m_objects_model->GetItemType(item) & itObject)
ItemType type = m_objects_model->GetItemType(item);
if (type & itObject)
delete_from_model_and_list(itObject, m_objects_model->GetIdByItem(item), -1);
else {
if (m_objects_model->GetItemType(item) & itLayer) {
if (type & (itLayer | itInstance)) {
// In case there is just one layer or two instances and we delete it, del_subobject_item will
// also remove the parent item. Selection should therefore pass to the top parent (object).
wxDataViewItemArray children;
if (m_objects_model->GetChildren(parent, children) == 1)
if (m_objects_model->GetChildren(parent, children) == (type & itLayer ? 1 : 2))
parent = m_objects_model->GetTopParent(item);
}
del_subobject_item(item);
}

View file

@ -625,6 +625,14 @@ void ObjectManipulation::update_reset_buttons_visibility()
m_reset_rotation_button->Show(show_rotation);
m_reset_scale_button->Show(show_scale);
m_drop_to_bed_button->Show(show_drop_to_bed);
// Because of CallAfter we need to layout sidebar after Show/hide of reset buttons one more time
Sidebar& panel = wxGetApp().sidebar();
if (!panel.IsFrozen()) {
panel.Freeze();
panel.Layout();
panel.Thaw();
}
});
}

View file

@ -634,7 +634,7 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool kee
bool force_sliders_full_range = was_empty;
if (!keep_z_range)
{
bool span_changed = layers_z.empty() || std::abs(layers_z.back() - m_slider->GetMaxValueD()) > 1e-6;
bool span_changed = layers_z.empty() || std::abs(layers_z.back() - m_slider->GetMaxValueD()) > DoubleSlider::epsilon()/*1e-6*/;
force_sliders_full_range |= span_changed;
}
bool snap_to_min = force_sliders_full_range || m_slider->is_lower_at_min();
@ -650,12 +650,12 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool kee
int idx_high = m_slider->GetMaxValue();
if (! layers_z.empty()) {
if (! snap_to_min) {
int idx_new = find_close_layer_idx(layers_z, z_low, 1e-6);
int idx_new = find_close_layer_idx(layers_z, z_low, DoubleSlider::epsilon()/*1e-6*/);
if (idx_new != -1)
idx_low = idx_new;
}
if (! snap_to_max) {
int idx_new = find_close_layer_idx(layers_z, z_high, 1e-6);
int idx_new = find_close_layer_idx(layers_z, z_high, DoubleSlider::epsilon()/*1e-6*/);
if (idx_new != -1)
idx_high = idx_new;
}
@ -691,7 +691,12 @@ void Preview::fill_slider_values(std::vector<std::pair<int, double>> &values,
std::vector<double> &ticks_from_config = (wxGetApp().preset_bundle->project_config.option<ConfigOptionFloats>("colorprint_heights"))->values;
unsigned int old_size = ticks_from_config.size();
ticks_from_config.erase(std::remove_if(ticks_from_config.begin(), ticks_from_config.end(),
[values](double val) { return values.back().second < val; }),
[values](double val)
{
return (values.back().second < val &&
// we can't ignore tick on last layer
fabs(values.back().second - val) > DoubleSlider::epsilon());
}),
ticks_from_config.end());
if (ticks_from_config.size() != old_size)
m_schedule_background_process();

View file

@ -308,7 +308,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
}
else {
render_color[3] = 1.f;
if ((m_hover_id == i && m_editing_mode)) { // ignore hover state unless editing mode is active
if ((size_t(m_hover_id) == i && m_editing_mode)) { // ignore hover state unless editing mode is active
render_color[0] = 0.f;
render_color[1] = 1.0f;
render_color[2] = 1.0f;
@ -330,7 +330,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
// Inverse matrix of the instance scaling is applied so that the mark does not scale with the object.
glsafe(::glPushMatrix());
glsafe(::glTranslated(support_point.pos(0), support_point.pos(1), support_point.pos(2)));
glsafe(::glTranslatef(support_point.pos(0), support_point.pos(1), support_point.pos(2)));
glsafe(::glMultMatrixd(instance_scaling_matrix_inverse.data()));
if (vol->is_left_handed())
@ -347,16 +347,16 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
Eigen::AngleAxisd aa(q);
glsafe(::glRotated(aa.angle() * (180. / M_PI), aa.axis()(0), aa.axis()(1), aa.axis()(2)));
const float cone_radius = 0.25f; // mm
const float cone_height = 0.75f;
const double cone_radius = 0.25; // mm
const double cone_height = 0.75;
glsafe(::glPushMatrix());
glsafe(::glTranslatef(0.f, 0.f, support_point.head_front_radius * RenderPointScale));
::gluCylinder(m_quadric, 0.f, cone_radius, cone_height, 24, 1);
::gluCylinder(m_quadric, 0., cone_radius, cone_height, 24, 1);
glsafe(::glTranslatef(0.f, 0.f, cone_height));
::gluDisk(m_quadric, 0.0, cone_radius, 24, 1);
glsafe(::glPopMatrix());
}
::gluSphere(m_quadric, support_point.head_front_radius * RenderPointScale, 24, 12);
::gluSphere(m_quadric, (double)support_point.head_front_radius * RenderPointScale, 24, 12);
if (vol->is_left_handed())
glFrontFace(GL_CCW);
@ -777,7 +777,7 @@ std::vector<const ConfigOption*> GLGizmoSlaSupports::get_config_options(const st
}
void GLGizmoSlaSupports::update_cache_entry_normal(unsigned int i) const
void GLGizmoSlaSupports::update_cache_entry_normal(size_t i) const
{
int idx = 0;
Eigen::Matrix<float, 1, 3> pp = m_editing_cache[i].support_point.pos;

View file

@ -30,7 +30,7 @@ private:
ObjectID m_model_object_id = 0;
int m_active_instance = -1;
float m_active_instance_bb_radius; // to cache the bb
mutable float m_z_shift = 0.f;
mutable double m_z_shift = 0.f;
bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, Vec3f>& pos_and_normal);
const float RenderPointScale = 1.f;
@ -99,11 +99,9 @@ private:
void render_clipping_plane(const Selection& selection) const;
bool is_mesh_update_necessary() const;
void update_mesh();
void update_cache_entry_normal(unsigned int i) const;
void update_cache_entry_normal(size_t i) const;
bool unsaved_changes() const;
EState m_no_hover_state = Off;
EState m_no_hover_old_state = Off;
bool m_lock_unique_islands = false;
bool m_editing_mode = false; // Is editing mode active?
bool m_old_editing_state = false; // To keep track of whether the user toggled between the modes (needed for imgui refreshes).

View file

@ -1495,13 +1495,16 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, GUI::Pr
// To avoid the errors of number rounding for different combination of monitor configuration,
// let use scaled 8px, as a smallest icon unit
const int icon_unit = 8 * scale_f + 0.5f;
const int icon_height = 2 * icon_unit; //16 * scale_f + 0.5f;
const int normal_icon_width = 2 * icon_unit; //16 * scale_f + 0.5f;
const int thin_icon_width = icon_unit; //8 * scale_f + 0.5f;
const int wide_icon_width = 3 * icon_unit; //24 * scale_f + 0.5f;
const int space_icon_width = 2 * scale_f + 0.5f;
// To avoid asserts, each added bitmap to wxBitmapCombobox should be the same size, so
// set a bitmap height to m_bitmapLock->GetHeight()
const int icon_height = m_bitmapLock->GetHeight();//2 * icon_unit; //16 * scale_f + 0.5f;
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) {
const Preset &preset = this->filaments.preset(i);
bool selected = this->filament_presets[idx_extruder] == preset.name;

View file

@ -545,6 +545,9 @@ void TabSLAMaterial::init_options_list()
void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page)
{
auto opt = m_options_list.find(opt_key);
if (opt == m_options_list.end())
return;
if (sys_page) sys_page = (opt->second & osSystemValue) != 0;
modified_page |= (opt->second & osInitValue) == 0;
}

View file

@ -2201,9 +2201,10 @@ std::vector<double> DoubleSlider::GetTicksValues() const
{
std::vector<double> values;
const int val_size = m_values.size();
if (!m_values.empty())
for (auto tick : m_ticks) {
if (tick > m_values.size())
for (int tick : m_ticks) {
if (tick > val_size)
break;
values.push_back(m_values[tick].second);
}
@ -2221,9 +2222,10 @@ void DoubleSlider::SetTicksValues(const std::vector<double>& heights)
m_ticks.clear();
unsigned int i = 0;
for (auto h : heights) {
while (i < m_values.size() && m_values[i].second - 1e-6 < h)
while (i < m_values.size() && m_values[i].second - epsilon()/*1e-6*/ < h)
++i;
if (i == m_values.size())
// don't miss last layer if it is
if (i == m_values.size() && fabs(m_values[i-1].second - h) > epsilon())
return;
m_ticks.insert(i-1);
}
@ -2298,6 +2300,10 @@ void DoubleSlider::draw_action_icon(wxDC& dc, const wxPoint pt_beg, const wxPoin
{
const int tick = m_selection == ssLower ? m_lower_value : m_higher_value;
// suppress add tick on first layer
if (tick == 0)
return;
wxBitmap* icon = m_is_action_icon_focesed ? &m_bmp_add_tick_off.bmp() : &m_bmp_add_tick_on.bmp();
if (m_ticks.find(tick) != m_ticks.end())
icon = m_is_action_icon_focesed ? &m_bmp_del_tick_off.bmp() : &m_bmp_del_tick_on.bmp();

View file

@ -720,6 +720,9 @@ public:
const wxString& name = wxEmptyString);
~DoubleSlider() {}
// permissible error for layer height
static double epsilon() { return 0.0011;}
void msw_rescale();
int GetMinValue() const { return m_min_value; }