OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::PhysicalPrinter Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Preset.hpp>

Collaboration diagram for Slic3r::PhysicalPrinter:

Public Member Functions

 PhysicalPrinter (const std::string &name, const DynamicPrintConfig &default_config)
 PhysicalPrinter (const std::string &name, const DynamicPrintConfig &default_config, const Preset &preset)
void set_name (const std::string &name)
const std::set< std::string > & get_preset_names () const
void update_preset_names_in_config ()
void save (DynamicPrintConfig *parent_config)
void save (const std::string &file_name_from, const std::string &file_name_to)
void update_from_preset (const Preset &preset)
void update_from_config (const DynamicPrintConfig &new_config)
bool add_preset (const std::string &preset_name)
bool delete_preset (const std::string &preset_name)
void reset_presets ()
PrinterTechnology printer_technology () const
bool operator< (const PhysicalPrinter &other) const
std::string get_full_name (std::string preset_name) const

Static Public Member Functions

static std::string separator ()
static const std::vector< std::string > & printer_options ()
static const std::vector< std::string > & print_host_options ()
static std::vector< std::string > presets_with_print_host_information (const PrinterPresetCollection &printer_presets)
static bool has_print_host_information (const DynamicPrintConfig &config)
static PrinterTechnology printer_technology (const DynamicPrintConfig &cfg)
static std::string get_short_name (std::string full_name)
static std::string get_preset_name (std::string full_name)

Public Attributes

std::string name
std::string file
DynamicPrintConfig config
std::set< std::string > preset_names
bool loaded = false

Friends

class PhysicalPrinterCollection

Detailed Description

Constructor & Destructor Documentation

◆ PhysicalPrinter() [1/2]

Slic3r::PhysicalPrinter::PhysicalPrinter ( const std::string & name,
const DynamicPrintConfig & default_config )
4677 :
4678 name(name), config(default_config)
4679{
4681}
void update_from_config(const DynamicPrintConfig &new_config)
Definition Preset.cpp:4646
std::string name
Definition Preset.hpp:1156
DynamicPrintConfig config
Definition Preset.hpp:1160

References config, name, and update_from_config().

Referenced by operator<().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PhysicalPrinter() [2/2]

Slic3r::PhysicalPrinter::PhysicalPrinter ( const std::string & name,
const DynamicPrintConfig & default_config,
const Preset & preset )
4683 :
4684 name(name), config(default_config)
4685{
4686 update_from_preset(preset);
4687}
void update_from_preset(const Preset &preset)
Definition Preset.cpp:4638

References config, name, and update_from_preset().

Here is the call graph for this function:

Member Function Documentation

◆ add_preset()

bool Slic3r::PhysicalPrinter::add_preset ( const std::string & preset_name)
4668{
4669 return preset_names.emplace(preset_name).second;
4670}
std::set< std::string > preset_names
Definition Preset.hpp:1162

References preset_names.

Referenced by Slic3r::PhysicalPrinterCollection::load_printers_from_presets(), print_host_options(), and Slic3r::GUI::SavePresetDialog::update_physical_printers().

Here is the caller graph for this function:

◆ delete_preset()

bool Slic3r::PhysicalPrinter::delete_preset ( const std::string & preset_name)
4673{
4674 return preset_names.erase(preset_name) > 0;
4675}

References preset_names.

Referenced by Slic3r::GUI::Tab::delete_preset(), print_host_options(), and Slic3r::GUI::SavePresetDialog::update_physical_printers().

Here is the caller graph for this function:

◆ get_full_name()

std::string Slic3r::PhysicalPrinter::get_full_name ( std::string preset_name) const
4695{
4696 return name + separator() + preset_name;
4697}
static std::string separator()
Definition Preset.cpp:4547

References name, and separator().

Referenced by Slic3r::PhysicalPrinterCollection::get_selected_full_printer_name(), and Slic3r::GUI::SavePresetDialog::update_physical_printers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_preset_name()

std::string Slic3r::PhysicalPrinter::get_preset_name ( std::string full_name)
static
4708{
4709 int pos = name.find(separator());
4710 boost::erase_head(name, pos + 3);
4712}
static std::string remove_suffix_modified(const std::string &name)
Definition Preset.cpp:516
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References name, Slic3r::Preset::remove_suffix_modified(), and separator().

