]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add TestMakeBrick2.py
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 30 Oct 2015 12:09:08 +0000 (15:09 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 30 Oct 2015 13:42:53 +0000 (16:42 +0300)
src/PythonAPI/CMakeLists.txt
src/PythonAPI/MakeBrick2.py
src/PythonAPI/Test/TestMakeBrick2.py [new file with mode: 0644]

index 8d3e0cab4c935f2f4a1a276cec4b17c423b48896..f2e24fad69291a596e82902b12918ad6bc099c03 100644 (file)
@@ -32,4 +32,6 @@ ADD_UNIT_TESTS(
   TestFeaturesRevolution.py
 
   TestMakeBrick1.py
+  TestMakeBrick2.py
+#  TestMakeBrick3.py
   )
index c3e06e356d19e8765f92dc84a7b0feaebfa6a501..2fa09d6d360267742e60878a9bac799b711f8e27 100644 (file)
@@ -19,51 +19,51 @@ mypart = model.addPart(mypartset).document()
 
 # Creating the base of the box
 
-mybase = model.addSketch( mypart, model.defaultPlane("XOY") )
+mybase = model.addSketch(mypart, model.defaultPlane("XOY"))
 
-p1 = geom.Pnt2d( 0, 0 )
-p2 = geom.Pnt2d( 0, 1 )
-p3 = geom.Pnt2d( 1, 1 )
-p4 = geom.Pnt2d( 1, 0 )
+p1 = geom.Pnt2d(0, 0)
+p2 = geom.Pnt2d(0, 1)
+p3 = geom.Pnt2d(1, 1)
+p4 = geom.Pnt2d(1, 0)
 
 line = mybase.addPolygon(p1, p2, p3, p4)
 
-mybase.setParallel( line[0].result(), line[2].result() )
-mybase.setParallel( line[1].result(), line[3].result() )
-mybase.setPerpendicular( line[0].result(), line[3].result() )
+mybase.setParallel(line[0].result(), line[2].result())
+mybase.setParallel(line[1].result(), line[3].result())
+mybase.setPerpendicular(line[0].result(), line[3].result())
 
-mywidth  = mybase.setLength( line[0].result(), 50 )
-mylength = mybase.setDistance( line[0].startPointData(),line[2].result(), 50 )
+mywidth = mybase.setLength(line[0].result(), 50)
+mylength = mybase.setDistance(line[0].startPointData(), line[2].result(), 50)
 
 
 # Creating the extrusion
 
-mybox = model.addExtrusion( mypart, mybase.selectFace(), 50 )
+mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
 
 
 # Creating a cylinder on a face of the box
 
-thisface = "Extrusion_1/LateralFace_2"
-thisxmin = "Extrusion_1/LateralFace_3|Extrusion_1/LateralFace_2"
-thiszmax = "Extrusion_1/LateralFace_2|Extrusion_1/TopFace_1"
+thisface = "Extrusion_1_1/LateralFace_2"
+thisxmin = "Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2"
+thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
 
-mystand = model.addSketch( mypart, thisface )
-circle  = mystand.addCircle( 0, 25, 5)
-mystand.setDistance( circle.centerData(), thisxmin, 10 )
-mystand.setDistance( circle.centerData(), thiszmax, 10 )
+mystand = model.addSketch(mypart, thisface)
+circle = mystand.addCircle(0, 25, 5)
+mystand.setDistance(circle.centerData(), thisxmin, 10)
+mystand.setDistance(circle.centerData(), thiszmax, 10)
 
-myboss = model.addExtrusion( mypart, mystand.selectFace(), -5 )
+myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
 
 
 # Subtracting the cylinder to the box
 
-model.addSubtraction( mypart, mybox.result(), myboss.result() )
+model.addSubtraction(mypart, mybox.result(), myboss.result())
 model.end()
 
 
 # Editing the box
 
 model.begin()
-mybase.setValue( mylength, 100 )
-mybox.setSize( 20 )
+mybase.setValue(mylength, 100)
+mybox.setSize(20)
 model.end()
diff --git a/src/PythonAPI/Test/TestMakeBrick2.py b/src/PythonAPI/Test/TestMakeBrick2.py
new file mode 100644 (file)
index 0000000..f903e90
--- /dev/null
@@ -0,0 +1,6 @@
+import unittest
+
+import MakeBrick2
+
+if __name__ == "__main__":
+    unittest.main()