Salome HOME
[PythonAPI / sketcher] added setFillet method
authorRenaud NEDELEC <renaud.nedelec@opencascade.com>
Tue, 20 Oct 2015 15:24:58 +0000 (17:24 +0200)
committerRenaud NEDELEC <renaud.nedelec@opencascade.com>
Tue, 20 Oct 2015 15:24:58 +0000 (17:24 +0200)
src/PythonAPI/CMakeLists.txt
src/PythonAPI/Test/TestSketcherSetFillet.py [new file with mode: 0644]
src/PythonAPI/model/sketcher/sketch.py

index ae884173e1a5ac6a284b4f94742564df1f1e33dc..75c42711c9e62857080e175da21f531779f8aae6 100644 (file)
@@ -23,4 +23,5 @@ ADD_UNIT_TESTS(
   TestSketcherSetRadius.py
   TestSketcherSetAngle.py
   TestSketcherSetEqual.py
+  TestSketcherSetFillet.py
   ) 
diff --git a/src/PythonAPI/Test/TestSketcherSetFillet.py b/src/PythonAPI/Test/TestSketcherSetFillet.py
new file mode 100644 (file)
index 0000000..f84b67a
--- /dev/null
@@ -0,0 +1,14 @@
+import unittest
+import model
+from TestSketcher import SketcherTestCase
+
+class SketcherSetFillet(SketcherTestCase):   
+    def runTest(self):
+        l1 = self.sketch.addLine(0, 0, 0, 1)
+        l2 = self.sketch.addLine(0, 1, 1, 1)
+        self.sketch.setCoincident(l1.endPointData(), l2.startPointData())
+        self.sketch.setFillet(l1.result(), l2.result(), 10.0)
+        model.do()
+
+if __name__ == "__main__":
+    unittest.main()
\ No newline at end of file
index 7ef6af55254d8ef370ed0cbea090e4ae03b47f63..a5a909d4f3007ef9158be1bd08c031979dd98b70 100644 (file)
@@ -187,6 +187,16 @@ class Sketch():
         constraint.data().real("ConstraintValue").setValue(angle)
         self._feature.execute()
         return constraint
+    
+    def setFillet(self, line_1, line_2, radius):
+        """Set a fillet constraint between the 3 given lines with the given 
+        filleting radius."""
+        constraint = self._feature.addFeature("SketchConstraintFillet")
+        constraint.data().refattr("ConstraintEntityA").setObject(line_1)
+        constraint.data().refattr("ConstraintEntityB").setObject(line_2)
+        constraint.data().real("ConstraintValue").setValue(radius)
+        self._feature.execute()
+        return constraint
 
     #-------------------------------------------------------------
     #
@@ -242,8 +252,11 @@ class Sketch():
         pg.append(ln)
         return pg
 
-
+    #-------------------------------------------------------------
+    #
     # Getters
+    #
+    #-------------------------------------------------------------
 
     def selectFace(self, *args):
         """Select the geometrical entities of this Sketch on which 
@@ -252,8 +265,7 @@ class Sketch():
         When no entity is given, the face is based on all existing 
         geometry of this Sketch.
         """
-        #self.resultype ="Face"
-        if   len(args) == 0:
+        if len(args) == 0:
             self._selection = modelAPI_ResultConstruction( 
                 self._feature.firstResult()).shape()
         elif len(args) == 1: