From f4cfb60ab5c8dbacd5aea3c4cd33b7e72422dcfb Mon Sep 17 00:00:00 2001 From: ruevs Date: Fri, 22 Nov 2024 18:19:40 +0200 Subject: [PATCH] Make the "skewed" option for extrusions a check box --- src/group.cpp | 7 ++++--- src/sketch.h | 3 ++- src/textscreens.cpp | 44 +++++++++++++++++++++++++++++++++++++------- 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index 1e9cd8d70..1b00943e2 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -500,9 +500,9 @@ void Group::Generate(IdList *entity, AddParam(param, h.param(1), gn.y); AddParam(param, h.param(2), gn.z); int ai, af; - if(subtype == Subtype::ONE_SIDED || subtype == Subtype::ONE_SKEWED) { + if((subtype == Subtype::ONE_SIDED) || (subtype == Subtype::ONE_SKEWED)) { ai = 0; af = 2; - } else if(subtype == Subtype::TWO_SIDED) { + } else if((subtype == Subtype::TWO_SIDED) || (subtype == Subtype::TWO_SKEWED)) { ai = -1; af = 1; } else ssassert(false, "Unexpected extrusion subtype"); @@ -830,7 +830,8 @@ void Group::GenerateEquations(IdList *l) { Minus(Expr::From(h.param(3))->Times(Expr::From(valB))), 6); } } - } else if(type == Type::EXTRUDE && subtype != Subtype::ONE_SKEWED) { + } else if((type == Type::EXTRUDE) && (subtype != Subtype::ONE_SKEWED) && + (subtype != Subtype::TWO_SKEWED)) { if(predef.entityB != Entity::FREE_IN_3D) { // The extrusion path is locked along a line, normal to the // specified workplane. Don't constrain for skewed extrusions. diff --git a/src/sketch.h b/src/sketch.h index cc2ff5711..7f8684ea4 100644 --- a/src/sketch.h +++ b/src/sketch.h @@ -205,7 +205,8 @@ class Group { // For extrudes, translates, and rotates ONE_SIDED = 7000, TWO_SIDED = 7001, - ONE_SKEWED = 7004 + ONE_SKEWED = 7004, + TWO_SKEWED = 7005 }; Group::Subtype subtype; diff --git a/src/textscreens.cpp b/src/textscreens.cpp index 42a28d107..af2289bef 100644 --- a/src/textscreens.cpp +++ b/src/textscreens.cpp @@ -226,9 +226,36 @@ void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) { Group *g = SK.GetGroup(SS.TW.shown.group); switch(link) { - case 's': g->subtype = Group::Subtype::ONE_SIDED; break; - case 'S': g->subtype = Group::Subtype::TWO_SIDED; break; - case 'w': g->subtype = Group::Subtype::ONE_SKEWED; break; + case 's': + if(g->subtype == Group::Subtype::TWO_SIDED) + g->subtype = Group::Subtype::ONE_SIDED; + if(g->subtype == Group::Subtype::TWO_SKEWED) + g->subtype = Group::Subtype::ONE_SKEWED; + break; + case 'S': + if(g->subtype == Group::Subtype::ONE_SIDED) + g->subtype = Group::Subtype::TWO_SIDED; + if(g->subtype == Group::Subtype::ONE_SKEWED) + g->subtype = Group::Subtype::TWO_SKEWED; + break; + case 'w': + if(g->subtype == Group::Subtype::ONE_SIDED) { + g->subtype = Group::Subtype::ONE_SKEWED; + break; + } + if(g->subtype == Group::Subtype::TWO_SIDED) { + g->subtype = Group::Subtype::TWO_SKEWED; + break; + } + if(g->subtype == Group::Subtype::ONE_SKEWED) { + g->subtype = Group::Subtype::ONE_SIDED; + break; + } + if(g->subtype == Group::Subtype::TWO_SKEWED) { + g->subtype = Group::Subtype::TWO_SIDED; + break; + } + break; case 'k': g->skipFirst = true; break; case 'K': g->skipFirst = false; break; @@ -377,9 +404,12 @@ void TextWindow::ShowGroupInfo() { } Printf(true, " %Ft%s%E", s); - bool one = (g->subtype == Group::Subtype::ONE_SIDED); - bool two = (g->subtype == Group::Subtype::TWO_SIDED); - bool skew = (g->subtype == Group::Subtype::ONE_SKEWED); + bool one = ((g->subtype == Group::Subtype::ONE_SIDED) || + (g->subtype == Group::Subtype::ONE_SKEWED)); + bool two = ((g->subtype == Group::Subtype::TWO_SIDED) || + (g->subtype == Group::Subtype::TWO_SKEWED)); + bool skew = ((g->subtype == Group::Subtype::ONE_SKEWED) || + (g->subtype == Group::Subtype::TWO_SKEWED)); if (g->type == Group::Type::EXTRUDE) { Printf(false, @@ -391,7 +421,7 @@ void TextWindow::ShowGroupInfo() { &TextWindow::ScreenChangeGroupOption, two ? RADIO_TRUE : RADIO_FALSE, &TextWindow::ScreenChangeGroupOption, - skew ? RADIO_TRUE : RADIO_FALSE); + skew ? CHECK_TRUE : CHECK_FALSE); } else { Printf(false, "%Ba %f%Ls%Fd%s one-sided%E "