Integrated SLAPrint into background processing.

Fixed couple of compiler warnings.
This commit is contained in:
bubnikv 2018-11-08 20:18:40 +01:00
parent 811404d97a
commit bbfbe88a5f
24 changed files with 283 additions and 89 deletions

View file

@ -136,6 +136,8 @@ add_library(libslic3r STATIC
PrintRegion.cpp
Rasterizer/Rasterizer.hpp
Rasterizer/Rasterizer.cpp
SLAPrint.cpp
SLAPrint.hpp
Slicing.cpp
Slicing.hpp
SlicingAdaptive.cpp

View file

@ -763,7 +763,7 @@ public:
}
//FIXME this smells, the parent class has the method declared returning (unsigned char&).
bool get_at(size_t i) const { return bool((i < this->values.size()) ? this->values[i] : this->values.front()); }
bool get_at(size_t i) const { return ((i < this->values.size()) ? this->values[i] : this->values.front()) != 0; }
std::string serialize() const override
{
@ -1272,6 +1272,9 @@ public:
int& opt_int(const t_config_option_key &opt_key, unsigned int idx) { return this->option<ConfigOptionInts>(opt_key)->get_at(idx); }
const int opt_int(const t_config_option_key &opt_key, unsigned int idx) const { return dynamic_cast<const ConfigOptionInts*>(this->option(opt_key))->get_at(idx); }
template<typename ENUM>
ENUM opt_enum(const t_config_option_key &opt_key) const { return (ENUM)dynamic_cast<const ConfigOptionEnumGeneric*>(this->option(opt_key))->value; }
bool opt_bool(const t_config_option_key &opt_key) const { return this->option<ConfigOptionBool>(opt_key)->value != 0; }
bool opt_bool(const t_config_option_key &opt_key, unsigned int idx) const { return this->option<ConfigOptionBools>(opt_key)->get_at(idx) != 0; }

View file

@ -301,7 +301,7 @@ unsigned int Model::update_print_volume_state(const BoundingBoxf3 &print_volume)
return num_printable;
}
void Model::center_instances_around_point(const Vec2d &point)
bool Model::center_instances_around_point(const Vec2d &point)
{
BoundingBoxf3 bb;
for (ModelObject *o : this->objects)
@ -309,12 +309,17 @@ void Model::center_instances_around_point(const Vec2d &point)
bb.merge(o->instance_bounding_box(i, false));
Vec2d shift2 = point - to_2d(bb.center());
Vec3d shift3 = Vec3d(shift2(0), shift2(1), 0.0);
for (ModelObject *o : this->objects) {
for (ModelInstance *i : o->instances)
i->set_offset(i->get_offset() + shift3);
o->invalidate_bounding_box();
}
if (std::abs(shift2(0)) < EPSILON && std::abs(shift2(1)) < EPSILON)
// No significant shift, don't do anything.
return false;
Vec3d shift3 = Vec3d(shift2(0), shift2(1), 0.0);
for (ModelObject *o : this->objects) {
for (ModelInstance *i : o->instances)
i->set_offset(i->get_offset() + shift3);
o->invalidate_bounding_box();
}
return true;
}
// flattens everything to a single mesh

View file

@ -622,7 +622,8 @@ public:
// Set the print_volume_state of PrintObject::instances,
// return total number of printable objects.
unsigned int update_print_volume_state(const BoundingBoxf3 &print_volume);
void center_instances_around_point(const Vec2d &point);
// Returns true if any ModelObject was modified.
bool center_instances_around_point(const Vec2d &point);
void translate(coordf_t x, coordf_t y, coordf_t z) { for (ModelObject *o : this->objects) o->translate(x, y, z); }
TriangleMesh mesh() const;
bool arrange_objects(coordf_t dist, const BoundingBoxf* bb = NULL);

View file

