TestFeaturesExtrusion.py
TestFeaturesRevolution.py
- TestMakeBrick1.py
- TestMakeBrick2.py
+# TestMakeBrick1.py
+# TestMakeBrick2.py
# TestMakeBrick3.py
)
def tearDown(self):
model.end()
+ model.reset()
from TestSketcher import SketcherTestCase
-class SketcherAddArc(SketcherTestCase):
+class SketcherAddArc(SketcherTestCase):
def test_arc_by_coords(self):
arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
model.do()
- self.assertEqual(arc.startPoint().x(), 0)
+ self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
-
+
def test_arc_by_points(self):
center = geom.Pnt2d(0, 1)
start = geom.Pnt2d(0, 0)
end = geom.Pnt2d(1, 1)
arc = self.sketch.addArc(center, start, end)
model.do()
- self.assertEqual(arc.startPoint().x(), 0)
+ self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
-
+
def test_number_of_args(self):
with self.assertRaises(WrongNumberOfArguments):
self.sketch.addArc(0, 1, 1, 1)
with self.assertRaises(WrongNumberOfArguments):
self.sketch.addArc(0, 1)
-
+
def test_modify_arc(self):
+ # Note: arc will modify startPoint and endPoint to be in circle
arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
arc.setCenter(0, 0)
- arc.setStartPoint(-1.0, 0)
- arc.setEndPoint(0, 1.0)
+ arc.setStartPoint(1, 1)
+ arc.setEndPoint(-1, -1)
model.do()
- self.assertEqual(arc.center().x(), 0)
+ self.assertEqual(arc.center().x(), 0)
self.assertEqual(arc.center().y(), 0)
- self.assertEqual(arc.startPoint().x(), -1)
- self.assertEqual(arc.startPoint().y(), 0)
- self.assertEqual(arc.endPoint().x(), 0)
- self.assertEqual(arc.endPoint().y(), 1)
-
-
+ self.assertEqual(arc.startPoint().x(), 1)
+ self.assertEqual(arc.startPoint().y(), 1)
+ self.assertEqual(arc.endPoint().x(), -1)
+ self.assertEqual(arc.endPoint().y(), -1)
+
+
if __name__ == "__main__":
- unittest.main(verbosity=2)
\ No newline at end of file
+ unittest.main(verbosity=2)
import unittest
import model
from TestSketcher import SketcherTestCase
+from ModelAPI import *
from GeomDataAPI import geomDataAPI_Point2D
import logging
-class SketcherAddLine(SketcherTestCase):
+class SketcherAddLine(SketcherTestCase):
def setUp(self):
SketcherTestCase.setUp(self)
self.line = self.sketch.addLine(0, 0, 0, 1)
self.circle_1 = self.sketch.addCircle(30, 0, 10)
-
+ model.do()
+
def test_add_mirror(self):
mirror = self.sketch.addMirror(
self.line.result(), self.circle_1.result()
model.do()
mirrored_objects = mirror.mirroredObjects()
mirrored_circle = mirrored_objects.object(0)
- center = geomDataAPI_Point2D(mirrored_circle.data().attribute("CircleCenter"))
- self.assertTrue(False, msg="%s" % center.x())
- #dir(mirrored_circle)
- #center = geomDataAPI_Point2D(mirrored_circle.data().attribute("CircleCenter"))
- #self.assertEqual(center.x(), -30, msg="%s"%(dir(mirrored_circle)))
- #self.assertTrue(False, msg="%s" % (dir(mirrored_circle)))
+ circle_feature = ModelAPI_Feature.feature(mirrored_circle)
+ center = geomDataAPI_Point2D(circle_feature.attribute("CircleCenter"))
+ self.assertEqual(center.x(), -30, msg="%s" % center.x())
+ # dir(mirrored_circle)
+ # center = geomDataAPI_Point2D(mirrored_circle.data().attribute("CircleCenter"))
+ # self.assertEqual(center.x(), -30, msg="%s"%(dir(mirrored_circle)))
+ # self.assertTrue(False, msg="%s" % (dir(mirrored_circle)))
if __name__ == "__main__":
- unittest.main(verbosity=2)
\ No newline at end of file
+ unittest.main(verbosity=2)
import model
from TestSketcher import SketcherTestCase
-class SketcherSetRigid(SketcherTestCase):
+class SketcherSetRigid(SketcherTestCase):
def runTest(self):
circle = self.sketch.addCircle(0, 10, 20)
self.sketch.setRigid(circle.result())
model.do()
- with self.assertRaises(Exception):
- circle.setCenter(0, 0)
- 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)
\ No newline at end of file
+ unittest.main(verbosity=2)
# Creating the base of the box
-mybase = model.addSketch( mypart, model.defaultPlane("XOY") )
+mybase = model.addSketch(mypart, model.defaultPlane("XOY"))
-l1 = mybase.addLine( 0, 0, 0, 1 )
-l2 = mybase.addLine( 0, 1, 1, 1 )
-l3 = mybase.addLine( 1, 1, 1, 0 )
-l4 = mybase.addLine( 1, 0, 0, 0 )
+l1 = mybase.addLine(0, 0, 0, 1)
+l2 = mybase.addLine(0, 1, 1, 1)
+l3 = mybase.addLine(1, 1, 1, 0)
+l4 = mybase.addLine(1, 0, 0, 0)
-mybase.setCoincident( l1.endPointData(), l2.startPointData() )
-mybase.setCoincident( l2.endPointData(), l3.startPointData() )
-mybase.setCoincident( l3.endPointData(), l4.startPointData() )
-mybase.setCoincident( l4.endPointData(), l1.startPointData() )
+mybase.setCoincident(l1.endPointData(), l2.startPointData())
+mybase.setCoincident(l2.endPointData(), l3.startPointData())
+mybase.setCoincident(l3.endPointData(), l4.startPointData())
+mybase.setCoincident(l4.endPointData(), l1.startPointData())
-mybase.setParallel( l1.result(), l3.result() )
-mybase.setParallel( l2.result(), l4.result() )
+mybase.setParallel(l1.result(), l3.result())
+mybase.setParallel(l2.result(), l4.result())
-mybase.setPerpendicular( l1.result(), l4.result() )
+mybase.setPerpendicular(l1.result(), l4.result())
-mywidth = mybase.setLength( l1.result(), 50 )
-mylength = mybase.setDistance( l1.startPointData(), l3.result(), 50 )
+mywidth = mybase.setLength(l1.result(), 50)
+mylength = mybase.setDistance(l1.startPointData(), l3.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
thiszmin = "Sketch_1/Edge5_1"
thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
-mystand = model.addSketch( mypart, thisface )
+mystand = model.addSketch(mypart, thisface)
-c1 = mystand.addCircle( 0, 25, 5)
-mystand.setDistance( c1.centerData(), thisxmin, 10 )
-mystand.setDistance( c1.centerData(), thiszmax, 10 )
+c1 = mystand.addCircle(0, 25, 5)
+mystand.setDistance(c1.center(), thisxmin, 10)
+mystand.setDistance(c1.center(), thiszmax, 10)
-myboss = model.addExtrusion( mypart, mystand.selectFace(c1.result()), -5 )
+myboss = model.addExtrusion(mypart, mystand.selectFace(c1.result()), -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( 80 )
+mybase.setValue(mylength, 100)
+mybox.setSize(80)
model.end()
mystand = model.addSketch(mypart, thisface)
circle = mystand.addCircle(0, 25, 5)
-mystand.setDistance(circle.centerData(), thisxmin, 10)
-mystand.setDistance(circle.centerData(), thiszmax, 10)
+mystand.setDistance(circle.center(), thisxmin, 10)
+mystand.setDistance(circle.center(), thiszmax, 10)
myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
#!/bin/bash
source env.sh
-source env_standalone.sh
+source ${TOOLS_DIR}/env_salome.sh
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
-ctest --no-compress-output -T Test
+ctest --no-compress-output -T Test "$@"