mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -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
a35264e910
commit
79a7201f52
6 changed files with 124 additions and 0 deletions
|
@ -270,6 +270,22 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
|
|||
tool_order.insert(iter, ape.first);
|
||||
}
|
||||
|
||||
const ConfigOptionInts* first_layer_print_sequence_op = print.full_print_config().option<ConfigOptionInts>("first_layer_print_sequence");
|
||||
if (first_layer_print_sequence_op) {
|
||||
const std::vector<int>& print_sequence_1st = first_layer_print_sequence_op->values;
|
||||
if (print_sequence_1st.size() >= tool_order.size()) {
|
||||
std::sort(tool_order.begin(), tool_order.end(), [&print_sequence_1st](int lh, int rh) {
|
||||
auto lh_it = std::find(print_sequence_1st.begin(), print_sequence_1st.end(), lh);
|
||||
auto rh_it = std::find(print_sequence_1st.begin(), print_sequence_1st.end(), rh);
|
||||
|
||||
if (lh_it == print_sequence_1st.end() || rh_it == print_sequence_1st.end())
|
||||
return false;
|
||||
|
||||
return lh_it < rh_it;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return tool_order;
|
||||
}
|
||||
|
||||
|
@ -312,6 +328,22 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
|
|||
tool_order.insert(iter, ape.first);
|
||||
}
|
||||
|
||||
const ConfigOptionInts* first_layer_print_sequence_op = object.print()->full_print_config().option<ConfigOptionInts>("first_layer_print_sequence");
|
||||
if (first_layer_print_sequence_op) {
|
||||
const std::vector<int>& print_sequence_1st = first_layer_print_sequence_op->values;
|
||||
if (print_sequence_1st.size() >= tool_order.size()) {
|
||||
std::sort(tool_order.begin(), tool_order.end(), [&print_sequence_1st](int lh, int rh) {
|
||||
auto lh_it = std::find(print_sequence_1st.begin(), print_sequence_1st.end(), lh);
|
||||
auto rh_it = std::find(print_sequence_1st.begin(), print_sequence_1st.end(), rh);
|
||||
|
||||
if (lh_it == print_sequence_1st.end() || rh_it == print_sequence_1st.end())
|
||||
return false;
|
||||
|
||||
return lh_it < rh_it;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return tool_order;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue