This commit is contained in:
Vojtech Bubnik 2020-12-15 15:15:46 +01:00
commit 0ad3a63a3b
5 changed files with 62 additions and 17 deletions

View File

@ -562,6 +562,10 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
}
m_time_processor.export_remaining_time_enabled = config.remaining_times.value;
#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
m_use_volumetric_e = config.use_volumetric_e;
#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
}
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
@ -719,6 +723,12 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
m_time_processor.machines[i].max_acceleration = max_acceleration;
m_time_processor.machines[i].acceleration = (max_acceleration > 0.0f) ? max_acceleration : DEFAULT_ACCELERATION;
}
#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
const ConfigOptionBool* use_volumetric_e = config.option<ConfigOptionBool>("use_volumetric_e");
if (use_volumetric_e != nullptr)
m_use_volumetric_e = use_volumetric_e->value;
#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
}
void GCodeProcessor::enable_stealth_time_estimator(bool enabled)
@ -773,6 +783,10 @@ void GCodeProcessor::reset()
m_result.reset();
m_result.id = ++s_result_id;
#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
m_use_volumetric_e = false;
#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_mm3_per_mm_compare.reset();
m_height_compare.reset();
@ -1653,8 +1667,14 @@ void GCodeProcessor::process_G0(const GCodeReader::GCodeLine& line)
void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
{
auto absolute_position = [this](Axis axis, const GCodeReader::GCodeLine& lineG1)
{
#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
float filament_diameter = (static_cast<size_t>(m_extruder_id) < m_filament_diameters.size()) ? m_filament_diameters[m_extruder_id] : m_filament_diameters.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) {
#else
auto absolute_position = [this](Axis axis, const GCodeReader::GCodeLine& lineG1) {
#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
bool is_relative = (m_global_positioning_type == EPositioningType::Relative);
if (axis == E)
is_relative |= (m_e_local_positioning_type == EPositioningType::Relative);
@ -1662,6 +1682,10 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
if (lineG1.has(Slic3r::Axis(axis))) {
float lengthsScaleFactor = (m_units == EUnits::Inches) ? INCHES_TO_MM : 1.0f;
float ret = lineG1.value(Slic3r::Axis(axis)) * lengthsScaleFactor;
#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
if (axis == E && m_use_volumetric_e)
ret /= area_filament_cross_section;
#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
return is_relative ? m_start_position[axis] + ret : m_origin[axis] + ret;
}
else
@ -1719,9 +1743,11 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
if (type == EMoveType::Extrude) {
float delta_xyz = std::sqrt(sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z]));
#if !ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
float filament_diameter = (static_cast<size_t>(m_extruder_id) < m_filament_diameters.size()) ? m_filament_diameters[m_extruder_id] : m_filament_diameters.back();
float filament_radius = 0.5f * filament_diameter;
float area_filament_cross_section = static_cast<float>(M_PI) * sqr(filament_radius);
#endif // !ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
float volume_extruded_filament = area_filament_cross_section * delta_pos[E];
float area_toolpath_cross_section = volume_extruded_filament / delta_xyz;

View File

@ -421,6 +421,9 @@ namespace Slic3r {
unsigned int m_g1_line_id;
unsigned int m_layer_id;
CpColor m_cp_color;
#if ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
bool m_use_volumetric_e;
#endif // ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING
enum class EProducer
{

View File

@ -99,4 +99,12 @@
#define ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE (1 && ENABLE_2_3_0_BETA3)
#define ENABLE_RENDER_PATH_REFRESH_AFTER_OPTIONS_CHANGE (1 && ENABLE_2_3_0_BETA3)
//=================
// 2.3.0.rc1 techs
//=================
#define ENABLE_2_3_0_RC1 1
#define ENABLE_VOLUMETRIC_EXTRUSION_PROCESSING (1 && ENABLE_2_3_0_RC1)
#endif // _prusaslicer_technologies_h_

View File

@ -51,7 +51,12 @@ static std::string get_icon_name(Preset::Type type, PrinterTechnology pt) {
return pt == ptSLA && type == Preset::TYPE_PRINTER ? "sla_printer" : type_icon_names.at(type);
}
static std::string black = "#000000";
static std::string def_text_color()
{
wxColour def_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
auto clr_str = wxString::Format(wxT("#%02X%02X%02X"), def_colour.Red(), def_colour.Green(), def_colour.Blue());
return clr_str.ToStdString();
}
static std::string grey = "#808080";
static std::string orange = "#ed6b21";
@ -158,7 +163,7 @@ ModelNode::ModelNode(ModelNode* parent, const wxString& text, const wxString& ol
}
// "color" strings
color_string(m_old_value, black);
color_string(m_old_value, def_text_color());
color_string(m_new_value, orange);
UpdateIcons();
@ -176,13 +181,13 @@ void ModelNode::UpdateEnabling()
};
if (!m_toggle) {
change_text_color(m_text, black, grey);
change_text_color(m_old_value, black, grey);
change_text_color(m_text, def_text_color(), grey);
change_text_color(m_old_value, def_text_color(), grey);
change_text_color(m_new_value, orange,grey);
}
else {
change_text_color(m_text, grey, black);
change_text_color(m_old_value, grey, black);
change_text_color(m_text, grey, def_text_color());
change_text_color(m_old_value, grey, def_text_color());
change_text_color(m_new_value, grey, orange);
}
// update icons for the colors
@ -227,7 +232,7 @@ UnsavedChangesModel::~UnsavedChangesModel()
wxDataViewItem UnsavedChangesModel::AddPreset(Preset::Type type, wxString preset_name, PrinterTechnology pt)
{
// "color" strings
color_string(preset_name, black);
color_string(preset_name, def_text_color());
make_string_bold(preset_name);
auto preset = new ModelNode(type, m_parent_win, preset_name, get_icon_name(type, pt));
@ -274,9 +279,9 @@ wxDataViewItem UnsavedChangesModel::AddOption(Preset::Type type, wxString catego
wxString old_value, wxString new_value, const std::string category_icon_name)
{
// "color" strings
color_string(category_name, black);
color_string(group_name, black);
color_string(option_name, black);
color_string(category_name, def_text_color());
color_string(group_name, def_text_color());
color_string(option_name, def_text_color());
// "make" strings bold
make_string_bold(category_name);

View File

@ -16,10 +16,7 @@
#include "Plater.hpp"
#include "../Utils/MacDarkMode.hpp"
#ifdef __linux__
#define wxLinux true
#else
#define wxLinux false
#ifndef __linux__
// msw_menuitem_bitmaps is used for MSW and OSX
static std::map<int, std::string> msw_menuitem_bitmaps;
#ifdef __WXMSW__
@ -660,7 +657,13 @@ void ModeButton::focus_button(const bool focus)
Slic3r::GUI::wxGetApp().normal_font();
SetFont(new_font);
SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT : wxLinux ? wxSYS_COLOUR_GRAYTEXT : wxSYS_COLOUR_BTNSHADOW));
SetForegroundColour(wxSystemSettings::GetColour(focus ? wxSYS_COLOUR_BTNTEXT :
#if defined (__linux__) && defined (__WXGTK3__)
wxSYS_COLOUR_GRAYTEXT
#else
wxSYS_COLOUR_BTNSHADOW
#endif
));
Refresh();
Update();