Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / test.API / SHAPER / Transformations / TestScale.py
1 """
2 Test case for Scale feature. 
3 Written on High API.
4 """
5 from ModelAPI import *
6 from GeomAPI import *
7
8 from salome.shaper 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 aSession.startOperation()
22 aCenterPoint = model.addPoint(aDocument, 20, 20, 0).result()
23 aBox1 =  model.addBox(aDocument, 10, 10, 10)
24 aBox2 =  model.addBox(aDocument, 10, 10, 10)
25 aSession.finishOperation()
26
27 # Perform a symmetry by a point
28 aSession.startOperation()
29 aScale1 = model.addScale(aDocument, [model.selection("SOLID", "Box_1_1")], aCenterPoint, 2.0).result()
30 aSession.finishOperation()
31 assert (aScale1 is not None)
32
33 # Perform a symmetry by an axis
34 aSession.startOperation()
35 aScale2 = model.addScale(aDocument, [model.selection("SOLID", "Box_2_1")], aCenterPoint, -0.5, 2, 3.7).result()
36 aSession.finishOperation()
37 assert (aScale2 is not None)