Allow point-on-face for up to 3 faces at once

pull/1322/head
phkahler 2023-01-02 15:38:25 -05:00 committed by Paul Kahler
parent 3609f8a7e9
commit 3833dd0246
1 changed files with 11 additions and 4 deletions

View File

@ -274,22 +274,29 @@ void Constraint::MenuConstrain(Command id) {
c.type = Type::POINTS_COINCIDENT; c.type = Type::POINTS_COINCIDENT;
c.ptA = gs.point[0]; c.ptA = gs.point[0];
c.ptB = gs.point[1]; c.ptB = gs.point[1];
newcons.push_back(c);
} else if(gs.points == 1 && gs.workplanes == 1 && gs.n == 2) { } else if(gs.points == 1 && gs.workplanes == 1 && gs.n == 2) {
c.type = Type::PT_IN_PLANE; c.type = Type::PT_IN_PLANE;
c.ptA = gs.point[0]; c.ptA = gs.point[0];
c.entityA = gs.entity[0]; c.entityA = gs.entity[0];
newcons.push_back(c);
} else if(gs.points == 1 && gs.lineSegments == 1 && gs.n == 2) { } else if(gs.points == 1 && gs.lineSegments == 1 && gs.n == 2) {
c.type = Type::PT_ON_LINE; c.type = Type::PT_ON_LINE;
c.ptA = gs.point[0]; c.ptA = gs.point[0];
c.entityA = gs.entity[0]; c.entityA = gs.entity[0];
newcons.push_back(c);
} else if(gs.points == 1 && gs.circlesOrArcs == 1 && gs.n == 2) { } else if(gs.points == 1 && gs.circlesOrArcs == 1 && gs.n == 2) {
c.type = Type::PT_ON_CIRCLE; c.type = Type::PT_ON_CIRCLE;
c.ptA = gs.point[0]; c.ptA = gs.point[0];
c.entityA = gs.entity[0]; c.entityA = gs.entity[0];
} else if(gs.points == 1 && gs.faces == 1 && gs.n == 2) { newcons.push_back(c);
} else if(gs.points == 1 && gs.faces >= 1 && gs.n == gs.points+gs.faces) {
c.type = Type::PT_ON_FACE; c.type = Type::PT_ON_FACE;
c.ptA = gs.point[0]; c.ptA = gs.point[0];
c.entityA = gs.face[0]; for (int k=0; k<gs.faces; k++) {
c.entityA = gs.face[k];
newcons.push_back(c);
}
} else { } else {
Error(_("Bad selection for on point / curve / plane constraint. " Error(_("Bad selection for on point / curve / plane constraint. "
"This constraint can apply to:\n\n" "This constraint can apply to:\n\n"
@ -300,8 +307,8 @@ void Constraint::MenuConstrain(Command id) {
" * a point and a plane face (point on face)\n")); " * a point and a plane face (point on face)\n"));
return; return;
} }
AddConstraint(&c); for (auto&& nc : newcons)
newcons.push_back(c); AddConstraint(&nc);
break; break;
case Command::EQUAL: case Command::EQUAL: