]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Rename setRigid to setFixed for C++HighAPI
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 15:30:42 +0000 (18:30 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 15:43:00 +0000 (18:43 +0300)
src/PythonAPI/CMakeLists.txt
src/PythonAPI/Test/TestSketcherSetFixed.py [new file with mode: 0644]
src/PythonAPI/Test/TestSketcherSetRigid.py [deleted file]
src/PythonAPI/examples/Platine.py
src/SketchAPI/SketchAPI_Sketch.cpp
src/SketchAPI/SketchAPI_Sketch.h

index 1bc55d36d1ab7b755778c4c64d1a3c8a07702fb5..f3431c6220270c3a0dd61bca89b689a3fc64da62 100644 (file)
@@ -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/TestSketcherSetFixed.py b/src/PythonAPI/Test/TestSketcherSetFixed.py
new file mode 100644 (file)
index 0000000..87d3dee
--- /dev/null
@@ -0,0 +1,15 @@
+import unittest
+import model
+from TestSketcher import SketcherTestCase
+
+class SketcherSetFixed(SketcherTestCase):
+    def runTest(self):
+        circle = self.sketch.addCircle(0, 10, 20)
+        self.sketch.setFixed(circle)
+        model.do()
+        circle.setCenter(0, 0)
+        model.do()
+        self.assertEqual((circle.center().x(), circle.center().y()), (0, 10))
+
+if __name__ == "__main__":
+    unittest.main(verbosity=2)
diff --git a/src/PythonAPI/Test/TestSketcherSetRigid.py b/src/PythonAPI/Test/TestSketcherSetRigid.py
deleted file mode 100644 (file)
index f47c10a..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-import unittest
-import model
-from TestSketcher import SketcherTestCase
-
-class SketcherSetRigid(SketcherTestCase):
-    def runTest(self):
-        circle = self.sketch.addCircle(0, 10, 20)
-        self.sketch.setRigid(circle)
-        model.do()
-        circle.setCenter(0, 0)
-        model.do()
-        self.assertEqual((circle.center().x(), circle.center().y()), (0, 10))
-
-if __name__ == "__main__":
-    unittest.main(verbosity=2)
index 8a11fdf2badbbc1bac183b2fad6dce25625636e2..c84684334f4e982325f2b277427adb5a6478c142 100644 (file)
@@ -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)
index 11d3c00a49330ca71441ac8bfae6c1a0a72c6a0f..2a8e7e141f12046de459a3b6955c654cb3951079 100644 (file)
@@ -209,14 +209,14 @@ std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const ModelHighAPI_Sel
 {
   std::shared_ptr<ModelAPI_Feature> 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_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
 {
   std::shared_ptr<ModelAPI_Feature> 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<ModelAPI_Feature> SketchAPI_Sketch::setFillet(
   return aFeature;
 }
 
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setFixed(
+    const ModelHighAPI_RefAttr & theObject)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature =
+      compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
+  fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+  aFeature->execute();
+  return aFeature;
+}
+
 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setHorizontal(
     const ModelHighAPI_RefAttr & theLine)
 {
@@ -539,17 +549,6 @@ std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRadius(
   return aFeature;
 }
 
-std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRigid(
-    const ModelHighAPI_RefAttr & theObject)
-{
-  // TODO(spo): should it be renamed to Fixed?
-  std::shared_ptr<ModelAPI_Feature> aFeature =
-      compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
-  fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
-  aFeature->execute();
-  return aFeature;
-}
-
 std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setTangent(
     const ModelHighAPI_RefAttr & theLine,
     const ModelHighAPI_RefAttr & theCircle)
index 8fa4e6752d43fd41938dbc1ff5683cad5c4b1808..35edecfe2abc47406f69eb0e6223448abf7f2e63 100644 (file)
@@ -273,6 +273,11 @@ public:
       const std::list<ModelHighAPI_RefAttr> & thePoints,
       const ModelHighAPI_Double & theRadius);
 
+  /// Set fixed
+  SKETCHAPI_EXPORT
+  std::shared_ptr<ModelAPI_Feature> setFixed(
+      const ModelHighAPI_RefAttr & theObject);
+
   /// Set horizontal
   SKETCHAPI_EXPORT
   std::shared_ptr<ModelAPI_Feature> setHorizontal(
@@ -308,11 +313,6 @@ public:
       const ModelHighAPI_RefAttr & theCircleOrArc,
       const ModelHighAPI_Double & theValue);
 
-  /// Set rigid
-  SKETCHAPI_EXPORT
-  std::shared_ptr<ModelAPI_Feature> setRigid(
-      const ModelHighAPI_RefAttr & theObject);
-
   /// Set tangent
   SKETCHAPI_EXPORT
   std::shared_ptr<ModelAPI_Feature> setTangent(
@@ -324,16 +324,12 @@ public:
   std::shared_ptr<ModelAPI_Feature> setVertical(
       const ModelHighAPI_RefAttr & theLine);
 
-  // TODO(spo): addRectagle, projection
-
   /// Set constraint value
   SKETCHAPI_EXPORT
   void setValue(
       const std::shared_ptr<ModelAPI_Feature> & 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