Add faces perpendicular and parallel constraints.

pull/1256/head
phkahler 2022-06-11 20:20:04 -04:00 committed by Paul Kahler
parent 00418824f9
commit 3fe6349563
2 changed files with 21 additions and 2 deletions

View File

@ -721,7 +721,11 @@ void Constraint::MenuConstrain(Command id) {
}
case Command::PARALLEL:
if(gs.vectors == 2 && gs.n == 2) {
if(gs.faces == 2 && gs.n == 2) {
c.type = Type::PARALLEL;
c.entityA = gs.face[0];
c.entityB = gs.face[1];
} else if(gs.vectors == 2 && gs.n == 2) {
c.type = Type::PARALLEL;
c.entityA = gs.vector[0];
c.entityB = gs.vector[1];
@ -765,6 +769,7 @@ void Constraint::MenuConstrain(Command id) {
} else {
Error(_("Bad selection for parallel / tangent constraint. This "
"constraint can apply to:\n\n"
" * two faces\n"
" * two line segments (parallel)\n"
" * a line segment and a normal (parallel)\n"
" * two normals (parallel)\n"
@ -776,13 +781,18 @@ void Constraint::MenuConstrain(Command id) {
break;
case Command::PERPENDICULAR:
if(gs.vectors == 2 && gs.n == 2) {
if(gs.faces == 2 && gs.n == 2) {
c.type = Type::PERPENDICULAR;
c.entityA = gs.face[0];
c.entityB = gs.face[1];
} else if(gs.vectors == 2 && gs.n == 2) {
c.type = Type::PERPENDICULAR;
c.entityA = gs.vector[0];
c.entityB = gs.vector[1];
} else {
Error(_("Bad selection for perpendicular constraint. This "
"constraint can apply to:\n\n"
" * two faces\n"
" * two line segments\n"
" * a line segment and a normal\n"
" * two normals\n"));

View File

@ -26,6 +26,9 @@ bool EntityBase::HasVector() const {
}
ExprVector EntityBase::VectorGetExprsInWorkplane(hEntity wrkpl) const {
if(IsFace()) {
return FaceGetNormalExprs();
}
switch(type) {
case Type::LINE_SEGMENT:
return (SK.GetEntity(point[0])->PointGetExprsInWorkplane(wrkpl)).Minus(
@ -62,6 +65,9 @@ ExprVector EntityBase::VectorGetExprs() const {
}
Vector EntityBase::VectorGetNum() const {
if(IsFace()) {
return FaceGetNormalNum();
}
switch(type) {
case Type::LINE_SEGMENT:
return (SK.GetEntity(point[0])->PointGetNum()).Minus(
@ -79,6 +85,9 @@ Vector EntityBase::VectorGetNum() const {
}
Vector EntityBase::VectorGetRefPoint() const {
if(IsFace()) {
return FaceGetPointNum();
}
switch(type) {
case Type::LINE_SEGMENT:
return ((SK.GetEntity(point[0])->PointGetNum()).Plus(