From 7d15f94c09990e81b71d12ded41296e810f171b8 Mon Sep 17 00:00:00 2001 From: phkahler <14852918+phkahler@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:23:43 -0500 Subject: [PATCH] Add skewed subtype for extrusion groups. Update the textwindow radio buttons and equation generation. --- src/group.cpp | 6 +++--- src/groupmesh.cpp | 2 +- src/sketch.h | 3 ++- src/textscreens.cpp | 21 +++++++++++++++++++-- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index 8c23b077f..1e9cd8d70 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -500,7 +500,7 @@ 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) { + if(subtype == Subtype::ONE_SIDED || subtype == Subtype::ONE_SKEWED) { ai = 0; af = 2; } else if(subtype == Subtype::TWO_SIDED) { ai = -1; af = 1; @@ -830,10 +830,10 @@ void Group::GenerateEquations(IdList *l) { Minus(Expr::From(h.param(3))->Times(Expr::From(valB))), 6); } } - } else if(type == Type::EXTRUDE) { + } else if(type == Type::EXTRUDE && subtype != Subtype::ONE_SKEWED) { if(predef.entityB != Entity::FREE_IN_3D) { // The extrusion path is locked along a line, normal to the - // specified workplane. + // specified workplane. Don't constrain for skewed extrusions. Entity *w = SK.GetEntity(predef.entityB); ExprVector u = w->Normal()->NormalExprsU(); ExprVector v = w->Normal()->NormalExprsV(); diff --git a/src/groupmesh.cpp b/src/groupmesh.cpp index 719bf7505..b539702eb 100644 --- a/src/groupmesh.cpp +++ b/src/groupmesh.cpp @@ -248,7 +248,7 @@ void Group::GenerateShellAndMesh() { Vector translate = Vector::From(h.param(0), h.param(1), h.param(2)); Vector tbot, ttop; - if(subtype == Subtype::ONE_SIDED) { + if(subtype == Subtype::ONE_SIDED || subtype == Subtype::ONE_SKEWED) { tbot = Vector::From(0, 0, 0); ttop = translate.ScaledBy(2); } else { tbot = translate.ScaledBy(-1); ttop = translate.ScaledBy(1); diff --git a/src/sketch.h b/src/sketch.h index 09bddbdee..cc2ff5711 100644 --- a/src/sketch.h +++ b/src/sketch.h @@ -204,7 +204,8 @@ class Group { //WORKPLANE_BY_FACE = 6004, // For extrudes, translates, and rotates ONE_SIDED = 7000, - TWO_SIDED = 7001 + TWO_SIDED = 7001, + ONE_SKEWED = 7004 }; Group::Subtype subtype; diff --git a/src/textscreens.cpp b/src/textscreens.cpp index c73361f92..42a28d107 100644 --- a/src/textscreens.cpp +++ b/src/textscreens.cpp @@ -228,6 +228,7 @@ void TextWindow::ScreenChangeGroupOption(int link, uint32_t v) { 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 'k': g->skipFirst = true; break; case 'K': g->skipFirst = false; break; @@ -377,14 +378,30 @@ 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); + + if (g->type == Group::Type::EXTRUDE) { + Printf(false, + "%Ba %f%Ls%Fd%s one-sided%E " + "%f%LS%Fd%s two-sided%E " + "%f%Lw%Fd%s skewed%E", + &TextWindow::ScreenChangeGroupOption, + one ? RADIO_TRUE : RADIO_FALSE, + &TextWindow::ScreenChangeGroupOption, + two ? RADIO_TRUE : RADIO_FALSE, + &TextWindow::ScreenChangeGroupOption, + skew ? RADIO_TRUE : RADIO_FALSE); + } else { Printf(false, "%Ba %f%Ls%Fd%s one-sided%E " "%f%LS%Fd%s two-sided%E", &TextWindow::ScreenChangeGroupOption, one ? RADIO_TRUE : RADIO_FALSE, &TextWindow::ScreenChangeGroupOption, - !one ? RADIO_TRUE : RADIO_FALSE); - + two ? RADIO_TRUE : RADIO_FALSE); + } + if(g->type == Group::Type::ROTATE || g->type == Group::Type::TRANSLATE) { if(g->subtype == Group::Subtype::ONE_SIDED) { bool skip = g->skipFirst;