@ -287,6 +287,7 @@ public:
// In case the following methods need to modify data processed by process() or export_gcode(),
// a cancellation callback is executed to stop the background processing before the operation.
void clear() override;
bool empty() const override { return m_objects.empty(); }
ApplyStatus apply(const Model &model, const DynamicPrintConfig &config) override;
@ -295,7 +296,7 @@ public:
void add_model_object(ModelObject* model_object, int idx = -1);
bool apply_config(DynamicPrintConfig config);
void process();
void process() override;
void export_gcode(const std::string &path_template, GCodePreviewData *preview_data);
// SLA export, temporary.
void export_png(const std::string &dirpath);
@ -309,7 +310,7 @@ public:
float get_wipe_tower_depth() const { return m_wipe_tower_data.depth; }
// Returns an empty string if valid, otherwise returns an error message.
std::string validate() const;
std::string validate() const override;
BoundingBox bounding_box() const;
BoundingBox total_bounding_box() const;
double skirt_first_layer_height() const;

View file

@ -162,6 +162,12 @@ public:
// Reset the print status including the copy of the Model / ModelObject hierarchy.
virtual void clear() = 0;
// The Print is empty either after clear() or after apply() over an empty model,
// or after apply() over a model, where no object is printable (all outside the print volume).
virtual bool empty() const = 0;
// Validate the print, return empty string if valid, return error if process() cannot (or should not) be started.
virtual std::string validate() const { return std::string(); }
enum ApplyStatus {
// No change after the Print::apply() call.

View file

@ -2561,10 +2561,20 @@ void DynamicPrintConfig::normalize()
std::string DynamicPrintConfig::validate()
{
// Full print config is initialized from the defaults.
FullPrintConfig fpc;
fpc.apply(*this, true);
// Verify this print options through the FullPrintConfig.
return fpc.validate();
const ConfigOption *opt = this->option("printer_technology", false);
auto printer_technology = (opt == nullptr) ? ptFFF : static_cast<PrinterTechnology>(dynamic_cast<const ConfigOptionEnumGeneric*>(opt)->value);
switch (printer_technology) {
case ptFFF:
{
FullPrintConfig fpc;
fpc.apply(*this, true);
// Verify this print options through the FullPrintConfig.
return fpc.validate();
}
default:
//FIXME no validation on SLA data?
return std::string();
}
}
double PrintConfig::min_object_distance() const

View file

@ -0,0 +1,18 @@
#include "SLAPrint.hpp"
namespace Slic3r {
void SLAPrint::clear()
{
}
SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, const DynamicPrintConfig &config)
{
return APPLY_STATUS_INVALIDATED;
}
void SLAPrint::process()
{
}
} // namespace Slic3r

View file

@ -0,0 +1,88 @@
#ifndef slic3r_SLAPrint_hpp_
#define slic3r_SLAPrint_hpp_
#include "PrintBase.hpp"
#include "Point.hpp"
//#include "SLA/SLASupportTree.hpp"
namespace Slic3r {
enum SLAPrintStep {
// slapsSliceModel,
// slapsSliceSupports,
slapsRasterize,
slapsCount
};
enum SLAPrintObjectStep {
slaposSupportPoints,
slaposSupportTree,
slaposBasePool,
slaposCount
};
class SLAPrint;
class SLAPrintObject : public PrintObjectBaseWithState<Print, SLAPrintObjectStep, slaposCount>
{
private: // Prevents erroneous use by other classes.
typedef PrintObjectBaseWithState<Print, SLAPrintObjectStep, slaposCount> Inherited;
public:
private:
// sla::EigenMesh3D emesh;
std::vector<Vec2f> instances;
// Transform3f tr;
// std::unique_ptr<sla::SLASupportTree> support_tree_ptr;
// SlicedSupports slice_cache;
friend SLAPrint;
};
/**
* @brief This class is the high level FSM for the SLA printing process.
*
* It should support the background processing framework and contain the
* metadata for the support geometries and their slicing. It should also
* dispatch the SLA printing configuration values to the appropriate calculation
* steps.
*
* TODO (decide): The last important feature is the support for visualization
* which (at least for now) will be implemented as a method(s) returning the
* triangle meshes or receiving the rendering canvas and drawing on that
* directly.
*
* TODO: This class uses the BackgroundProcess interface to create workers and
* manage input change events. An appropriate implementation can be derived
* from BackgroundSlicingProcess which is now working only with the FDM Print.
*/
class SLAPrint : public PrintBaseWithState<SLAPrintStep, slapsCount>
{
private: // Prevents erroneous use by other classes.
typedef PrintBaseWithState<SLAPrintStep, slapsCount> Inherited;
public:
SLAPrint() {}
virtual ~SLAPrint() { this->clear(); }
PrinterTechnology technology() const noexcept { return ptSLA; }
void clear() override;
bool empty() const override { return false; }
ApplyStatus apply(const Model &model, const DynamicPrintConfig &config) override;
void process() override;
private:
Model m_model;
SLAPrinterConfig m_printer_config;
SLAMaterialConfig m_material_config;
std::vector<SLAPrintObject*> m_objects;
friend SLAPrintObject;
};
} // namespace Slic3r
#endif /* slic3r_SLAPrint_hpp_ */

