From 0db1f6bacdce9d0625e5e42ff02deaad90de766d Mon Sep 17 00:00:00 2001 From: phkahler <14852918+phkahler@users.noreply.github.com> Date: Mon, 2 Jan 2023 15:00:47 -0500 Subject: [PATCH] Fix H/V constraints on points and allow more than 2 points --- src/constraint.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/constraint.cpp b/src/constraint.cpp index 849ce2d..474a8e7 100644 --- a/src/constraint.cpp +++ b/src/constraint.cpp @@ -599,7 +599,11 @@ void Constraint::MenuConstrain(Command id) { case Command::VERTICAL: case Command::HORIZONTAL: { - hEntity ha, hb; + if(id == Command::HORIZONTAL) { + c.type = Type::HORIZONTAL; + } else { + c.type = Type::VERTICAL; + } if(c.workplane == Entity::FREE_IN_3D) { Error(_("Activate a workplane (with Sketch -> In Workplane) before " "applying a horizontal or vertical constraint.")); @@ -608,19 +612,14 @@ void Constraint::MenuConstrain(Command id) { if(gs.lineSegments > 0 && gs.lineSegments == gs.n) { for (auto enti : gs.entity){ c.entityA = enti; - if(id == Command::HORIZONTAL) { - c.type = Type::HORIZONTAL; - } else { - c.type = Type::VERTICAL; - } newcons.push_back(c); } - Entity *e = SK.GetEntity(c.entityA); - ha = e->point[0]; - hb = e->point[1]; - } else if(gs.points == 2 && gs.n == 2) { - ha = c.ptA = gs.point[0]; - hb = c.ptB = gs.point[1]; + } else if(gs.points >= 2 && gs.n == gs.points) { + c.ptA = gs.point[0]; + for (int k = 1; k