From b2b5748a4c0284ae254cd10bffb9551e1a6d8f2d Mon Sep 17 00:00:00 2001 From: spo Date: Fri, 17 Jun 2016 18:30:42 +0300 Subject: [PATCH] Rename setRigid to setFixed for C++HighAPI --- src/PythonAPI/CMakeLists.txt | 2 +- ...herSetRigid.py => TestSketcherSetFixed.py} | 4 +-- src/PythonAPI/examples/Platine.py | 2 +- src/SketchAPI/SketchAPI_Sketch.cpp | 25 +++++++++---------- src/SketchAPI/SketchAPI_Sketch.h | 14 ++++------- 5 files changed, 21 insertions(+), 26 deletions(-) rename src/PythonAPI/Test/{TestSketcherSetRigid.py => TestSketcherSetFixed.py} (81%) diff --git a/src/PythonAPI/CMakeLists.txt b/src/PythonAPI/CMakeLists.txt index 1bc55d36d..f3431c622 100644 --- a/src/PythonAPI/CMakeLists.txt +++ b/src/PythonAPI/CMakeLists.txt @@ -24,7 +24,7 @@ ADD_UNIT_TESTS( TestSketcherSetPerpendicular.py TestSketcherSetHorizontal.py TestSketcherSetVertical.py - TestSketcherSetRigid.py + TestSketcherSetFixed.py TestSketcherSetLength.py TestSketcherSetRadius.py #TestSketcherSetAngle.py diff --git a/src/PythonAPI/Test/TestSketcherSetRigid.py b/src/PythonAPI/Test/TestSketcherSetFixed.py similarity index 81% rename from src/PythonAPI/Test/TestSketcherSetRigid.py rename to src/PythonAPI/Test/TestSketcherSetFixed.py index f47c10adb..87d3dee5e 100644 --- a/src/PythonAPI/Test/TestSketcherSetRigid.py +++ b/src/PythonAPI/Test/TestSketcherSetFixed.py @@ -2,10 +2,10 @@ import unittest import model from TestSketcher import SketcherTestCase -class SketcherSetRigid(SketcherTestCase): +class SketcherSetFixed(SketcherTestCase): def runTest(self): circle = self.sketch.addCircle(0, 10, 20) - self.sketch.setRigid(circle) + self.sketch.setFixed(circle) model.do() circle.setCenter(0, 0) model.do() diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index 8a11fdf2b..c84684334 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -36,7 +36,7 @@ def vertical_body(): left, top, right, bottom = model.addPolygon(sketch, *geom_points) # Set constraints - sketch.setRigid(left.startPoint()) + sketch.setFixed(left.startPoint()) sketch.setHorizontal(bottom) sketch.setHorizontal(top) diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index 11d3c00a4..2a8e7e141 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -209,14 +209,14 @@ std::shared_ptr SketchAPI_Sketch::addLine(const ModelHighAPI_Sel { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID()); LinePtr aLine(new SketchAPI_Line(aFeature, theExternal)); - setRigid(InterfacePtr(aLine)); + setFixed(InterfacePtr(aLine)); return aLine; } std::shared_ptr SketchAPI_Sketch::addLine(const std::string & theExternalName) { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID()); LinePtr aLine(new SketchAPI_Line(aFeature, theExternalName)); - setRigid(InterfacePtr(aLine)); + setFixed(InterfacePtr(aLine)); return aLine; } @@ -469,6 +469,16 @@ std::shared_ptr SketchAPI_Sketch::setFillet( return aFeature; } +std::shared_ptr SketchAPI_Sketch::setFixed( + const ModelHighAPI_RefAttr & theObject) +{ + std::shared_ptr aFeature = + compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID()); + fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); + aFeature->execute(); + return aFeature; +} + std::shared_ptr SketchAPI_Sketch::setHorizontal( const ModelHighAPI_RefAttr & theLine) { @@ -539,17 +549,6 @@ std::shared_ptr SketchAPI_Sketch::setRadius( return aFeature; } -std::shared_ptr SketchAPI_Sketch::setRigid( - const ModelHighAPI_RefAttr & theObject) -{ - // TODO(spo): should it be renamed to Fixed? - std::shared_ptr aFeature = - compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID()); - fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); - aFeature->execute(); - return aFeature; -} - std::shared_ptr SketchAPI_Sketch::setTangent( const ModelHighAPI_RefAttr & theLine, const ModelHighAPI_RefAttr & theCircle) diff --git a/src/SketchAPI/SketchAPI_Sketch.h b/src/SketchAPI/SketchAPI_Sketch.h index 8fa4e6752..35edecfe2 100644 --- a/src/SketchAPI/SketchAPI_Sketch.h +++ b/src/SketchAPI/SketchAPI_Sketch.h @@ -273,6 +273,11 @@ public: const std::list & thePoints, const ModelHighAPI_Double & theRadius); + /// Set fixed + SKETCHAPI_EXPORT + std::shared_ptr setFixed( + const ModelHighAPI_RefAttr & theObject); + /// Set horizontal SKETCHAPI_EXPORT std::shared_ptr setHorizontal( @@ -308,11 +313,6 @@ public: const ModelHighAPI_RefAttr & theCircleOrArc, const ModelHighAPI_Double & theValue); - /// Set rigid - SKETCHAPI_EXPORT - std::shared_ptr setRigid( - const ModelHighAPI_RefAttr & theObject); - /// Set tangent SKETCHAPI_EXPORT std::shared_ptr setTangent( @@ -324,16 +324,12 @@ public: std::shared_ptr setVertical( const ModelHighAPI_RefAttr & theLine); - // TODO(spo): addRectagle, projection - /// Set constraint value SKETCHAPI_EXPORT void setValue( const std::shared_ptr & theConstraint, const ModelHighAPI_Double & theValue); - // TODO(spo): setText. Is it necessary as setValue accepts text expressions? - // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG) /// Select face SKETCHAPI_EXPORT -- 2.39.2