mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 19:49:03 +08:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer
This commit is contained in:
commit
cc7b0297a0
BIN
resources/icons/printer_placeholder.png
Normal file
BIN
resources/icons/printer_placeholder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
@ -50,6 +50,7 @@ src/slic3r/GUI/ExtruderSequenceDialog.cpp
|
|||||||
src/slic3r/Utils/Duet.cpp
|
src/slic3r/Utils/Duet.cpp
|
||||||
src/slic3r/Utils/OctoPrint.cpp
|
src/slic3r/Utils/OctoPrint.cpp
|
||||||
src/slic3r/Utils/FlashAir.cpp
|
src/slic3r/Utils/FlashAir.cpp
|
||||||
|
src/slic3r/Utils/AstroBox.cpp
|
||||||
src/slic3r/Utils/PresetUpdater.cpp
|
src/slic3r/Utils/PresetUpdater.cpp
|
||||||
src/slic3r/Utils/FixModelByWin10.cpp
|
src/slic3r/Utils/FixModelByWin10.cpp
|
||||||
src/libslic3r/SLA/SLAPad.cpp
|
src/libslic3r/SLA/SLAPad.cpp
|
||||||
|
@ -362,12 +362,11 @@ protected:
|
|||||||
bool m_second_layer_things_done;
|
bool m_second_layer_things_done;
|
||||||
// Index of a last object copy extruded.
|
// Index of a last object copy extruded.
|
||||||
std::pair<const PrintObject*, Point> m_last_obj_copy;
|
std::pair<const PrintObject*, Point> m_last_obj_copy;
|
||||||
/* Extensions for colorprint - now it's not a just color_print_heights,
|
// Extensions for colorprint - now it's not a just color_print_heights,
|
||||||
* there can be some custom gcode.
|
// there can be some custom gcode.
|
||||||
* Updated before the export and erased during the process,
|
// Updated before the export and erased during the process,
|
||||||
* so no toolchange occurs twice.
|
// so no toolchange occurs twice.
|
||||||
* */
|
std::vector<Model::CustomGCode> m_custom_gcode_per_print_z;
|
||||||
std::vector<Model::CustomGCode> m_custom_gcode_per_print_z;
|
|
||||||
|
|
||||||
// Time estimators
|
// Time estimators
|
||||||
GCodeTimeEstimator m_normal_time_estimator;
|
GCodeTimeEstimator m_normal_time_estimator;
|
||||||
|
@ -66,7 +66,7 @@ Model& Model::assign_copy(Model &&rhs)
|
|||||||
rhs.objects.clear();
|
rhs.objects.clear();
|
||||||
|
|
||||||
// copy custom code per height
|
// copy custom code per height
|
||||||
this->custom_gcode_per_print_z = rhs.custom_gcode_per_print_z;
|
this->custom_gcode_per_print_z = std::move(rhs.custom_gcode_per_print_z);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1946,25 +1946,23 @@ extern bool model_has_advanced_features(const Model &model)
|
|||||||
|
|
||||||
extern void update_custom_gcode_per_print_z_from_config(std::vector<Model::CustomGCode>& custom_gcode_per_print_z, DynamicPrintConfig* config)
|
extern void update_custom_gcode_per_print_z_from_config(std::vector<Model::CustomGCode>& custom_gcode_per_print_z, DynamicPrintConfig* config)
|
||||||
{
|
{
|
||||||
if (!config->has("colorprint_heights"))
|
auto *colorprint_heights = config->option<ConfigOptionFloats>("colorprint_heights");
|
||||||
|
if (colorprint_heights == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::vector<std::string>& colors = GCodePreviewData::ColorPrintColors();
|
if (custom_gcode_per_print_z.empty() && ! colorprint_heights->values.empty()) {
|
||||||
|
// Convert the old colorprint_heighs only if there is no equivalent data in a new format.
|
||||||
const auto& colorprint_values = config->option<ConfigOptionFloats>("colorprint_heights")->values;
|
const std::vector<std::string>& colors = GCodePreviewData::ColorPrintColors();
|
||||||
|
const auto& colorprint_values = colorprint_heights->values;
|
||||||
if (!colorprint_values.empty())
|
|
||||||
{
|
|
||||||
custom_gcode_per_print_z.clear();
|
custom_gcode_per_print_z.clear();
|
||||||
custom_gcode_per_print_z.reserve(colorprint_values.size());
|
custom_gcode_per_print_z.reserve(colorprint_values.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto val : colorprint_values)
|
for (auto val : colorprint_values)
|
||||||
custom_gcode_per_print_z.emplace_back(Model::CustomGCode{ val, ColorChangeCode, 1, colors[(++i)%7] });
|
custom_gcode_per_print_z.emplace_back(Model::CustomGCode{ val, ColorChangeCode, 1, colors[(++i)%7] });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There is one and only place this configuration option is used now.
|
// The "colorprint_heights" config value has been deprecated. At this point of time it has been converted
|
||||||
* It wouldn't be used in the future, so erase it.
|
// to a new format and therefore it shall be erased.
|
||||||
* */
|
|
||||||
config->erase("colorprint_heights");
|
config->erase("colorprint_heights");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,21 +755,15 @@ public:
|
|||||||
// Extensions for color print
|
// Extensions for color print
|
||||||
struct CustomGCode
|
struct CustomGCode
|
||||||
{
|
{
|
||||||
bool operator<(const CustomGCode& other) const { return other.print_z > this->print_z; }
|
bool operator<(const CustomGCode& rhs) const { return this->print_z < rhs.print_z; }
|
||||||
bool operator==(const CustomGCode& other) const
|
bool operator==(const CustomGCode& rhs) const
|
||||||
{
|
{
|
||||||
return (other.print_z == this->print_z ) &&
|
return (rhs.print_z == this->print_z ) &&
|
||||||
(other.gcode == this->gcode ) &&
|
(rhs.gcode == this->gcode ) &&
|
||||||
(other.extruder == this->extruder ) &&
|
(rhs.extruder == this->extruder ) &&
|
||||||
(other.color == this->color );
|
(rhs.color == this->color );
|
||||||
}
|
|
||||||
bool operator!=(const CustomGCode& other) const
|
|
||||||
{
|
|
||||||
return (other.print_z != this->print_z ) ||
|
|
||||||
(other.gcode != this->gcode ) ||
|
|
||||||
(other.extruder != this->extruder ) ||
|
|
||||||
(other.color != this->color );
|
|
||||||
}
|
}
|
||||||
|
bool operator!=(const CustomGCode& rhs) const { return ! (*this == rhs); }
|
||||||
|
|
||||||
double print_z;
|
double print_z;
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
@ -880,9 +874,9 @@ extern bool model_volume_list_changed(const ModelObject &model_object_old, const
|
|||||||
extern bool model_has_multi_part_objects(const Model &model);
|
extern bool model_has_multi_part_objects(const Model &model);
|
||||||
// If the model has advanced features, then it cannot be processed in simple mode.
|
// If the model has advanced features, then it cannot be processed in simple mode.
|
||||||
extern bool model_has_advanced_features(const Model &model);
|
extern bool model_has_advanced_features(const Model &model);
|
||||||
/* If loaded configuration has a "colorprint_heights" option (if it was imported from older Slicer),
|
// If loaded configuration has a "colorprint_heights" option (if it was imported from older Slicer),
|
||||||
* then model.custom_gcode_per_print_z should be updated considering this option
|
// and if model.custom_gcode_per_print_z is empty (there is no color print data available in a new format
|
||||||
* */
|
// then model.custom_gcode_per_print_z should be updated considering this option.
|
||||||
extern void update_custom_gcode_per_print_z_from_config(std::vector<Model::CustomGCode>& custom_gcode_per_print_z, DynamicPrintConfig* config);
|
extern void update_custom_gcode_per_print_z_from_config(std::vector<Model::CustomGCode>& custom_gcode_per_print_z, DynamicPrintConfig* config);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -1333,9 +1333,11 @@ void PrintConfigDef::init_fff_params()
|
|||||||
def->enum_values.push_back("octoprint");
|
def->enum_values.push_back("octoprint");
|
||||||
def->enum_values.push_back("duet");
|
def->enum_values.push_back("duet");
|
||||||
def->enum_values.push_back("flashair");
|
def->enum_values.push_back("flashair");
|
||||||
|
def->enum_values.push_back("astrobox");
|
||||||
def->enum_labels.push_back("OctoPrint");
|
def->enum_labels.push_back("OctoPrint");
|
||||||
def->enum_labels.push_back("Duet");
|
def->enum_labels.push_back("Duet");
|
||||||
def->enum_labels.push_back("FlashAir");
|
def->enum_labels.push_back("FlashAir");
|
||||||
|
def->enum_values.push_back("AstroBox");
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));
|
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));
|
||||||
|
|
||||||
@ -3433,7 +3435,8 @@ CLIMiscConfigDef::CLIMiscConfigDef()
|
|||||||
|
|
||||||
def = this->add("loglevel", coInt);
|
def = this->add("loglevel", coInt);
|
||||||
def->label = L("Logging level");
|
def->label = L("Logging level");
|
||||||
def->tooltip = L("Messages with severity lower or eqal to the loglevel will be printed out. 0:trace, 1:debug, 2:info, 3:warning, 4:error, 5:fatal");
|
def->tooltip = L("Sets logging sensitivity. 0:fatal, 1:error, 2:warning, 3:info, 4:debug, 5:trace\n"
|
||||||
|
"For example. loglevel=2 logs fatal, error and warning level messages.");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
|
|
||||||
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(SLIC3R_GUI)
|
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(SLIC3R_GUI)
|
||||||
|
@ -30,7 +30,7 @@ enum GCodeFlavor : unsigned char {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum PrintHostType {
|
enum PrintHostType {
|
||||||
htOctoPrint, htDuet, htFlashAir
|
htOctoPrint, htDuet, htFlashAir, htAstroBox
|
||||||
};
|
};
|
||||||
|
|
||||||
enum InfillPattern {
|
enum InfillPattern {
|
||||||
@ -103,6 +103,7 @@ template<> inline const t_config_enum_values& ConfigOptionEnum<PrintHostType>::g
|
|||||||
keys_map["octoprint"] = htOctoPrint;
|
keys_map["octoprint"] = htOctoPrint;
|
||||||
keys_map["duet"] = htDuet;
|
keys_map["duet"] = htDuet;
|
||||||
keys_map["flashair"] = htFlashAir;
|
keys_map["flashair"] = htFlashAir;
|
||||||
|
keys_map["astrobox"] = htAstroBox;
|
||||||
}
|
}
|
||||||
return keys_map;
|
return keys_map;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,8 @@ set(SLIC3R_GUI_SOURCES
|
|||||||
Utils/Duet.hpp
|
Utils/Duet.hpp
|
||||||
Utils/FlashAir.cpp
|
Utils/FlashAir.cpp
|
||||||
Utils/FlashAir.hpp
|
Utils/FlashAir.hpp
|
||||||
|
Utils/AstroBox.cpp
|
||||||
|
Utils/AstroBox.hpp
|
||||||
Utils/PrintHost.cpp
|
Utils/PrintHost.cpp
|
||||||
Utils/PrintHost.hpp
|
Utils/PrintHost.hpp
|
||||||
Utils/Bonjour.cpp
|
Utils/Bonjour.cpp
|
||||||
|
@ -18,9 +18,9 @@ GUID WceusbshGUID = { 0x25dbce51, 0x6c8f, 0x4a72,
|
|||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
#include <libgen.h>
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <boost/filesystem/convenience.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -239,10 +239,8 @@ void RemovableDriveManager::search_for_drives()
|
|||||||
//search /media/* folder
|
//search /media/* folder
|
||||||
search_path("/media/*", "/media");
|
search_path("/media/*", "/media");
|
||||||
|
|
||||||
/*
|
|
||||||
//search /Volumes/* folder (OSX)
|
//search /Volumes/* folder (OSX)
|
||||||
search_path("/Volumes/*", "/Volumes");
|
//search_path("/Volumes/*", "/Volumes");
|
||||||
*/
|
|
||||||
std::string path(std::getenv("USER"));
|
std::string path(std::getenv("USER"));
|
||||||
std::string pp(path);
|
std::string pp(path);
|
||||||
//std::cout << "user: "<< path << "\n";
|
//std::cout << "user: "<< path << "\n";
|
||||||
@ -321,14 +319,8 @@ void RemovableDriveManager::inspect_file(const std::string &path, const std::str
|
|||||||
uid_t uid = buf.st_uid;
|
uid_t uid = buf.st_uid;
|
||||||
std::string username(std::getenv("USER"));
|
std::string username(std::getenv("USER"));
|
||||||
struct passwd *pw = getpwuid(uid);
|
struct passwd *pw = getpwuid(uid);
|
||||||
if(pw != 0)
|
if (pw != 0 && pw->pw_name == username)
|
||||||
{
|
m_current_drives.push_back(DriveData(boost::filesystem::basename(boost::filesystem::path(path)), path));
|
||||||
if(pw->pw_name == username)
|
|
||||||
{
|
|
||||||
std::string name = basename(path.data());
|
|
||||||
m_current_drives.push_back(DriveData(name,path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
170
src/slic3r/Utils/AstroBox.cpp
Normal file
170
src/slic3r/Utils/AstroBox.cpp
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
#include "AstroBox.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <sstream>
|
||||||
|
#include <exception>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
#include <boost/property_tree/ptree.hpp>
|
||||||
|
#include <boost/property_tree/json_parser.hpp>
|
||||||
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
|
#include <wx/progdlg.h>
|
||||||
|
|
||||||
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
|
#include "slic3r/GUI/I18N.hpp"
|
||||||
|
#include "Http.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace fs = boost::filesystem;
|
||||||
|
namespace pt = boost::property_tree;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
AstroBox::AstroBox(DynamicPrintConfig *config) :
|
||||||
|
host(config->opt_string("print_host")),
|
||||||
|
apikey(config->opt_string("printhost_apikey")),
|
||||||
|
cafile(config->opt_string("printhost_cafile"))
|
||||||
|
{}
|
||||||
|
|
||||||
|
const char* AstroBox::get_name() const { return "AstroBox"; }
|
||||||
|
|
||||||
|
bool AstroBox::test(wxString &msg) const
|
||||||
|
{
|
||||||
|
// Since the request is performed synchronously here,
|
||||||
|
// it is ok to refer to `msg` from within the closure
|
||||||
|
|
||||||
|
const char *name = get_name();
|
||||||
|
|
||||||
|
bool res = true;
|
||||||
|
auto url = make_url("api/version");
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Get version at: %2%") % name % url;
|
||||||
|
|
||||||
|
auto http = Http::get(std::move(url));
|
||||||
|
set_auth(http);
|
||||||
|
http.on_error([&](std::string body, std::string error, unsigned status) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
|
||||||
|
res = false;
|
||||||
|
msg = format_error(body, error, status);
|
||||||
|
})
|
||||||
|
.on_complete([&, this](std::string body, unsigned) {
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got version: %2%") % name % body;
|
||||||
|
|
||||||
|
try {
|
||||||
|
std::stringstream ss(body);
|
||||||
|
pt::ptree ptree;
|
||||||
|
pt::read_json(ss, ptree);
|
||||||
|
|
||||||
|
if (! ptree.get_optional<std::string>("api")) {
|
||||||
|
res = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto text = ptree.get_optional<std::string>("text");
|
||||||
|
res = validate_version_text(text);
|
||||||
|
if (! res) {
|
||||||
|
msg = wxString::Format(_(L("Mismatched type of print host: %s")), text ? *text : "AstroBox");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const std::exception &) {
|
||||||
|
res = false;
|
||||||
|
msg = "Could not parse server response";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.perform_sync();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString AstroBox::get_test_ok_msg () const
|
||||||
|
{
|
||||||
|
return _(L("Connection to AstroBox works correctly."));
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString AstroBox::get_test_failed_msg (wxString &msg) const
|
||||||
|
{
|
||||||
|
return wxString::Format("%s: %s\n\n%s",
|
||||||
|
_(L("Could not connect to AstroBox")), msg, _(L("Note: AstroBox version at least 1.1.0 is required.")));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AstroBox::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||||
|
{
|
||||||
|
const char *name = get_name();
|
||||||
|
|
||||||
|
const auto upload_filename = upload_data.upload_path.filename();
|
||||||
|
const auto upload_parent_path = upload_data.upload_path.parent_path();
|
||||||
|
|
||||||
|
wxString test_msg;
|
||||||
|
if (! test(test_msg)) {
|
||||||
|
error_fn(std::move(test_msg));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool res = true;
|
||||||
|
|
||||||
|
auto url = make_url("api/files/local");
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Uploading file %2% at %3%, filename: %4%, path: %5%, print: %6%")
|
||||||
|
% name
|
||||||
|
% upload_data.source_path
|
||||||
|
% url
|
||||||
|
% upload_filename.string()
|
||||||
|
% upload_parent_path.string()
|
||||||
|
% upload_data.start_print;
|
||||||
|
|
||||||
|
auto http = Http::post(std::move(url));
|
||||||
|
set_auth(http);
|
||||||
|
http.form_add("print", upload_data.start_print ? "true" : "false")
|
||||||
|
.form_add("path", upload_parent_path.string()) // XXX: slashes on windows ???
|
||||||
|
.form_add_file("file", upload_data.source_path.string(), upload_filename.string())
|
||||||
|
.on_complete([&](std::string body, unsigned status) {
|
||||||
|
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body;
|
||||||
|
})
|
||||||
|
.on_error([&](std::string body, std::string error, unsigned status) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error uploading file: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
|
||||||
|
error_fn(format_error(body, error, status));
|
||||||
|
res = false;
|
||||||
|
})
|
||||||
|
.on_progress([&](Http::Progress progress, bool &cancel) {
|
||||||
|
prorgess_fn(std::move(progress), cancel);
|
||||||
|
if (cancel) {
|
||||||
|
// Upload was canceled
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "AstroBox: Upload canceled";
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.perform_sync();
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AstroBox::validate_version_text(const boost::optional<std::string> &version_text) const
|
||||||
|
{
|
||||||
|
return version_text ? boost::starts_with(*version_text, "AstroBox") : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AstroBox::set_auth(Http &http) const
|
||||||
|
{
|
||||||
|
http.header("X-Api-Key", apikey);
|
||||||
|
|
||||||
|
if (! cafile.empty()) {
|
||||||
|
http.ca_file(cafile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AstroBox::make_url(const std::string &path) const
|
||||||
|
{
|
||||||
|
if (host.find("http://") == 0 || host.find("https://") == 0) {
|
||||||
|
if (host.back() == '/') {
|
||||||
|
return (boost::format("%1%%2%") % host % path).str();
|
||||||
|
} else {
|
||||||
|
return (boost::format("%1%/%2%") % host % path).str();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (boost::format("http://%1%/%2%") % host % path).str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
46
src/slic3r/Utils/AstroBox.hpp
Normal file
46
src/slic3r/Utils/AstroBox.hpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#ifndef slic3r_AstroBox_hpp_
|
||||||
|
#define slic3r_AstroBox_hpp_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
|
#include "PrintHost.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
|
||||||
|
class DynamicPrintConfig;
|
||||||
|
class Http;
|
||||||
|
|
||||||
|
class AstroBox : public PrintHost
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AstroBox(DynamicPrintConfig *config);
|
||||||
|
~AstroBox() override = default;
|
||||||
|
|
||||||
|
const char* get_name() const override;
|
||||||
|
|
||||||
|
bool test(wxString &curl_msg) const override;
|
||||||
|
wxString get_test_ok_msg () const override;
|
||||||
|
wxString get_test_failed_msg (wxString &msg) const override;
|
||||||
|
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const override;
|
||||||
|
bool has_auto_discovery() const override { return true; }
|
||||||
|
bool can_test() const override { return true; }
|
||||||
|
bool can_start_print() const override { return true; }
|
||||||
|
std::string get_host() const override { return host; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool validate_version_text(const boost::optional<std::string> &version_text) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string host;
|
||||||
|
std::string apikey;
|
||||||
|
std::string cafile;
|
||||||
|
|
||||||
|
void set_auth(Http &http) const;
|
||||||
|
std::string make_url(const std::string &path) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -32,8 +32,6 @@ Duet::Duet(DynamicPrintConfig *config) :
|
|||||||
password(config->opt_string("printhost_apikey"))
|
password(config->opt_string("printhost_apikey"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Duet::~Duet() {}
|
|
||||||
|
|
||||||
const char* Duet::get_name() const { return "Duet"; }
|
const char* Duet::get_name() const { return "Duet"; }
|
||||||
|
|
||||||
bool Duet::test(wxString &msg) const
|
bool Duet::test(wxString &msg) const
|
||||||
@ -111,21 +109,6 @@ bool Duet::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn e
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Duet::has_auto_discovery() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duet::can_test() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duet::can_start_print() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Duet::connect(wxString &msg) const
|
bool Duet::connect(wxString &msg) const
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
@ -6,10 +6,8 @@
|
|||||||
|
|
||||||
#include "PrintHost.hpp"
|
#include "PrintHost.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
|
||||||
class DynamicPrintConfig;
|
class DynamicPrintConfig;
|
||||||
class Http;
|
class Http;
|
||||||
|
|
||||||
@ -17,18 +15,18 @@ class Duet : public PrintHost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Duet(DynamicPrintConfig *config);
|
Duet(DynamicPrintConfig *config);
|
||||||
virtual ~Duet();
|
~Duet() override = default;
|
||||||
|
|
||||||
virtual const char* get_name() const;
|
const char* get_name() const override;
|
||||||
|
|
||||||
virtual bool test(wxString &curl_msg) const;
|
bool test(wxString &curl_msg) const override;
|
||||||
virtual wxString get_test_ok_msg () const;
|
wxString get_test_ok_msg() const override;
|
||||||
virtual wxString get_test_failed_msg (wxString &msg) const;
|
wxString get_test_failed_msg(wxString &msg) const override;
|
||||||
virtual bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const;
|
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const override;
|
||||||
virtual bool has_auto_discovery() const;
|
bool has_auto_discovery() const override { return false; }
|
||||||
virtual bool can_test() const;
|
bool can_test() const override { return true; }
|
||||||
virtual bool can_start_print() const;
|
bool can_start_print() const override { return true; }
|
||||||
virtual std::string get_host() const { return host; }
|
std::string get_host() const override { return host; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string host;
|
std::string host;
|
||||||
@ -44,7 +42,6 @@ private:
|
|||||||
int get_err_code_from_body(const std::string &body) const;
|
int get_err_code_from_body(const std::string &body) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,8 +30,6 @@ FlashAir::FlashAir(DynamicPrintConfig *config) :
|
|||||||
host(config->opt_string("print_host"))
|
host(config->opt_string("print_host"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
FlashAir::~FlashAir() {}
|
|
||||||
|
|
||||||
const char* FlashAir::get_name() const { return "FlashAir"; }
|
const char* FlashAir::get_name() const { return "FlashAir"; }
|
||||||
|
|
||||||
bool FlashAir::test(wxString &msg) const
|
bool FlashAir::test(wxString &msg) const
|
||||||
@ -150,21 +148,6 @@ bool FlashAir::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Error
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlashAir::has_auto_discovery() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FlashAir::can_test() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FlashAir::can_start_print() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string FlashAir::timestamp_str() const
|
std::string FlashAir::timestamp_str() const
|
||||||
{
|
{
|
||||||
auto t = std::time(nullptr);
|
auto t = std::time(nullptr);
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
|
||||||
class DynamicPrintConfig;
|
class DynamicPrintConfig;
|
||||||
class Http;
|
class Http;
|
||||||
|
|
||||||
@ -17,18 +16,18 @@ class FlashAir : public PrintHost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FlashAir(DynamicPrintConfig *config);
|
FlashAir(DynamicPrintConfig *config);
|
||||||
virtual ~FlashAir();
|
~FlashAir() override = default;
|
||||||
|
|
||||||
virtual const char* get_name() const;
|
const char* get_name() const override;
|
||||||
|
|
||||||
virtual bool test(wxString &curl_msg) const;
|
bool test(wxString &curl_msg) const override;
|
||||||
virtual wxString get_test_ok_msg () const;
|
wxString get_test_ok_msg() const override;
|
||||||
virtual wxString get_test_failed_msg (wxString &msg) const;
|
wxString get_test_failed_msg(wxString &msg) const override;
|
||||||
virtual bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const;
|
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const override;
|
||||||
virtual bool has_auto_discovery() const;
|
bool has_auto_discovery() const override { return false; }
|
||||||
virtual bool can_test() const;
|
bool can_test() const override { return true; }
|
||||||
virtual bool can_start_print() const;
|
bool can_start_print() const override { return false; }
|
||||||
virtual std::string get_host() const { return host; }
|
std::string get_host() const override { return host; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string host;
|
std::string host;
|
||||||
@ -38,7 +37,6 @@ private:
|
|||||||
std::string make_url(const std::string &path, const std::string &arg, const std::string &val) const;
|
std::string make_url(const std::string &path, const std::string &arg, const std::string &val) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,8 +28,6 @@ OctoPrint::OctoPrint(DynamicPrintConfig *config) :
|
|||||||
cafile(config->opt_string("printhost_cafile"))
|
cafile(config->opt_string("printhost_cafile"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
OctoPrint::~OctoPrint() {}
|
|
||||||
|
|
||||||
const char* OctoPrint::get_name() const { return "OctoPrint"; }
|
const char* OctoPrint::get_name() const { return "OctoPrint"; }
|
||||||
|
|
||||||
bool OctoPrint::test(wxString &msg) const
|
bool OctoPrint::test(wxString &msg) const
|
||||||
@ -142,21 +140,6 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OctoPrint::has_auto_discovery() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OctoPrint::can_test() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OctoPrint::can_start_print() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OctoPrint::validate_version_text(const boost::optional<std::string> &version_text) const
|
bool OctoPrint::validate_version_text(const boost::optional<std::string> &version_text) const
|
||||||
{
|
{
|
||||||
return version_text ? boost::starts_with(*version_text, "OctoPrint") : true;
|
return version_text ? boost::starts_with(*version_text, "OctoPrint") : true;
|
||||||
@ -186,9 +169,6 @@ std::string OctoPrint::make_url(const std::string &path) const
|
|||||||
|
|
||||||
|
|
||||||
// SL1Host
|
// SL1Host
|
||||||
|
|
||||||
SL1Host::~SL1Host() {}
|
|
||||||
|
|
||||||
const char* SL1Host::get_name() const { return "SL1Host"; }
|
const char* SL1Host::get_name() const { return "SL1Host"; }
|
||||||
|
|
||||||
wxString SL1Host::get_test_ok_msg () const
|
wxString SL1Host::get_test_ok_msg () const
|
||||||
@ -201,15 +181,9 @@ wxString SL1Host::get_test_failed_msg (wxString &msg) const
|
|||||||
return wxString::Format("%s: %s", _(L("Could not connect to Prusa SLA")), msg);
|
return wxString::Format("%s: %s", _(L("Could not connect to Prusa SLA")), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SL1Host::can_start_print() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SL1Host::validate_version_text(const boost::optional<std::string> &version_text) const
|
bool SL1Host::validate_version_text(const boost::optional<std::string> &version_text) const
|
||||||
{
|
{
|
||||||
return version_text ? boost::starts_with(*version_text, "Prusa SLA") : false;
|
return version_text ? boost::starts_with(*version_text, "Prusa SLA") : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
|
|
||||||
class DynamicPrintConfig;
|
class DynamicPrintConfig;
|
||||||
class Http;
|
class Http;
|
||||||
|
|
||||||
@ -18,18 +17,18 @@ class OctoPrint : public PrintHost
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OctoPrint(DynamicPrintConfig *config);
|
OctoPrint(DynamicPrintConfig *config);
|
||||||
virtual ~OctoPrint();
|
~OctoPrint() override = default;
|
||||||
|
|
||||||
virtual const char* get_name() const;
|
const char* get_name() const;
|
||||||
|
|
||||||
virtual bool test(wxString &curl_msg) const;
|
bool test(wxString &curl_msg) const override;
|
||||||
virtual wxString get_test_ok_msg () const;
|
wxString get_test_ok_msg () const override;
|
||||||
virtual wxString get_test_failed_msg (wxString &msg) const;
|
wxString get_test_failed_msg (wxString &msg) const override;
|
||||||
virtual bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const;
|
bool upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const override;
|
||||||
virtual bool has_auto_discovery() const;
|
bool has_auto_discovery() const override { return true; }
|
||||||
virtual bool can_test() const;
|
bool can_test() const override { return true; }
|
||||||
virtual bool can_start_print() const;
|
bool can_start_print() const override { return true; }
|
||||||
virtual std::string get_host() const { return host; }
|
std::string get_host() const override { return host; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool validate_version_text(const boost::optional<std::string> &version_text) const;
|
virtual bool validate_version_text(const boost::optional<std::string> &version_text) const;
|
||||||
@ -43,23 +42,22 @@ private:
|
|||||||
std::string make_url(const std::string &path) const;
|
std::string make_url(const std::string &path) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SL1Host: public OctoPrint
|
class SL1Host: public OctoPrint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SL1Host(DynamicPrintConfig *config) : OctoPrint(config) {}
|
SL1Host(DynamicPrintConfig *config) : OctoPrint(config) {}
|
||||||
virtual ~SL1Host();
|
~SL1Host() override = default;
|
||||||
|
|
||||||
virtual const char* get_name() const;
|
const char* get_name() const override;
|
||||||
|
|
||||||
|
wxString get_test_ok_msg() const override;
|
||||||
|
wxString get_test_failed_msg(wxString &msg) const override;
|
||||||
|
bool can_start_print() const override { return false; }
|
||||||
|
|
||||||
virtual wxString get_test_ok_msg () const;
|
|
||||||
virtual wxString get_test_failed_msg (wxString &msg) const;
|
|
||||||
virtual bool can_start_print() const ;
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool validate_version_text(const boost::optional<std::string> &version_text) const;
|
bool validate_version_text(const boost::optional<std::string> &version_text) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "OctoPrint.hpp"
|
#include "OctoPrint.hpp"
|
||||||
#include "Duet.hpp"
|
#include "Duet.hpp"
|
||||||
#include "FlashAir.hpp"
|
#include "FlashAir.hpp"
|
||||||
|
#include "AstroBox.hpp"
|
||||||
#include "../GUI/PrintHostDialogs.hpp"
|
#include "../GUI/PrintHostDialogs.hpp"
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = boost::filesystem;
|
||||||
@ -45,6 +46,7 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config)
|
|||||||
case htOctoPrint: return new OctoPrint(config);
|
case htOctoPrint: return new OctoPrint(config);
|
||||||
case htDuet: return new Duet(config);
|
case htDuet: return new Duet(config);
|
||||||
case htFlashAir: return new FlashAir(config);
|
case htFlashAir: return new FlashAir(config);
|
||||||
|
case htAstroBox: return new AstroBox(config);
|
||||||
default: return nullptr;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
Ref<LayerRegion> add_region(PrintRegion* print_region);
|
Ref<LayerRegion> add_region(PrintRegion* print_region);
|
||||||
|
|
||||||
ExPolygonCollection* slices()
|
ExPolygonCollection* slices()
|
||||||
%code%{ RETVAL = new ExPolygonCollection(THIS->slices); %};
|
%code%{ RETVAL = new ExPolygonCollection(THIS->lslices); %};
|
||||||
|
|
||||||
int ptr()
|
int ptr()
|
||||||
%code%{ RETVAL = (int)(intptr_t)THIS; %};
|
%code%{ RETVAL = (int)(intptr_t)THIS; %};
|
||||||
@ -110,7 +110,7 @@
|
|||||||
Ref<LayerRegion> add_region(PrintRegion* print_region);
|
Ref<LayerRegion> add_region(PrintRegion* print_region);
|
||||||
|
|
||||||
ExPolygonCollection* slices()
|
ExPolygonCollection* slices()
|
||||||
%code%{ RETVAL = new ExPolygonCollection(THIS->slices); %};
|
%code%{ RETVAL = new ExPolygonCollection(THIS->lslices); %};
|
||||||
|
|
||||||
void export_region_slices_to_svg(const char *path);
|
void export_region_slices_to_svg(const char *path);
|
||||||
void export_region_fill_surfaces_to_svg(const char *path);
|
void export_region_fill_surfaces_to_svg(const char *path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user