Referenced by Slic3r::GUI::Tab::select_preset(), and Slic3r::GUI::TabPresetComboBox::update_dirty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_preset_names()

const std::set< std::string > & Slic3r::PhysicalPrinter::get_preset_names ( ) const
4593{
4594 return preset_names;
4595}

References preset_names.

Referenced by print_host_options().

Here is the caller graph for this function:

◆ get_short_name()

std::string Slic3r::PhysicalPrinter::get_short_name ( std::string full_name)
static
4700{
4701 int pos = full_name.find(separator());
4702 if (pos > 0)
4703 boost::erase_tail(full_name, full_name.length() - pos);
4704 return full_name;
4705}

References separator().

Referenced by Slic3r::PhysicalPrinterCollection::select_printer(), and Slic3r::GUI::TabPresetComboBox::update_dirty().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_print_host_information()

bool Slic3r::PhysicalPrinter::has_print_host_information ( const DynamicPrintConfig & config)
static
4588{
4589 return false;
4590}

References config.

Referenced by presets_with_print_host_information(), and print_host_options().

Here is the caller graph for this function:

◆ operator<()

bool Slic3r::PhysicalPrinter::operator< ( const PhysicalPrinter & other) const
inline
1201{ return this->name < other.name; }

References PhysicalPrinter(), and name.

Here is the call graph for this function:

◆ presets_with_print_host_information()

std::vector< std::string > Slic3r::PhysicalPrinter::presets_with_print_host_information ( const PrinterPresetCollection & printer_presets)
static
4578{
4579 std::vector<std::string> presets;
4580 for (const Preset& preset : printer_presets)
4581 if (has_print_host_information(preset.config))
4582 presets.emplace_back(preset.name);
4583
4584 return presets;
4585}
static bool has_print_host_information(const DynamicPrintConfig &config)
Definition Preset.cpp:4587
@ Preset
Definition calib.hpp:39

References has_print_host_information().

Referenced by Slic3r::GUI::GUI_App::check_printer_presets(), and print_host_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_host_options()

const std::vector< std::string > & Slic3r::PhysicalPrinter::print_host_options ( )
static

References add_preset(), config, delete_preset(), get_preset_names(), has_print_host_information(), presets_with_print_host_information(), reset_presets(), update_from_config(), update_from_preset(), and update_preset_names_in_config().

Here is the call graph for this function:

◆ printer_options()

const std::vector< std::string > & Slic3r::PhysicalPrinter::printer_options ( )
static
4573{
4575}
static std::vector< std::string > s_PhysicalPrinter_opts
Definition Preset.cpp:4552

References Slic3r::s_PhysicalPrinter_opts.

Referenced by update_from_config(), and update_from_preset().

Here is the caller graph for this function:

◆ printer_technology() [1/2]

PrinterTechnology Slic3r::PhysicalPrinter::printer_technology ( ) const
inline
1198{ return printer_technology(this->config); }
PrinterTechnology printer_technology() const
Definition Preset.hpp:1198

References printer_technology().

Referenced by printer_technology().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printer_technology() [2/2]

PrinterTechnology Slic3r::PhysicalPrinter::printer_technology ( const DynamicPrintConfig & cfg)
inlinestatic
1192 {
1193 auto* opt = cfg.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology");
1194 // The following assert may trigger when importing some legacy profile,
1195 // but it is safer to keep it here to capture the cases where the "printer_technology" key is queried, where it should not.
1196 return (opt == nullptr) ? ptFFF : opt->value;
1197 }
@ ptFFF
Definition Config.hpp:231
ConfigOptionEnum< PrinterTechnology >
Definition PrintConfig.hpp:2358

References Slic3r::ConfigBase::option(), and Slic3r::ptFFF.

Here is the call graph for this function:

◆ reset_presets()

void Slic3r::PhysicalPrinter::reset_presets ( )
4663{
4664 return preset_names.clear();
4665}

References preset_names.

Referenced by print_host_options().

