mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-06-07 10:29:15 -07:00
GCodeViewer -> Show printbed model and texture for system printers detected when loading gcode files produced by PrusaSlicer
This commit is contained in:
@@ -541,6 +541,10 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||
if (bed_shape != nullptr)
|
||||
m_result.bed_shape = bed_shape->values;
|
||||
|
||||
const ConfigOptionString* printer_settings_id = config.option<ConfigOptionString>("printer_settings_id");
|
||||
if (printer_settings_id != nullptr)
|
||||
m_result.printer_settings_id = printer_settings_id->value;
|
||||
|
||||
const ConfigOptionFloats* filament_diameters = config.option<ConfigOptionFloats>("filament_diameter");
|
||||
if (filament_diameters != nullptr) {
|
||||
for (double diam : filament_diameters->values) {
|
||||
|
||||
@@ -261,6 +261,7 @@ namespace Slic3r {
|
||||
unsigned int id;
|
||||
std::vector<MoveVertex> moves;
|
||||
Pointfs bed_shape;
|
||||
std::string printer_settings_id;
|
||||
std::vector<std::string> extruder_colors;
|
||||
PrintEstimatedTimeStatistics time_statistics;
|
||||
|
||||
|
||||
@@ -1812,6 +1812,26 @@ namespace PresetUtils {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::string system_printer_bed_model(const Preset& preset)
|
||||
{
|
||||
std::string out;
|
||||
const VendorProfile::PrinterModel* pm = PresetUtils::system_printer_model(preset);
|
||||
if (pm != nullptr && !pm->bed_model.empty())
|
||||
out = Slic3r::resources_dir() + "/profiles/" + preset.vendor->id + "/" + pm->bed_model;
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string system_printer_bed_texture(const Preset& preset)
|
||||
{
|
||||
std::string out;
|
||||
const VendorProfile::PrinterModel* pm = PresetUtils::system_printer_model(preset);
|
||||
if (pm != nullptr && !pm->bed_texture.empty())
|
||||
out = Slic3r::resources_dir() + "/profiles/" + preset.vendor->id + "/" + pm->bed_texture;
|
||||
return out;
|
||||
}
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
} // namespace PresetUtils
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -527,6 +527,10 @@ public:
|
||||
namespace PresetUtils {
|
||||
// PrinterModel of a system profile, from which this preset is derived, or null if it is not derived from a system profile.
|
||||
const VendorProfile::PrinterModel* system_printer_model(const Preset &preset);
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
std::string system_printer_bed_model(const Preset& preset);
|
||||
std::string system_printer_bed_texture(const Preset& preset);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
} // namespace PresetUtils
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user