mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-27 02:31:10 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_3dconnexion
This commit is contained in:
commit
9e7e1fb5e2
60 changed files with 3908 additions and 577 deletions
|
|
@ -204,6 +204,7 @@ bool Bed3D::set_shape(const Pointfs& shape, const std::string& custom_texture, c
|
|||
std::string cst_texture(custom_texture);
|
||||
if (!cst_texture.empty())
|
||||
{
|
||||
std::replace(cst_texture.begin(), cst_texture.end(), '\\', '/');
|
||||
if ((!boost::algorithm::iends_with(custom_texture, ".png") && !boost::algorithm::iends_with(custom_texture, ".svg")) || !boost::filesystem::exists(custom_texture))
|
||||
cst_texture = "";
|
||||
}
|
||||
|
|
@ -212,6 +213,7 @@ bool Bed3D::set_shape(const Pointfs& shape, const std::string& custom_texture, c
|
|||
std::string cst_model(custom_model);
|
||||
if (!cst_model.empty())
|
||||
{
|
||||
std::replace(cst_model.begin(), cst_model.end(), '\\', '/');
|
||||
if (!boost::algorithm::iends_with(custom_model, ".stl") || !boost::filesystem::exists(custom_model))
|
||||
cst_model = "";
|
||||
}
|
||||
|
|
@ -270,27 +272,13 @@ void Bed3D::render(GLCanvas3D& canvas, float theta, float scale_factor) const
|
|||
|
||||
switch (m_type)
|
||||
{
|
||||
case MK2:
|
||||
{
|
||||
render_prusa(canvas, "mk2", theta > 90.0f);
|
||||
break;
|
||||
}
|
||||
case MK3:
|
||||
{
|
||||
render_prusa(canvas, "mk3", theta > 90.0f);
|
||||
break;
|
||||
}
|
||||
case SL1:
|
||||
{
|
||||
render_prusa(canvas, "sl1", theta > 90.0f);
|
||||
break;
|
||||
}
|
||||
case MK2: { render_prusa(canvas, "mk2", theta > 90.0f); break; }
|
||||
case MK3: { render_prusa(canvas, "mk3", theta > 90.0f); break; }
|
||||
case SL1: { render_prusa(canvas, "sl1", theta > 90.0f); break; }
|
||||
case MINI: { render_prusa(canvas, "mini", theta > 90.0f); break; }
|
||||
case ENDER3: { render_prusa(canvas, "ender3", theta > 90.0f); break; }
|
||||
default:
|
||||
case Custom:
|
||||
{
|
||||
render_custom(canvas, theta > 90.0f);
|
||||
break;
|
||||
}
|
||||
case Custom: { render_custom(canvas, theta > 90.0f); break; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -362,22 +350,38 @@ Bed3D::EType Bed3D::detect_type(const Pointfs& shape) const
|
|||
{
|
||||
if (curr->config.has("bed_shape"))
|
||||
{
|
||||
if ((curr->vendor != nullptr) && (curr->vendor->name == "Prusa Research") && (shape == dynamic_cast<const ConfigOptionPoints*>(curr->config.option("bed_shape"))->values))
|
||||
if (curr->vendor != nullptr)
|
||||
{
|
||||
if (boost::contains(curr->name, "SL1"))
|
||||
if ((curr->vendor->name == "Prusa Research") && (shape == dynamic_cast<const ConfigOptionPoints*>(curr->config.option("bed_shape"))->values))
|
||||
{
|
||||
type = SL1;
|
||||
break;
|
||||
if (boost::contains(curr->name, "SL1"))
|
||||
{
|
||||
type = SL1;
|
||||
break;
|
||||
}
|
||||
else if (boost::contains(curr->name, "MK3") || boost::contains(curr->name, "MK2.5"))
|
||||
{
|
||||
type = MK3;
|
||||
break;
|
||||
}
|
||||
else if (boost::contains(curr->name, "MK2"))
|
||||
{
|
||||
type = MK2;
|
||||
break;
|
||||
}
|
||||
else if (boost::contains(curr->name, "MINI"))
|
||||
{
|
||||
type = MINI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (boost::contains(curr->name, "MK3") || boost::contains(curr->name, "MK2.5"))
|
||||
else if ((curr->vendor->name == "Creality") && (shape == dynamic_cast<const ConfigOptionPoints*>(curr->config.option("bed_shape"))->values))
|
||||
{
|
||||
type = MK3;
|
||||
break;
|
||||
}
|
||||
else if (boost::contains(curr->name, "MK2"))
|
||||
{
|
||||
type = MK2;
|
||||
break;
|
||||
if (boost::contains(curr->name, "ENDER-3"))
|
||||
{
|
||||
type = ENDER3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ public:
|
|||
MK2,
|
||||
MK3,
|
||||
SL1,
|
||||
MINI,
|
||||
ENDER3,
|
||||
Custom,
|
||||
Num_Types
|
||||
};
|
||||
|
|
|
|||
|
|
@ -707,24 +707,24 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
|||
print_volume.min(2) = -1e10;
|
||||
|
||||
ModelInstance::EPrintVolumeState state = ModelInstance::PVS_Inside;
|
||||
bool all_contained = true;
|
||||
|
||||
bool contained_min_one = false;
|
||||
|
||||
for (GLVolume* volume : this->volumes)
|
||||
{
|
||||
if ((volume == nullptr) || !volume->printable || volume->is_modifier || (volume->is_wipe_tower && !volume->shader_outside_printer_detection_enabled) || ((volume->composite_id.volume_id < 0) && !volume->shader_outside_printer_detection_enabled))
|
||||
if ((volume == nullptr) || volume->is_modifier || (volume->is_wipe_tower && !volume->shader_outside_printer_detection_enabled) || ((volume->composite_id.volume_id < 0) && !volume->shader_outside_printer_detection_enabled))
|
||||
continue;
|
||||
|
||||
const BoundingBoxf3& bb = volume->transformed_convex_hull_bounding_box();
|
||||
bool contained = print_volume.contains(bb);
|
||||
all_contained &= contained;
|
||||
|
||||
volume->is_outside = !contained;
|
||||
if (!volume->printable)
|
||||
continue;
|
||||
|
||||
if (contained)
|
||||
contained_min_one = true;
|
||||
|
||||
volume->is_outside = !contained;
|
||||
|
||||
if ((state == ModelInstance::PVS_Inside) && volume->is_outside)
|
||||
state = ModelInstance::PVS_Fully_Outside;
|
||||
|
||||
|
|
@ -735,7 +735,7 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, M
|
|||
if (out_state != nullptr)
|
||||
*out_state = state;
|
||||
|
||||
return /*all_contained*/ contained_min_one; // #ys_FIXME_delete_after_testing
|
||||
return contained_min_one;
|
||||
}
|
||||
|
||||
void GLVolumeCollection::reset_outside_state()
|
||||
|
|
|
|||
|
|
@ -261,11 +261,7 @@ bool BackgroundSlicingProcess::start()
|
|||
if (m_state == STATE_INITIAL) {
|
||||
// The worker thread is not running yet. Start it.
|
||||
assert(! m_thread.joinable());
|
||||
boost::thread::attributes attrs;
|
||||
// Duplicating the stack allocation size of Thread Building Block worker threads of the thread pool:
|
||||
// allocate 4MB on a 64bit system, allocate 2MB on a 32bit system by default.
|
||||
attrs.set_stack_size((sizeof(void*) == 4) ? (2048 * 1024) : (4096 * 1024));
|
||||
m_thread = boost::thread(attrs, [this]{this->thread_proc_safe();});
|
||||
m_thread = create_thread([this]{this->thread_proc_safe();});
|
||||
// Wait until the worker thread is ready to execute the background processing task.
|
||||
m_condition.wait(lck, [this](){ return m_state == STATE_IDLE; });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@
|
|||
#include <mutex>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include <wx/event.h>
|
||||
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "slic3r/Utils/PrintHost.hpp"
|
||||
#include "slic3r/Utils/Thread.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "boost/nowide/iostream.hpp"
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -60,7 +61,9 @@ void BedShapePanel::build_panel(const ConfigOptionPoints& default_pt, const Conf
|
|||
{
|
||||
m_shape = default_pt.values;
|
||||
m_custom_texture = custom_texture.value.empty() ? NONE : custom_texture.value;
|
||||
std::replace(m_custom_texture.begin(), m_custom_texture.end(), '\\', '/');
|
||||
m_custom_model = custom_model.value.empty() ? NONE : custom_model.value;
|
||||
std::replace(m_custom_model.begin(), m_custom_model.end(), '\\', '/');
|
||||
|
||||
auto sbsizer = new wxStaticBoxSizer(wxVERTICAL, this, _(L("Shape")));
|
||||
sbsizer->GetStaticBox()->SetFont(wxGetApp().bold_font());
|
||||
|
|
@ -212,7 +215,18 @@ wxPanel* BedShapePanel::init_texture_panel()
|
|||
wxStaticText* lbl = dynamic_cast<wxStaticText*>(e.GetEventObject());
|
||||
if (lbl != nullptr)
|
||||
{
|
||||
wxString tooltip_text = (m_custom_texture == NONE) ? "" : _(m_custom_texture);
|
||||
bool exists = (m_custom_texture == NONE) || boost::filesystem::exists(m_custom_texture);
|
||||
lbl->SetForegroundColour(exists ? wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) : wxColor(*wxRED));
|
||||
|
||||
wxString tooltip_text = "";
|
||||
if (m_custom_texture != NONE)
|
||||
{
|
||||
if (!exists)
|
||||
tooltip_text += _(L("Not found: "));
|
||||
|
||||
tooltip_text += _(m_custom_texture);
|
||||
}
|
||||
|
||||
wxToolTip* tooltip = lbl->GetToolTip();
|
||||
if ((tooltip == nullptr) || (tooltip->GetTip() != tooltip_text))
|
||||
lbl->SetToolTip(tooltip_text);
|
||||
|
|
@ -280,7 +294,18 @@ wxPanel* BedShapePanel::init_model_panel()
|
|||
wxStaticText* lbl = dynamic_cast<wxStaticText*>(e.GetEventObject());
|
||||
if (lbl != nullptr)
|
||||
{
|
||||
wxString tooltip_text = (m_custom_model == NONE) ? "" : _(m_custom_model);
|
||||
bool exists = (m_custom_model == NONE) || boost::filesystem::exists(m_custom_model);
|
||||
lbl->SetForegroundColour(exists ? wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT) : wxColor(*wxRED));
|
||||
|
||||
wxString tooltip_text = "";
|
||||
if (m_custom_model != NONE)
|
||||
{
|
||||
if (!exists)
|
||||
tooltip_text += _(L("Not found: "));
|
||||
|
||||
tooltip_text += _(m_custom_model);
|
||||
}
|
||||
|
||||
wxToolTip* tooltip = lbl->GetToolTip();
|
||||
if ((tooltip == nullptr) || (tooltip->GetTip() != tooltip_text))
|
||||
lbl->SetToolTip(tooltip_text);
|
||||
|
|
@ -521,6 +546,8 @@ void BedShapePanel::load_texture()
|
|||
return;
|
||||
}
|
||||
|
||||
std::replace(file_name.begin(), file_name.end(), '\\', '/');
|
||||
|
||||
wxBusyCursor wait;
|
||||
|
||||
m_custom_texture = file_name;
|
||||
|
|
@ -544,6 +571,8 @@ void BedShapePanel::load_model()
|
|||
return;
|
||||
}
|
||||
|
||||
std::replace(file_name.begin(), file_name.end(), '\\', '/');
|
||||
|
||||
wxBusyCursor wait;
|
||||
|
||||
m_custom_model = file_name;
|
||||
|
|
|
|||
|
|
@ -166,6 +166,8 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt
|
|||
int max_row_width = 0;
|
||||
int current_row_width = 0;
|
||||
|
||||
bool is_variants = false;
|
||||
|
||||
for (const auto &model : models) {
|
||||
if (! filter(model)) { continue; }
|
||||
|
||||
|
|
@ -220,6 +222,7 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt
|
|||
auto *alt_label = new wxStaticText(variants_panel, wxID_ANY, _(L("Alternate nozzles:")));
|
||||
alt_label->SetFont(font_alt_nozzle);
|
||||
variants_sizer->Add(alt_label, 0, wxBOTTOM, 3);
|
||||
is_variants = true;
|
||||
}
|
||||
|
||||
auto *cbox = new Checkbox(variants_panel, label, model_id, variant.name);
|
||||
|
|
@ -280,10 +283,10 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt
|
|||
}
|
||||
title_sizer->AddStretchSpacer();
|
||||
|
||||
if (titles.size() > 1) {
|
||||
if (/*titles.size() > 1*/is_variants) {
|
||||
// It only makes sense to add the All / None buttons if there's multiple printers
|
||||
|
||||
auto *sel_all_std = new wxButton(this, wxID_ANY, _(L("All standard")));
|
||||
auto *sel_all_std = new wxButton(this, wxID_ANY, titles.size() > 1 ? _(L("All standard")) : _(L("Standard")));
|
||||
auto *sel_all = new wxButton(this, wxID_ANY, _(L("All")));
|
||||
auto *sel_none = new wxButton(this, wxID_ANY, _(L("None")));
|
||||
sel_all_std->Bind(wxEVT_BUTTON, [this](const wxCommandEvent &event) { this->select_all(true, false); });
|
||||
|
|
|
|||
|
|
@ -11,6 +11,12 @@
|
|||
#include <wx/tooltip.h>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#ifdef __WXOSX__
|
||||
#define wxOSX true
|
||||
#else
|
||||
#define wxOSX false
|
||||
#endif
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
wxString double_to_string(double const value, const int max_precision /*= 4*/)
|
||||
|
|
@ -304,7 +310,7 @@ void TextCtrl::BUILD() {
|
|||
auto temp = new wxTextCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size, style);
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
|
||||
if (! m_opt.multiline)
|
||||
if (! m_opt.multiline && !wxOSX)
|
||||
// Only disable background refresh for single line input fields, as they are completely painted over by the edit control.
|
||||
// This does not apply to the multi-line edit field, where the last line and a narrow frame around the text is not cleared.
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
|
@ -491,7 +497,7 @@ void CheckBox::BUILD() {
|
|||
// Set Label as a string of at least one space simbol to correct system scaling of a CheckBox
|
||||
auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(" "), wxDefaultPosition, size);
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
temp->SetValue(check_value);
|
||||
if (m_opt.readonly) temp->Disable();
|
||||
|
||||
|
|
@ -601,7 +607,7 @@ void SpinCtrl::BUILD() {
|
|||
auto temp = new wxSpinCtrl(m_parent, wxID_ANY, text_value, wxDefaultPosition, size,
|
||||
0|wxTE_PROCESS_ENTER, min_val, max_val, default_value);
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
// XXX: On OS X the wxSpinCtrl widget is made up of two subwidgets, unfortunatelly
|
||||
// the kill focus event is not propagated to the encompassing widget,
|
||||
|
|
@ -717,7 +723,7 @@ void Choice::BUILD() {
|
|||
}
|
||||
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
// recast as a wxWindow to fit the calling convention
|
||||
window = dynamic_cast<wxWindow*>(temp);
|
||||
|
|
@ -1072,7 +1078,7 @@ void ColourPicker::BUILD()
|
|||
|
||||
auto temp = new wxColourPickerCtrl(m_parent, wxID_ANY, clr, wxDefaultPosition, size);
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
// // recast as a wxWindow to fit the calling convention
|
||||
window = dynamic_cast<wxWindow*>(temp);
|
||||
|
|
|
|||
|
|
@ -2094,20 +2094,6 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||
|
||||
post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS,
|
||||
contained_min_one && !m_model->objects.empty() && state != ModelInstance::PVS_Partly_Outside));
|
||||
|
||||
// #ys_FIXME_delete_after_testing
|
||||
// bool contained = m_volumes.check_outside_state(m_config, &state);
|
||||
// if (!contained)
|
||||
// {
|
||||
// _set_warning_texture(WarningTexture::ObjectOutside, true);
|
||||
// post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, state == ModelInstance::PVS_Fully_Outside));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_volumes.reset_outside_state();
|
||||
// _set_warning_texture(WarningTexture::ObjectOutside, false);
|
||||
// post_event(Event<bool>(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, !m_model->objects.empty()));
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2917,6 +2903,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
volume_bbox.offset(1.0);
|
||||
if (volume_bbox.contains(m_mouse.scene_position))
|
||||
{
|
||||
m_volumes.volumes[volume_idx]->hover = GLVolume::HS_None;
|
||||
// The dragging operation is initiated.
|
||||
m_mouse.drag.move_volume_idx = volume_idx;
|
||||
m_selection.start_dragging();
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ static void register_dpi_event()
|
|||
const auto rect = reinterpret_cast<PRECT>(lParam);
|
||||
const wxRect wxrect(wxPoint(rect->top, rect->left), wxPoint(rect->bottom, rect->right));
|
||||
|
||||
DpiChangedEvent evt(EVT_DPI_CHANGED, dpi, wxrect);
|
||||
DpiChangedEvent evt(EVT_DPI_CHANGED_SLICER, dpi, wxrect);
|
||||
win->GetEventHandler()->AddPendingEvent(evt);
|
||||
|
||||
return true;
|
||||
|
|
@ -1131,8 +1131,11 @@ void GUI_App::gcode_thumbnails_debug()
|
|||
boost::nowide::ofstream out_file(out_filename.c_str(), std::ios::binary);
|
||||
if (out_file.good())
|
||||
{
|
||||
std::string decoded = boost::beast::detail::base64_decode(row);
|
||||
out_file.write(decoded.c_str(), decoded.length());
|
||||
std::string decoded;
|
||||
decoded.resize(boost::beast::detail::base64::decoded_size(row.size()));
|
||||
decoded.resize(boost::beast::detail::base64::decode((void*)&decoded[0], row.data(), row.size()).first);
|
||||
|
||||
out_file.write(decoded.c_str(), decoded.size());
|
||||
out_file.close();
|
||||
}
|
||||
#else
|
||||
|
|
@ -1147,8 +1150,11 @@ void GUI_App::gcode_thumbnails_debug()
|
|||
std::vector<unsigned char> thumbnail(4 * width * height, 0);
|
||||
for (unsigned int r = 0; r < (unsigned int)rows.size(); ++r)
|
||||
{
|
||||
std::string decoded_row = boost::beast::detail::base64_decode(rows[r]);
|
||||
if ((unsigned int)decoded_row.length() == width * 4)
|
||||
std::string decoded_row;
|
||||
decoded_row.resize(boost::beast::detail::base64::decoded_size(rows[r].size()));
|
||||
decoded_row.resize(boost::beast::detail::base64::decode((void*)&decoded_row[0], rows[r].data(), rows[r].size()).first);
|
||||
|
||||
if ((unsigned int)decoded_row.size() == width * 4)
|
||||
{
|
||||
void* image_ptr = (void*)(thumbnail.data() + r * width * 4);
|
||||
::memcpy(image_ptr, (const void*)decoded_row.c_str(), width * 4);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static wxBitmapComboBox* create_word_local_combo(wxWindow *parent)
|
|||
#endif //__WXOSX__
|
||||
|
||||
temp->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
if (!wxOSX) temp->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
|
||||
temp->Append(_(L("World coordinates")));
|
||||
temp->Append(_(L("Local coordinates")));
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ void on_window_geometry(wxTopLevelWindow *tlw, std::function<void()> callback)
|
|||
#endif
|
||||
}
|
||||
|
||||
wxDEFINE_EVENT(EVT_DPI_CHANGED, DpiChangedEvent);
|
||||
wxDEFINE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
|
||||
|
||||
#ifdef _WIN32
|
||||
template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const char *fn_name) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct DpiChangedEvent : public wxEvent {
|
|||
}
|
||||
};
|
||||
|
||||
wxDECLARE_EVENT(EVT_DPI_CHANGED, DpiChangedEvent);
|
||||
wxDECLARE_EVENT(EVT_DPI_CHANGED_SLICER, DpiChangedEvent);
|
||||
|
||||
template<class P> class DPIAware : public P
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
// recalc_font();
|
||||
|
||||
this->Bind(EVT_DPI_CHANGED, [this](const DpiChangedEvent &evt) {
|
||||
this->Bind(EVT_DPI_CHANGED_SLICER, [this](const DpiChangedEvent &evt) {
|
||||
m_scale_factor = (float)evt.dpi / (float)DPI_DEFAULT;
|
||||
|
||||
m_new_font_point_size = get_default_font_for_dpi(evt.dpi).GetPointSize();
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public:
|
|||
staticbox(title!=""), extra_column(extra_clmn) {
|
||||
if (staticbox) {
|
||||
stb = new wxStaticBox(_parent, wxID_ANY, title);
|
||||
stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
stb->SetFont(wxGetApp().bold_font());
|
||||
} else
|
||||
stb = nullptr;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@
|
|||
#include "../Utils/PrintHost.hpp"
|
||||
#include "../Utils/FixModelByWin10.hpp"
|
||||
#include "../Utils/UndoRedo.hpp"
|
||||
#include "../Utils/Thread.hpp"
|
||||
|
||||
#include <wx/glcanvas.h> // Needs to be last because reasons :-/
|
||||
#include "WipeTowerDialog.hpp"
|
||||
|
|
@ -87,8 +88,6 @@ using Slic3r::Preset;
|
|||
using Slic3r::PrintHostJob;
|
||||
|
||||
#if ENABLE_THUMBNAIL_GENERATOR
|
||||
static const std::vector < std::pair<unsigned int, unsigned int>> THUMBNAIL_SIZE_FFF = { { 240, 320 }, { 220, 165 }, { 16, 16 } };
|
||||
static const std::vector<std::pair<unsigned int, unsigned int>> THUMBNAIL_SIZE_SLA = { { 800, 480 } };
|
||||
static const std::pair<unsigned int, unsigned int> THUMBNAIL_SIZE_3MF = { 256, 256 };
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
|
||||
|
|
@ -231,7 +230,7 @@ SlicedInfo::SlicedInfo(wxWindow *parent) :
|
|||
init_info_label(_(L("Used Filament (mm³)")));
|
||||
init_info_label(_(L("Used Filament (g)")));
|
||||
init_info_label(_(L("Used Material (unit)")));
|
||||
init_info_label(_(L("Cost")));
|
||||
init_info_label(_(L("Cost (money)")));
|
||||
init_info_label(_(L("Estimated printing time")));
|
||||
init_info_label(_(L("Number of tool changes")));
|
||||
|
||||
|
|
@ -1129,12 +1128,10 @@ void Sidebar::show_info_sizer()
|
|||
}
|
||||
}
|
||||
|
||||
void Sidebar::show_sliced_info_sizer(const bool show)
|
||||
void Sidebar::update_sliced_info_sizer()
|
||||
{
|
||||
wxWindowUpdateLocker freeze_guard(this);
|
||||
|
||||
p->sliced_info->Show(show);
|
||||
if (show) {
|
||||
if (p->sliced_info->IsShown(size_t(0)))
|
||||
{
|
||||
if (p->plater->printer_technology() == ptSLA)
|
||||
{
|
||||
const SLAPrintStatistics& ps = p->plater->sla_print().print_statistics();
|
||||
|
|
@ -1150,7 +1147,18 @@ void Sidebar::show_sliced_info_sizer(const bool show)
|
|||
wxString::Format("%.2f", (ps.objects_used_material + ps.support_used_material) / 1000);
|
||||
p->sliced_info->SetTextAndShow(siMateril_unit, info_text, new_label);
|
||||
|
||||
p->sliced_info->SetTextAndShow(siCost, "N/A"/*wxString::Format("%.2f", ps.total_cost)*/);
|
||||
wxString str_total_cost = "N/A";
|
||||
|
||||
DynamicPrintConfig* cfg = wxGetApp().get_tab(Preset::TYPE_SLA_MATERIAL)->get_config();
|
||||
if (cfg->option("bottle_cost")->getFloat() > 0.0 &&
|
||||
cfg->option("bottle_volume")->getFloat() > 0.0)
|
||||
{
|
||||
double material_cost = cfg->option("bottle_cost")->getFloat() /
|
||||
cfg->option("bottle_volume")->getFloat();
|
||||
str_total_cost = wxString::Format("%.2f", material_cost*(ps.objects_used_material + ps.support_used_material) / 1000);
|
||||
}
|
||||
p->sliced_info->SetTextAndShow(siCost, str_total_cost);
|
||||
|
||||
wxString t_est = std::isnan(ps.estimated_print_time) ? "N/A" : get_time_dhms(float(ps.estimated_print_time));
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, t_est, _(L("Estimated printing time")) + " :");
|
||||
|
||||
|
|
@ -1224,6 +1232,15 @@ void Sidebar::show_sliced_info_sizer(const bool show)
|
|||
p->sliced_info->SetTextAndShow(siMateril_unit, "N/A");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sidebar::show_sliced_info_sizer(const bool show)
|
||||
{
|
||||
wxWindowUpdateLocker freeze_guard(this);
|
||||
|
||||
p->sliced_info->Show(show);
|
||||
if (show)
|
||||
update_sliced_info_sizer();
|
||||
|
||||
Layout();
|
||||
p->scrolled->Refresh();
|
||||
|
|
@ -1441,7 +1458,7 @@ struct Plater::priv
|
|||
class Job : public wxEvtHandler
|
||||
{
|
||||
int m_range = 100;
|
||||
std::future<void> m_ftr;
|
||||
boost::thread m_thread;
|
||||
priv * m_plater = nullptr;
|
||||
std::atomic<bool> m_running{false}, m_canceled{false};
|
||||
bool m_finalized = false;
|
||||
|
|
@ -1482,7 +1499,8 @@ struct Plater::priv
|
|||
// Do a full refresh of scene tree, including regenerating
|
||||
// all the GLVolumes. FIXME The update function shall just
|
||||
// reload the modified matrices.
|
||||
if (!was_canceled()) plater().update((unsigned int)UpdateParams::FORCE_FULL_SCREEN_REFRESH);
|
||||
if (!was_canceled())
|
||||
plater().update(unsigned(UpdateParams::FORCE_FULL_SCREEN_REFRESH));
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -1511,9 +1529,9 @@ struct Plater::priv
|
|||
}
|
||||
|
||||
Job(const Job &) = delete;
|
||||
Job(Job &&) = default;
|
||||
Job(Job &&) = delete;
|
||||
Job &operator=(const Job &) = delete;
|
||||
Job &operator=(Job &&) = default;
|
||||
Job &operator=(Job &&) = delete;
|
||||
|
||||
virtual void process() = 0;
|
||||
|
||||
|
|
@ -1537,7 +1555,7 @@ struct Plater::priv
|
|||
wxBeginBusyCursor();
|
||||
|
||||
try { // Execute the job
|
||||
m_ftr = std::async(std::launch::async, &Job::run, this);
|
||||
m_thread = create_thread([this] { this->run(); });
|
||||
} catch (std::exception &) {
|
||||
update_status(status_range(),
|
||||
_(L("ERROR: not enough resources to "
|
||||
|
|
@ -1553,16 +1571,15 @@ struct Plater::priv
|
|||
// returned if the timeout has been reached and the job is still
|
||||
// running. Call cancel() before this fn if you want to explicitly
|
||||
// end the job.
|
||||
bool join(int timeout_ms = 0) const
|
||||
bool join(int timeout_ms = 0)
|
||||
{
|
||||
if (!m_ftr.valid()) return true;
|
||||
|
||||
if (!m_thread.joinable()) return true;
|
||||
|
||||
if (timeout_ms <= 0)
|
||||
m_ftr.wait();
|
||||
else if (m_ftr.wait_for(std::chrono::milliseconds(
|
||||
timeout_ms)) == std::future_status::timeout)
|
||||
m_thread.join();
|
||||
else if (!m_thread.try_join_for(boost::chrono::milliseconds(timeout_ms)))
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3056,14 +3073,16 @@ bool Plater::priv::restart_background_process(unsigned int state)
|
|||
(this->background_process.state() != BackgroundSlicingProcess::STATE_RUNNING))
|
||||
{
|
||||
// update thumbnail data
|
||||
const std::vector<Vec2d> &thumbnail_sizes = this->background_process.current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values;
|
||||
if (this->printer_technology == ptFFF)
|
||||
{
|
||||
// for ptFFF we need to generate the thumbnails before the export of gcode starts
|
||||
this->thumbnail_data.clear();
|
||||
for (const std::pair<unsigned int, unsigned int>& size : THUMBNAIL_SIZE_FFF)
|
||||
for (const Vec2d &sized : thumbnail_sizes)
|
||||
{
|
||||
this->thumbnail_data.push_back(ThumbnailData());
|
||||
generate_thumbnail(this->thumbnail_data.back(), size.first, size.second, true, true, false);
|
||||
Point size(sized); // round to ints
|
||||
generate_thumbnail(this->thumbnail_data.back(), size.x(), size.y(), true, true, false);
|
||||
}
|
||||
}
|
||||
else if (this->printer_technology == ptSLA)
|
||||
|
|
@ -3071,10 +3090,11 @@ bool Plater::priv::restart_background_process(unsigned int state)
|
|||
// for ptSLA generate thumbnails without supports and pad (not yet calculated)
|
||||
// to render also supports and pad see on_slicing_update()
|
||||
this->thumbnail_data.clear();
|
||||
for (const std::pair<unsigned int, unsigned int>& size : THUMBNAIL_SIZE_SLA)
|
||||
for (const Vec2d &sized : thumbnail_sizes)
|
||||
{
|
||||
this->thumbnail_data.push_back(ThumbnailData());
|
||||
generate_thumbnail(this->thumbnail_data.back(), size.first, size.second, true, true, false);
|
||||
Point size(sized); // round to ints
|
||||
generate_thumbnail(this->thumbnail_data.back(), size.x(), size.y(), true, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3426,11 +3446,13 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
|
|||
// for ptSLA generate the thumbnail after supports and pad have been calculated to have them rendered
|
||||
if ((this->printer_technology == ptSLA) && (evt.status.percent == -3))
|
||||
{
|
||||
const std::vector<Vec2d>& thumbnail_sizes = this->background_process.current_print()->full_print_config().option<ConfigOptionPoints>("thumbnails")->values;
|
||||
this->thumbnail_data.clear();
|
||||
for (const std::pair<unsigned int, unsigned int>& size : THUMBNAIL_SIZE_SLA)
|
||||
for (const Vec2d &sized : thumbnail_sizes)
|
||||
{
|
||||
this->thumbnail_data.push_back(ThumbnailData());
|
||||
generate_thumbnail(this->thumbnail_data.back(), size.first, size.second, true, false, false);
|
||||
Point size(sized); // round to ints
|
||||
generate_thumbnail(this->thumbnail_data.back(), size.x(), size.y(), true, false, false);
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_THUMBNAIL_GENERATOR
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public:
|
|||
void update_objects_list_extruder_column(size_t extruders_count);
|
||||
void show_info_sizer();
|
||||
void show_sliced_info_sizer(const bool show);
|
||||
void update_sliced_info_sizer();
|
||||
void enable_buttons(bool enable);
|
||||
void set_btn_label(const ActionButtonType btn_type, const wxString& label) const;
|
||||
bool show_reslice(bool show) const;
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ const std::vector<std::string>& Preset::print_options()
|
|||
"top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "bridge_flow_ratio", "clip_multipart_objects",
|
||||
"elefant_foot_compensation", "xy_size_compensation", "threads", "resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y",
|
||||
"wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_bridging", "single_extruder_multi_material_priming",
|
||||
"compatible_printers", "compatible_printers_condition", "inherits"
|
||||
"wipe_tower_no_sparse_layers", "compatible_printers", "compatible_printers_condition", "inherits"
|
||||
};
|
||||
return s_opts;
|
||||
}
|
||||
|
|
@ -444,7 +444,8 @@ const std::vector<std::string>& Preset::printer_options()
|
|||
"machine_max_acceleration_x", "machine_max_acceleration_y", "machine_max_acceleration_z", "machine_max_acceleration_e",
|
||||
"machine_max_feedrate_x", "machine_max_feedrate_y", "machine_max_feedrate_z", "machine_max_feedrate_e",
|
||||
"machine_min_extruding_rate", "machine_min_travel_rate",
|
||||
"machine_max_jerk_x", "machine_max_jerk_y", "machine_max_jerk_z", "machine_max_jerk_e"
|
||||
"machine_max_jerk_x", "machine_max_jerk_y", "machine_max_jerk_z", "machine_max_jerk_e",
|
||||
"thumbnails"
|
||||
};
|
||||
s_opts.insert(s_opts.end(), Preset::nozzle_options().begin(), Preset::nozzle_options().end());
|
||||
}
|
||||
|
|
@ -513,6 +514,10 @@ const std::vector<std::string>& Preset::sla_material_options()
|
|||
s_opts = {
|
||||
"material_type",
|
||||
"initial_layer_height",
|
||||
"bottle_cost",
|
||||
"bottle_volume",
|
||||
"bottle_weight",
|
||||
"material_density",
|
||||
"exposure_time",
|
||||
"initial_exposure_time",
|
||||
"material_correction",
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ PresetBundle::PresetBundle() :
|
|||
preset.config.optptr("printer_vendor", true);
|
||||
preset.config.optptr("printer_model", true);
|
||||
preset.config.optptr("printer_variant", true);
|
||||
preset.config.optptr("thumbnails", true);
|
||||
if (i == 0) {
|
||||
preset.config.optptr("default_print_profile", true);
|
||||
preset.config.option<ConfigOptionStrings>("default_filament_profile", true)->values = { "" };
|
||||
|
|
|
|||
|
|
@ -1170,6 +1170,7 @@ void TabPrint::build()
|
|||
optgroup->append_single_option_line("wipe_tower_width");
|
||||
optgroup->append_single_option_line("wipe_tower_rotation_angle");
|
||||
optgroup->append_single_option_line("wipe_tower_bridging");
|
||||
optgroup->append_single_option_line("wipe_tower_no_sparse_layers");
|
||||
optgroup->append_single_option_line("single_extruder_multi_material_priming");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Advanced")));
|
||||
|
|
@ -3419,8 +3420,41 @@ void TabSLAMaterial::build()
|
|||
|
||||
auto page = add_options_page(_(L("Material")), "resin");
|
||||
|
||||
auto optgroup = page->new_optgroup(_(L("Layers")));
|
||||
// optgroup->append_single_option_line("layer_height");
|
||||
auto optgroup = page->new_optgroup(_(L("Material")));
|
||||
optgroup->append_single_option_line("bottle_cost");
|
||||
optgroup->append_single_option_line("bottle_volume");
|
||||
optgroup->append_single_option_line("bottle_weight");
|
||||
optgroup->append_single_option_line("material_density");
|
||||
|
||||
optgroup->m_on_change = [this, optgroup](t_config_option_key opt_key, boost::any value)
|
||||
{
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
|
||||
if (opt_key == "bottle_volume") {
|
||||
double new_bottle_weight = boost::any_cast<double>(value)/(new_conf.option("material_density")->getFloat() * 1000);
|
||||
new_conf.set_key_value("bottle_weight", new ConfigOptionFloat(new_bottle_weight));
|
||||
}
|
||||
if (opt_key == "bottle_weight") {
|
||||
double new_bottle_volume = boost::any_cast<double>(value)*(new_conf.option("material_density")->getFloat() * 1000);
|
||||
new_conf.set_key_value("bottle_volume", new ConfigOptionFloat(new_bottle_volume));
|
||||
}
|
||||
if (opt_key == "material_density") {
|
||||
double new_bottle_volume = new_conf.option("bottle_weight")->getFloat() * boost::any_cast<double>(value) * 1000;
|
||||
new_conf.set_key_value("bottle_volume", new ConfigOptionFloat(new_bottle_volume));
|
||||
}
|
||||
|
||||
load_config(new_conf);
|
||||
|
||||
update_dirty();
|
||||
on_value_change(opt_key, value);
|
||||
|
||||
if (opt_key == "bottle_volume" || opt_key == "bottle_cost") {
|
||||
wxGetApp().sidebar().update_sliced_info_sizer();
|
||||
wxGetApp().sidebar().Layout();
|
||||
}
|
||||
};
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Layers")));
|
||||
optgroup->append_single_option_line("initial_layer_height");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Exposure")));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue