Refactor infill rotation (#10587)

* refactor Infill rotation template

* clean up comments

* set default solid_infill_rotate_template to empty

* Fix an issue that infill_direction solid_infill_direction not working as expected

* update based on feedback
This commit is contained in:
SoftFever
2025-09-02 22:53:56 +08:00
committed by GitHub
parent b100915eba
commit 266bfeb9e2
8 changed files with 300 additions and 253 deletions

View File

@@ -436,15 +436,9 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
string v;
std::smatch match;
string ps = (m_opt.opt_key == "sparse_infill_rotate_template") ?
u8"[SODMR]?[BT][!]?|[SODMR]?[#][\\d]+[!]?|[+\\-]?[\\d.]+[%]?[*]?[\\d]*[SODMR]?[/NnZz$LlUuQq~^|#]?[+\\-]?[\\d.]*[%#\'\"cm]?[m]?[BT]?[!*]?" :
u8"[BT][!]?|[#][\\d]+[!]?|[+\\-]?[\\d.]+[%]?[*]?[\\d]*[/NnZz$LlUuQq~^|#]?[+\\-]?[\\d.]*[%#\'\"cm]?[m]?[BT]?[!*]?" :
u8"[#][\\d]+[!]?|[+\\-]?[\\d.]+[%]?[*]?[\\d]*[/NnZz$LlUuQq~^|#]?[+\\-]?[\\d.]*[%#\'\"cm]?[m]?[!*]?";
//if (m_opt.opt_key == "sparse_infill_rotate_template") {
//string ps = u8"[#][\\d]+[!]?|[+\\-]?[\\d.]+[%]?[*]?[\\d]*[SODMR]?[/NnZz$LlUuQq~^|#]?[+\\-]?[\\d.]*[%#\'\"cm]?[m]?[";
//if (m_opt.opt_key == "sparse_infill_rotate_template") {
// ps = u8"[BT][!]?|" + ps ;
//}
//ps += u8"BT]?[!*]?";
while (std::regex_search(ustr, match, std::regex(ps))) {
for (auto x : match) v += x.str() + ", ";
ustr = match.suffix().str();