mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
ENH: support custom the first layer print sequence
Change-Id: I0516948292933fe47d39fb3ae2f7e91473b45b3a (cherry picked from commit 5bbdb28c86509d5f94b5b9c33a0f2e1b2749e94b) (cherry picked from commit 22c6e9f1d2c6f1b86c70827c8bec65a857fe2bc5)
This commit is contained in:
parent
f926f9e00f
commit
f783da81ce
6 changed files with 124 additions and 0 deletions
|
@ -2796,6 +2796,56 @@ int PartPlate::load_pattern_box_data(std::string filename)
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<int> PartPlate::get_first_layer_print_sequence() const
|
||||
{
|
||||
const ConfigOptionInts *op_print_sequence_1st = m_config.option<ConfigOptionInts>("first_layer_print_sequence");
|
||||
if (op_print_sequence_1st)
|
||||
return op_print_sequence_1st->values;
|
||||
else
|
||||
return std::vector<int>();
|
||||
}
|
||||
|
||||
void PartPlate::set_first_layer_print_sequence(const std::vector<int>& sorted_filaments)
|
||||
{
|
||||
if (sorted_filaments.size() > 0) {
|
||||
if (sorted_filaments.size() == 1 && sorted_filaments[0] == 0) {
|
||||
m_config.erase("first_layer_print_sequence");
|
||||
}
|
||||
else {
|
||||
ConfigOptionInts *op_print_sequence_1st = m_config.option<ConfigOptionInts>("first_layer_print_sequence");
|
||||
if (op_print_sequence_1st)
|
||||
op_print_sequence_1st->values = sorted_filaments;
|
||||
else
|
||||
m_config.set_key_value("first_layer_print_sequence", new ConfigOptionInts(sorted_filaments));
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_config.erase("first_layer_print_sequence");
|
||||
}
|
||||
}
|
||||
|
||||
void PartPlate::update_first_layer_print_sequence(size_t filament_nums)
|
||||
{
|
||||
ConfigOptionInts * op_print_sequence_1st = m_config.option<ConfigOptionInts>("first_layer_print_sequence");
|
||||
if (!op_print_sequence_1st) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<int> &print_sequence_1st = op_print_sequence_1st->values;
|
||||
if (print_sequence_1st.size() == 0 || print_sequence_1st[0] == 0)
|
||||
return;
|
||||
|
||||
if (print_sequence_1st.size() > filament_nums) {
|
||||
print_sequence_1st.erase(std::remove_if(print_sequence_1st.begin(), print_sequence_1st.end(), [filament_nums](int n) { return n > filament_nums; }),
|
||||
print_sequence_1st.end());
|
||||
}
|
||||
else if (print_sequence_1st.size() < filament_nums) {
|
||||
for (size_t extruder_id = print_sequence_1st.size(); extruder_id < filament_nums; ++extruder_id) {
|
||||
print_sequence_1st.push_back(extruder_id + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PartPlate::print() const
|
||||
{
|
||||
unsigned int count=0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue