From a32720fe5e394f888c203b268a6325cb216f87b7 Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 3 Mar 2016 12:02:24 +0300 Subject: [PATCH] Incorrect attribute when create arc (issue #1355) Update arguments verification in tangency constraint. --- src/SketchSolver/SketchSolver_ConstraintTangent.cpp | 4 ++-- src/SketchSolver/SketchSolver_Error.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp index 0bd02bf0b..299ed53fa 100644 --- a/src/SketchSolver/SketchSolver_ConstraintTangent.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintTangent.cpp @@ -85,9 +85,9 @@ void SketchSolver_ConstraintTangent::getAttributes( return; } - if (myType != CONSTRAINT_TANGENT_CIRCLE_LINE && + if (myType == CONSTRAINT_TANGENT_ARC_LINE && !hasSingleCoincidence(theAttributes[2], theAttributes[3])) - myErrorMsg = SketchSolver_Error::INCORRECT_ATTRIBUTE(); + myErrorMsg = SketchSolver_Error::TANGENCY_FAILED(); if (isSwap) { EntityWrapperPtr aTemp = theAttributes[2]; diff --git a/src/SketchSolver/SketchSolver_Error.h b/src/SketchSolver/SketchSolver_Error.h index 648a3918f..2e1431454 100644 --- a/src/SketchSolver/SketchSolver_Error.h +++ b/src/SketchSolver/SketchSolver_Error.h @@ -65,6 +65,12 @@ class SketchSolver_Error static const std::string MY_ERROR_VALUE("Entity already fixed"); return MY_ERROR_VALUE; } + /// Tangency constraint has been built with wrong attributes (for example, line and arc have two coincident points) + inline static const std::string& TANGENCY_FAILED() + { + static const std::string MY_ERROR_VALUE("Unable to create tangency constraint on given attributes"); + return MY_ERROR_VALUE; + } /// Crash in SolveSpace inline static const std::string& SOLVESPACE_CRASH() { -- 2.39.2