Here is the caller graph for this function:

◆ save() [1/2]

void Slic3r::PhysicalPrinter::save ( const std::string & file_name_from,
const std::string & file_name_to )
4627{
4628 InstanceLock instance_lock(user_presets_lock_path());
4629 // rename the file
4630 boost::nowide::rename(file_name_from.data(), file_name_to.data());
4631 this->file = file_name_to;
4632 // save configuration
4633 //BBS: change to save
4634 //this->config.save(this->file);
4635 this->config.save_to_json(this->file, std::string("Physical_Printer"), std::string("User"), std::string(SLIC3R_VERSION));
4636}
std::string file
Definition Preset.hpp:1158
std::string user_presets_lock_path(bool read_only)
Definition Preset.cpp:146

References config, file, and Slic3r::user_presets_lock_path().

Here is the call graph for this function:

◆ save() [2/2]

void Slic3r::PhysicalPrinter::save ( DynamicPrintConfig * parent_config)
4621{
4622 InstanceLock instance_lock(user_presets_lock_path());
4623 this->config.save_to_json(this->file, std::string("Physical_Printer"), std::string("User"), std::string(SLIC3R_VERSION));
4624}

References config, file, and Slic3r::user_presets_lock_path().

Here is the call graph for this function:

◆ separator()

std::string Slic3r::PhysicalPrinter::separator ( )
static
4548{
4549 return " * ";
4550}

Referenced by get_full_name(), get_preset_name(), get_short_name(), Slic3r::PhysicalPrinterCollection::select_printer(), and Slic3r::GUI::TabPresetComboBox::update_dirty().

Here is the caller graph for this function:

◆ set_name()

void Slic3r::PhysicalPrinter::set_name ( const std::string & name)
4690{
4691 this->name = name;
4692}

References name.

◆ update_from_config()

void Slic3r::PhysicalPrinter::update_from_config ( const DynamicPrintConfig & new_config)
4647{
4648 config.apply_only(new_config, printer_options(), false);
4649
4650 const std::vector<std::string>& values = config.option<ConfigOptionStrings>("preset_names")->values;
4651
4652 if (values.empty())
4653 preset_names.clear();
4654 else {
4655 for (const std::string& val : values)
4656 preset_names.emplace(val);
4657 // temporary workaround for compatibility with older Slicer
4659 }
4660}
static const std::vector< std::string > & printer_options()
Definition Preset.cpp:4572
static void update_preset_name_option(const std::set< std::string > &preset_names, DynamicPrintConfig &config)
Definition Preset.cpp:4598

References config, preset_names, printer_options(), and Slic3r::update_preset_name_option().

Referenced by PhysicalPrinter(), and print_host_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_from_preset()

void Slic3r::PhysicalPrinter::update_from_preset ( const Preset & preset)
4639{
4640 config.apply_only(preset.config, printer_options(), true);
4641 // add preset names to the options list
4642 preset_names.emplace(preset.name);
4644}
void update_preset_names_in_config()
Definition Preset.cpp:4607

References config, Slic3r::Preset::config, Slic3r::Preset::name, preset_names, printer_options(), and update_preset_names_in_config().

Referenced by PhysicalPrinter(), and print_host_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_preset_names_in_config()

void Slic3r::PhysicalPrinter::update_preset_names_in_config ( )
4608{
4609 if (!preset_names.empty()) {
4610 std::vector<std::string>& values = config.option<ConfigOptionStrings>("preset_names")->values;
4611 values.clear();
4612 for (auto preset : preset_names)
4613 values.push_back(preset);
4614
4615 // temporary workaround for compatibility with older Slicer
4617 }
4618}

References config, preset_names, and Slic3r::update_preset_name_option().

Referenced by print_host_options(), Slic3r::PhysicalPrinterCollection::save_printer(), and update_from_preset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PhysicalPrinterCollection

friend class PhysicalPrinterCollection
friend

Member Data Documentation

◆ config

◆ file

std::string Slic3r::PhysicalPrinter::file

◆ loaded

bool Slic3r::PhysicalPrinter::loaded = false

◆ name

◆ preset_names


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Preset.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Preset.cpp