From d4e8b95197c1e1a6cecfe0d5ff9765729bb02212 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sun, 17 Dec 2017 14:15:32 +0100 Subject: [PATCH] Sketcher: Support for detecting expressions in constraints --- src/Mod/Sketcher/App/SketchObject.cpp | 9 +++++++++ src/Mod/Sketcher/App/SketchObject.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index dd65c3a281..bd8e4a7878 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -5839,6 +5839,15 @@ int SketchObject::changeConstraintsLocking(bool bLock) return cntSuccess; } +bool SketchObject::constraintHasExpression(int constrid) +{ + App::ObjectIdentifier spath = this->Constraints.createPath(constrid); + + App::PropertyExpressionEngine::ExpressionInfo expr_info = this->getExpression(spath); + + return (expr_info.expression != 0); +} + /*! * \brief SketchObject::port_reversedExternalArcs finds constraints that link to endpoints of external-geometry arcs, diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index cb44ae4eb8..13ad9f4058 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -265,6 +265,8 @@ public: bool isPointOnCurve(int geoIdCurve, double px, double py); double calculateConstraintError(int ConstrId); int changeConstraintsLocking(bool bLock); + /// returns whether a given constraint has an associated expression or not + bool constraintHasExpression(int constrid); ///porting functions int port_reversedExternalArcs(bool justAnalyze);