Skip to content

Commit

Permalink
Add skewed subtype for extrusion groups. Update the textwindow radio …
Browse files Browse the repository at this point in the history
…buttons and equation generation.
  • Loading branch information
phkahler committed Nov 26, 2024
1 parent eedfc65 commit 7d15f94
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ 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) {
if(subtype == Subtype::ONE_SIDED || subtype == Subtype::ONE_SKEWED) {
ai = 0; af = 2;
} else if(subtype == Subtype::TWO_SIDED) {
ai = -1; af = 1;
Expand Down Expand Up @@ -830,10 +830,10 @@ void Group::GenerateEquations(IdList<Equation,hEquation> *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();
Expand Down
2 changes: 1 addition & 1 deletion src/groupmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/sketch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
21 changes: 19 additions & 2 deletions src/textscreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7d15f94

Please sign in to comment.