Support for Vendor / Printer Model specific print bed texture and model.
This commit is contained in:
parent
8559360cf8
commit
70bc392003
3 changed files with 37 additions and 0 deletions
|
@ -341,6 +341,38 @@ void Bed3D::calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox)
|
||||||
printf("Unable to create bed grid lines\n");
|
printf("Unable to create bed grid lines\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const VendorProfile::PrinterModel* system_printer_model(const Preset &preset)
|
||||||
|
{
|
||||||
|
const VendorProfile::PrinterModel *out = nullptr;
|
||||||
|
if (preset.vendor != nullptr) {
|
||||||
|
auto *printer_model = preset.config.opt<ConfigOptionString>("printer_model");
|
||||||
|
if (printer_model != nullptr && ! printer_model->value.empty()) {
|
||||||
|
auto it = std::find_if(preset.vendor->models.begin(), preset.vendor->models.end(), [printer_model](const VendorProfile::PrinterModel &pm) { return pm.id == printer_model->value; });
|
||||||
|
if (it != preset.vendor->models.end())
|
||||||
|
out = &(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string system_print_bed_model(const Preset &preset)
|
||||||
|
{
|
||||||
|
std::string out;
|
||||||
|
const VendorProfile::PrinterModel *pm = system_printer_model(preset);
|
||||||
|
if (pm != nullptr && ! pm->bed_model.empty())
|
||||||
|
out = Slic3r::resources_dir() + "/profiles/" + preset.vendor->id + "/" + pm->bed_model;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string system_print_bed_texture(const Preset &preset)
|
||||||
|
{
|
||||||
|
std::string out;
|
||||||
|
const VendorProfile::PrinterModel *pm = system_printer_model(preset);
|
||||||
|
if (pm != nullptr && ! pm->bed_texture.empty())
|
||||||
|
out = Slic3r::resources_dir() + "/profiles/" + preset.vendor->id + "/" + pm->bed_texture;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
Bed3D::EType Bed3D::detect_type(const Pointfs& shape) const
|
Bed3D::EType Bed3D::detect_type(const Pointfs& shape) const
|
||||||
{
|
{
|
||||||
EType type = Custom;
|
EType type = Custom;
|
||||||
|
|
|
@ -184,6 +184,8 @@ VendorProfile VendorProfile::from_ini(const ptree &tree, const boost::filesystem
|
||||||
} else {
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("Vendor bundle: `%1%`: Malformed variants field: `%2%`") % id % variants_field;
|
BOOST_LOG_TRIVIAL(error) << boost::format("Vendor bundle: `%1%`: Malformed variants field: `%2%`") % id % variants_field;
|
||||||
}
|
}
|
||||||
|
model.bed_model = section.second.get<std::string>("bed_model", "");
|
||||||
|
model.bed_texture = section.second.get<std::string>("bed_texture", "");
|
||||||
if (! model.id.empty() && ! model.variants.empty())
|
if (! model.id.empty() && ! model.variants.empty())
|
||||||
res.models.push_back(std::move(model));
|
res.models.push_back(std::move(model));
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,9 @@ public:
|
||||||
PrinterTechnology technology;
|
PrinterTechnology technology;
|
||||||
std::string family;
|
std::string family;
|
||||||
std::vector<PrinterVariant> variants;
|
std::vector<PrinterVariant> variants;
|
||||||
|
// Vendor & Printer Model specific print bed model & texture.
|
||||||
|
std::string bed_model;
|
||||||
|
std::string bed_texture;
|
||||||
|
|
||||||
PrinterVariant* variant(const std::string &name) {
|
PrinterVariant* variant(const std::string &name) {
|
||||||
for (auto &v : this->variants)
|
for (auto &v : this->variants)
|
||||||
|
|
Loading…
Reference in a new issue