Skip to content

Commit

Permalink
Make the "skewed" option for extrusions a check box
Browse files Browse the repository at this point in the history
  • Loading branch information
ruevs authored and phkahler committed Nov 26, 2024
1 parent 7d15f94 commit f4cfb60
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,9 @@ void Group::Generate(IdList<Entity,hEntity> *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");

Expand Down Expand Up @@ -830,7 +830,8 @@ void Group::GenerateEquations(IdList<Equation,hEquation> *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.
Expand Down
3 changes: 2 additions & 1 deletion src/sketch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
44 changes: 37 additions & 7 deletions src/textscreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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 "
Expand Down

0 comments on commit f4cfb60

Please sign in to comment.