]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesAPI/Test/APIParam_Symmetry.py
Salome HOME
Adding the "Symmetry" feature.
[modules/shaper.git] / src / FeaturesAPI / Test / APIParam_Symmetry.py
1 """
2 Test case for Translation feature. 
3 Written on High API.
4 """
5 from ModelAPI import *
6 from GeomAPI import *
7
8 import model
9
10 # Get session
11 aSession = ModelAPI_Session.get()
12
13 # Create a part
14 aDocument = aSession.activeDocument()
15 aSession.startOperation()
16 model.addPart(aDocument)
17 aDocument = aSession.activeDocument()
18 aSession.finishOperation()
19
20 # Create a box
21
22 aSession.startOperation()
23 aBox1 =  model.addBox(aDocument, 10, 10, 10)
24 aBox2 =  model.addBox(aDocument, 10, 10, 10)
25 aBox3 =  model.addBox(aDocument, 10, 10, 10)
26
27 # Perform a symmetry by a point
28 aSession.startOperation()
29 aPoint = model.addPoint(aDocument, 0, 0, 0).result()
30 aSymmetry1 = model.addSymmetry(aDocument, [model.selection("SOLID", "Box_1_1")], aPoint).result()
31 aSession.finishOperation()
32 assert (aSymmetry1 is not None)
33
34 # Perform a symmetry by an axis
35 aSession.startOperation()
36 anAxis = model.addAxis(aDocument, 10, 0, 0).result()
37 aSymmetry2 = model.addSymmetry(aDocument, [model.selection("SOLID", "Box_2_1")], anAxis).result()
38 aSession.finishOperation()
39 assert (aSymmetry2 is not None)
40
41 # Perform a symmetry by a plane
42 aSession.startOperation()
43 aPoint1 = model.addPoint(aDocument, 0, 0, 0).result()
44 aPoint2 = model.addPoint(aDocument, 10, 10, 0).result()
45 aSymmetry3 = model.addSymmetry(aDocument, [model.selection("SOLID", "Box_3_1")], model.selection("FACE", "Box_3_1/Top")).result()
46 aSession.finishOperation()
47 assert (aSymmetry3 is not None)