From 703412eb48fcfc53a500ed637e02739d31f991c4 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 24 Jun 2015 16:14:16 +0300 Subject: [PATCH] Make the external sketch segment not-movable by the user --- src/SketchPlugin/SketchPlugin_Arc.cpp | 3 ++- src/SketchPlugin/SketchPlugin_Circle.cpp | 3 ++- src/SketchPlugin/SketchPlugin_Line.cpp | 4 ++-- src/SketchPlugin/SketchPlugin_Point.cpp | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 5599f3b0b..5a922cbd1 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -214,7 +214,8 @@ void SketchPlugin_Arc::attributeChanged(const std::string& theID) GeomDataAPI_Point2D>(data()->attribute(START_ID())); std::shared_ptr anEndAttr = std::dynamic_pointer_cast< GeomDataAPI_Point2D>(data()->attribute(END_ID())); - if (theID == EXTERNAL_ID()) { + // the second condition for unability to move external segments anywhere + if (theID == EXTERNAL_ID() || isFixed()) { std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); // update arguments due to the selection value if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { diff --git a/src/SketchPlugin/SketchPlugin_Circle.cpp b/src/SketchPlugin/SketchPlugin_Circle.cpp index 1b74f50ee..6bbb91c73 100644 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@ -97,7 +97,8 @@ bool SketchPlugin_Circle::isFixed() { } void SketchPlugin_Circle::attributeChanged(const std::string& theID) { - if (theID == EXTERNAL_ID()) { + // the second condition for unability to move external segments anywhere + if (theID == EXTERNAL_ID() || isFixed()) { std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); // update arguments due to the selection value if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { diff --git a/src/SketchPlugin/SketchPlugin_Line.cpp b/src/SketchPlugin/SketchPlugin_Line.cpp index 555b8ae7f..f4382e431 100644 --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@ -111,7 +111,8 @@ bool SketchPlugin_Line::isFixed() { } void SketchPlugin_Line::attributeChanged(const std::string& theID) { - if (theID == EXTERNAL_ID()) { + // the second condition for unability to move external segments anywhere + if (theID == EXTERNAL_ID() || isFixed()) { std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); // update arguments due to the selection value if (aSelection && !aSelection->isNull() && aSelection->isEdge()) { @@ -125,4 +126,3 @@ void SketchPlugin_Line::attributeChanged(const std::string& theID) { } } } - diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp index 6fe1e2cfa..d831982c1 100644 --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@ -77,7 +77,8 @@ bool SketchPlugin_Point::isFixed() { } void SketchPlugin_Point::attributeChanged(const std::string& theID) { - if (theID == EXTERNAL_ID()) { + // the second condition for unability to move external point anywhere + if (theID == EXTERNAL_ID() || isFixed()) { std::shared_ptr aSelection = data()->selection(EXTERNAL_ID())->value(); // update arguments due to the selection value if (aSelection && !aSelection->isNull() && aSelection->isVertex()) { -- 2.39.2