View file

@ -7,9 +7,10 @@
#include <wx/stdpaths.h>
// Print now includes tbb, and tbb includes Windows. This breaks compilation of wxWidgets if included before wx.
#include "../../libslic3r/Print.hpp"
#include "../../libslic3r/Utils.hpp"
#include "../../libslic3r/GCode/PostProcessor.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/GCode/PostProcessor.hpp"
//#undef NDEBUG
#include <cassert>
@ -35,8 +36,49 @@ BackgroundSlicingProcess::~BackgroundSlicingProcess()
boost::nowide::remove(m_temp_output_path.c_str());
}
void BackgroundSlicingProcess::select_technology(PrinterTechnology tech)
{
if (m_print == nullptr || m_print->technology() != tech) {
if (m_print != nullptr)
this->reset();
switch (tech) {
case ptFFF: m_print = m_fff_print; break;
case ptSLA: m_print = m_sla_print; break;
}
}
assert(m_print != nullptr);
}
// This function may one day be merged into the Print, but historically the print was separated
// from the G-code generator.
void BackgroundSlicingProcess::process_fff()
{
assert(m_print == m_fff_print);
m_print->process();
if (! m_print->canceled()) {
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_sliced_id));
m_fff_print->export_gcode(m_temp_output_path, m_gcode_preview_data);
if (! m_print->canceled() && ! this->is_step_done(bspsGCodeFinalize)) {
this->set_step_started(bspsGCodeFinalize);
if (! m_export_path.empty()) {
//FIXME localize the messages
if (copy_file(m_temp_output_path, m_export_path) != 0)
throw std::runtime_error("Copying of the temporary G-code to the output G-code failed");
m_print->set_status(95, "Running post-processing scripts");
run_post_process_scripts(m_export_path, m_fff_print->config());
m_print->set_status(100, "G-code file exported to " + m_export_path);
} else {
m_print->set_status(100, "Slicing complete");
}
this->set_step_done(bspsGCodeFinalize);
}
}
}
void BackgroundSlicingProcess::thread_proc()
{
assert(m_print != nullptr);
assert(m_print == m_fff_print || m_print == m_sla_print);
std::unique_lock<std::mutex> lck(m_mutex);
// Let the caller know we are ready to run the background processing task.
m_state = STATE_IDLE;
@ -56,25 +98,10 @@ void BackgroundSlicingProcess::thread_proc()
std::string error;
try {
assert(m_print != nullptr);
m_print->process();
if (! m_print->canceled()) {
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_sliced_id));
m_print->export_gcode(m_temp_output_path, m_gcode_preview_data);
if (! m_print->canceled() && ! this->is_step_done(bspsGCodeFinalize)) {
this->set_step_started(bspsGCodeFinalize);
if (! m_export_path.empty()) {
//FIXME localize the messages
if (copy_file(m_temp_output_path, m_export_path) != 0)
throw std::runtime_error("Copying of the temporary G-code to the output G-code failed");
m_print->set_status(95, "Running post-processing scripts");
run_post_process_scripts(m_export_path, m_print->config());
m_print->set_status(100, "G-code file exported to " + m_export_path);
} else {
m_print->set_status(100, "Slicing complete");
}
this->set_step_done(bspsGCodeFinalize);
}
}
switch(m_print->technology()) {
case ptFFF: this->process_fff(); break;
default: m_print->process(); break;
}
} catch (CanceledException & /* ex */) {
// Canceled, this is all right.
assert(m_print->canceled());
@ -133,6 +160,10 @@ void BackgroundSlicingProcess::join_background_thread()
bool BackgroundSlicingProcess::start()
{
if (m_print->empty())
// The print is empty (no object in Model, or all objects are out of the print bed).
return false;
std::unique_lock<std::mutex> lck(m_mutex);
if (m_state == STATE_INITIAL) {
// The worker thread is not running yet. Start it.
@ -183,6 +214,7 @@ bool BackgroundSlicingProcess::reset()
bool stopped = this->stop();
this->reset_export();
m_print->clear();
this->invalidate_all_steps();
return stopped;
}
@ -203,20 +235,18 @@ void BackgroundSlicingProcess::stop_internal()
m_print->set_cancel_callback([](){});
}
// Apply config over the print. Returns false, if the new config values caused any of the already
// processed steps to be invalidated, therefore the task will need to be restarted.
bool BackgroundSlicingProcess::apply_config(const DynamicPrintConfig &config)
std::string BackgroundSlicingProcess::validate()
{
this->stop();
bool invalidated = m_print->apply_config(config);
return invalidated;
assert(m_print != nullptr);
return m_print->validate();
}
// Apply config over the print. Returns false, if the new config values caused any of the already
// processed steps to be invalidated, therefore the task will need to be restarted.
Print::ApplyStatus BackgroundSlicingProcess::apply(const Model &model, const DynamicPrintConfig &config)
{
// this->stop();
assert(m_print != nullptr);
assert(config.opt_enum<PrinterTechnology>("printer_technology") == m_print->technology());
Print::ApplyStatus invalidated = m_print->apply(model, config);
return invalidated;
}

View file

@ -13,6 +13,7 @@ namespace Slic3r {
class DynamicPrintConfig;
class GCodePreviewData;
class Model;
class SLAPrint;
// Print step IDs for keeping track of the print state.
enum BackgroundSlicingProcessStep {
@ -28,7 +29,8 @@ public:
// Stop the background processing and finalize the bacgkround processing thread, remove temp files.
~BackgroundSlicingProcess();
void set_print(Print *print) { m_print = print; }
void set_fff_print(Print *print) { m_fff_print = print; }
void set_sla_print(SLAPrint *print) { m_sla_print = print; }
void set_gcode_preview_data(GCodePreviewData *gpd) { m_gcode_preview_data = gpd; }
// The following wxCommandEvent will be sent to the UI thread / Platter window, when the slicing is finished
// and the background processing will transition into G-code export.
@ -38,6 +40,8 @@ public:
// The wxCommandEvent is sent to the UI thread asynchronously without waiting for the event to be processed.
void set_finished_event(int event_id) { m_event_finished_id = event_id; }
// Activate either m_fff_print or m_sla_print.
void select_technology(PrinterTechnology tech);
// Start the background processing. Returns false if the background processing was already running.
bool start();
// Cancel the background processing. Returns false if the background processing was not running.
@ -47,9 +51,8 @@ public:
// Useful when the Model or configuration is being changed drastically.
bool reset();
// Apply config over the print. Returns false, if the new config values caused any of the already
// processed steps to be invalidated, therefore the task will need to be restarted.
bool apply_config(const DynamicPrintConfig &config);
// Validate the print. Returns an empty string if valid, returns an error message if invalid.
std::string validate();
// Apply config over the print. Returns false, if the new config values caused any of the already
// processed steps to be invalidated, therefore the task will need to be restarted.
Print::ApplyStatus apply(const Model &model, const DynamicPrintConfig &config);
@ -90,7 +93,14 @@ private:
// This function shall not trigger any UI update through the wxWidgets event.
void stop_internal();
Print *m_print = nullptr;
// Helper to wrap the FFF slicing & G-code generation.
void process_fff();
// Currently active print. It is one of m_fff_print and m_sla_print.
PrintBase *m_print = nullptr;
// Non-owned pointers to Print instances.
Print *m_fff_print = nullptr;
SLAPrint *m_sla_print = nullptr;
// Data structure, to which the G-code export writes its annotations.
GCodePreviewData *m_gcode_preview_data = nullptr;
// Temporary G-code, there is one defined for the BackgroundSlicingProcess, differentiated from the other processes by a process ID.

View file

@ -18,8 +18,9 @@
namespace Slic3r {
struct BonjourReplyEvent : public wxEvent
class BonjourReplyEvent : public wxEvent
{
public:
BonjourReply reply;
BonjourReplyEvent(wxEventType eventType, int winid, BonjourReply &&reply) :

View file

@ -193,7 +193,7 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
config.set_key_value(opt_key, new ConfigOptionBool(boost::any_cast<bool>(value)));
break;
case coBools:{
ConfigOptionBools* vec_new = new ConfigOptionBools{ (bool)boost::any_cast<unsigned char>(value) };
ConfigOptionBools* vec_new = new ConfigOptionBools{ boost::any_cast<unsigned char>(value) != 0 };
config.option<ConfigOptionBools>(opt_key)->set_at(vec_new, opt_index, 0);
break;}
case coInt:

View file

@ -92,13 +92,12 @@ bool GUI_App::OnInit()
// Suppress the '- default -' presets.
preset_bundle->set_default_suppressed(app_config->get("no_defaults") == "1");
// eval{
preset_bundle->load_presets(*app_config);
// };
// if ($@) {
// warn $@ . "\n";
// show_error(undef, $@);
// }
try {
preset_bundle->load_presets(*app_config);
} catch (const std::exception & /* ex */) {
// warn $@ . "\n";
// show_error(undef, $@);
}
// Let the libslic3r know the callback, which will translate messages on demand.
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);

View file

@ -100,7 +100,7 @@ boost::optional<WindowMetrics> WindowMetrics::deserialize(const std::string &str
WindowMetrics res;
res.rect = wxRect(metrics[0], metrics[1], metrics[2], metrics[3]);
res.maximized = metrics[4];
res.maximized = metrics[4] != 0;
return res;
}

View file

@ -26,6 +26,7 @@
#include "libslic3r/PrintConfig.hpp"
#include "libslic3r/Model.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "libslic3r/GCode/PreviewData.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Polygon.hpp"
@ -852,6 +853,7 @@ struct Plater::priv
// Data
Slic3r::DynamicPrintConfig *config;
Slic3r::Print print;
Slic3r::SLAPrint sla_print;
Slic3r::Model model;
Slic3r::GCodePreviewData gcode_preview_data;
@ -949,17 +951,19 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) :
"brim_width", "variable_layer_height", "serial_port", "serial_speed", "host_type", "print_host",
"printhost_apikey", "printhost_cafile", "nozzle_diameter", "single_extruder_multi_material",
"wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle",
"extruder_colour", "filament_colour", "max_print_height", "printer_model"
"extruder_colour", "filament_colour", "max_print_height", "printer_model", "printer_technology"
})),
notebook(new wxNotebook(q, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM)),
sidebar(new Sidebar(q)),
canvas3D(GLCanvas3DManager::create_wxglcanvas(notebook))
{
// TODO: background_process.set_print(&slaprint);
background_process.set_print(&print);
background_process.set_fff_print(&print);
background_process.set_sla_print(&sla_print);
background_process.set_gcode_preview_data(&gcode_preview_data);
background_process.set_sliced_event(EVT_SLICING_COMPLETED);
background_process.set_finished_event(EVT_PROCESS_COMPLETED);
// Default printer technology for default config.
background_process.select_technology(wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology());
// Register progress callback from the Print class to the Platter.
print.set_status_callback([this](int percent, const std::string &message) {
wxCommandEvent event(EVT_PROGRESS_BAR);
@ -1516,6 +1520,7 @@ void Plater::priv::schedule_background_process()
void Plater::priv::async_apply_config()
{
DynamicPrintConfig config = wxGetApp().preset_bundle->full_config();
auto printer_technology = config.opt_enum<PrinterTechnology>("printer_technology");
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(config.opt<ConfigOptionPoints>("bed_shape")->values));
BoundingBoxf3 print_volume(unscale(bed_box_2D.min(0), bed_box_2D.min(1), 0.0), unscale(bed_box_2D.max(0), bed_box_2D.max(1), scale_(config.opt_float("max_print_height"))));
// Allow the objects to protrude below the print bed, only the part of the object above the print bed will be sliced.
@ -1536,17 +1541,19 @@ void Plater::priv::async_apply_config()
// Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared.
// Otherwise they will be just refreshed.
this->gcode_preview_data.reset();
if (this->preview != nullptr)
this->preview->reload_print();
// We also need to reload 3D scene because of the wipe tower preview box
if (this->config->opt_bool("wipe_tower")) {
// std::vector<int> selections = this->collect_selections();
// Slic3r::_3DScene::set_objects_selections(this->canvas3D, selections);
// Slic3r::_3DScene::reload_scene(this->canvas3D, 1);
if (printer_technology == ptFFF) {
if (this->preview != nullptr)
this->preview->reload_print();
// We also need to reload 3D scene because of the wipe tower preview box
if (this->config->opt_bool("wipe_tower")) {
// std::vector<int> selections = this->collect_selections();
// Slic3r::_3DScene::set_objects_selections(this->canvas3D, selections);
// Slic3r::_3DScene::reload_scene(this->canvas3D, 1);
}
}
}
if (invalidated != Print::APPLY_STATUS_UNCHANGED && this->get_config("background_processing") == "1" &&
this->print.num_object_instances() > 0 && this->background_process.start())
this->background_process.start())
this->statusbar()->set_cancel_callback([this]() {
this->statusbar()->set_status_text(L("Cancelling"));
this->background_process.stop();
@ -1557,13 +1564,13 @@ void Plater::priv::start_background_process()
{
if (this->background_process.running())
return;
// return if ! @{$self->{objects}} || $self->{background_slicing_process}->running;
// Don't start process thread if Print is not valid.
std::string err = this->q->print().validate();
std::string err = this->background_process.validate();
if (! err.empty()) {
this->statusbar()->set_status_text(err);
} else {
// Copy the names of active presets into the placeholder parser.
//FIXME how to generate a file name for the SLA printers?
wxGetApp().preset_bundle->export_selections(this->q->print().placeholder_parser());
// Start the background process.
this->background_process.start();
@ -2052,7 +2059,7 @@ void Plater::export_gcode(fs::path output_path)
std::string err = wxGetApp().preset_bundle->full_config().validate();
if (err.empty())
err = p->print.validate();
err = p->background_process.validate();
if (! err.empty()) {
// The config is not valid
GUI::show_error(this, _(err));
@ -2198,7 +2205,9 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
bool update_scheduled = false;
for (auto opt_key : p->config->diff(config)) {
p->config->set_key_value(opt_key, config.option(opt_key)->clone());
if (opt_key == "bed_shape") {
if (opt_key == "printer_technology")
p->background_process.select_technology(config.opt_enum<PrinterTechnology>(opt_key));
else if (opt_key == "bed_shape") {
if (p->canvas3D) _3DScene::set_bed_shape(p->canvas3D, p->config->option<ConfigOptionPoints>(opt_key)->values);
if (p->preview) p->preview->set_bed_shape(p->config->option<ConfigOptionPoints>(opt_key)->values);
update_scheduled = true;

View file

@ -1039,7 +1039,7 @@ std::string PresetCollection::path_from_name(const std::string &new_name) const
const Preset& PrinterPresetCollection::default_preset_for(const DynamicPrintConfig &config) const
{
const ConfigOptionEnumGeneric *opt_printer_technology = config.opt<ConfigOptionEnumGeneric>("printer_technology");
return this->default_preset((opt_printer_technology == nullptr || opt_printer_technology->value == 0) ? 0 : 1);
return this->default_preset((opt_printer_technology == nullptr || opt_printer_technology->value == ptFFF) ? 0 : 1);
}
} // namespace Slic3r

View file

@ -524,6 +524,8 @@ DynamicPrintConfig PresetBundle::full_fff_config() const
};
add_if_some_non_empty(std::move(compatible_printers_condition), "compatible_printers_condition_cummulative");
add_if_some_non_empty(std::move(inherits), "inherits_cummulative");
out.option<ConfigOptionEnumGeneric>("printer_technology", true)->value = ptFFF;
return out;
}
@ -566,7 +568,9 @@ DynamicPrintConfig PresetBundle::full_sla_config() const
};
add_if_some_non_empty(std::move(compatible_printers_condition), "compatible_printers_condition_cummulative");
add_if_some_non_empty(std::move(inherits), "inherits_cummulative");
return out;
out.option<ConfigOptionEnumGeneric>("printer_technology", true)->value = ptSLA;
return out;
}
// Load an external config file containing the print, filament and printer presets.

View file

@ -52,7 +52,7 @@ void Chart::draw() {
// draw x-axis:
float last_mark = -10000;
for (float math_x=int(visible_area.m_x*10)/10 ; math_x < (visible_area.m_x+visible_area.m_width) ; math_x+=0.1) {
for (float math_x=int(visible_area.m_x*10)/10 ; math_x < (visible_area.m_x+visible_area.m_width) ; math_x+=0.1f) {
int x = math_to_screen(wxPoint2DDouble(math_x,visible_area.m_y)).x;
int y = m_rect.GetBottom();
if (x-last_mark < 50) continue;

View file

@ -2327,7 +2327,7 @@ void Tab::update_page_tree_visibility()
// Called by the UI combo box when the user switches profiles.
// Select a preset by a name.If !defined(name), then the default preset is selected.
// If the current profile is modified, user is asked to save the changes.
void Tab::select_preset(std::string preset_name /*= ""*/)
void Tab::select_preset(std::string preset_name)
{
// If no name is provided, select the "-- default --" preset.
if (preset_name.empty())

View file

@ -677,7 +677,7 @@ void Bonjour::priv::lookup_perform()
socket.async_receive_from(asio::buffer(buffer, buffer.size()), recv_from, recv_handler);
}
}
} catch (std::exception& e) {
} catch (std::exception& /* e */) {
}
}

View file

@ -4,6 +4,16 @@
# define NOMINMAX
#endif
// Windows Runtime
#include <roapi.h>
// for ComPtr
#include <wrl/client.h>
// from C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/
#include <winrt/robuffer.h>
#include <winrt/windows.storage.provider.h>
#include <winrt/windows.graphics.printing3d.h>
#include "FixModelByWin10.hpp"
#include <atomic>
@ -18,14 +28,6 @@
#include <boost/nowide/convert.hpp>
#include <boost/nowide/cstdio.hpp>
#include <roapi.h>
// for ComPtr
#include <wrl/client.h>
// from C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/
#include <winrt/robuffer.h>
#include <winrt/windows.storage.provider.h>
#include <winrt/windows.graphics.printing3d.h>
#include "libslic3r/Model.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/Format/3mf.hpp"
@ -370,7 +372,7 @@ void fix_model_by_win10_sdk_gui(const ModelObject &model_object, const Print &pr
success = true;
finished = true;
on_progress(L("Model repair finished"), 100);
} catch (RepairCanceledException &ex) {
} catch (RepairCanceledException & /* ex */) {
canceled = true;
finished = true;
on_progress(L("Model repair canceled"), 100);

View file

@ -76,7 +76,7 @@ HexFile::HexFile(fs::path path) :
pt::ptree ptree;
try {
pt::read_ini(header_ini, ptree);
} catch (std::exception &e) {
} catch (std::exception & /* e */) {
return;
}

View file

@ -87,6 +87,11 @@
#include <tbb/parallel_for.h>
#include <tbb/spin_mutex.h>
#ifdef _MSC_VER
// avoid some "macro redefinition" warnings
#include <urlmon.h>
#endif /* _MSC_VER */
#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/bmpbuttn.h>