+++ /dev/null
-"""
-Test case for Translation feature.
-Written on High API.
-"""
-from ModelAPI import *
-from GeomAPI import *
-
-import model
-
-# Get session
-aSession = ModelAPI_Session.get()
-
-# Create a part
-aDocument = aSession.activeDocument()
-aSession.startOperation()
-model.addPart(aDocument)
-aDocument = aSession.activeDocument()
-aSession.finishOperation()
-
-# Create a box
-
-aSession.startOperation()
-aBox = model.addBox(aDocument, 10, 10, 10)
-
-# Perform a translation by an axis and a distance
-aSession.startOperation()
-aTranslation1 = model.addTranslation(aDocument, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), 20).result()
-aSession.finishOperation()
-assert (aTranslation1 is not None)
-
-# Perform a translation by DX, DY, DZ vector
-aSession.startOperation()
-aTranslation2 = model.addTranslation(aDocument, [model.selection("SOLID", "Box_1_1")], 10, 10, 10).result()
-aSession.finishOperation()
-assert (aTranslation2 is not None)
\ No newline at end of file
--- /dev/null
+"""
+Test case for Translation feature.
+Written on High API.
+"""
+from ModelAPI import *
+from GeomAPI import *
+
+import model
+
+# Get session
+aSession = ModelAPI_Session.get()
+
+# Create a part
+aDocument = aSession.activeDocument()
+aSession.startOperation()
+model.addPart(aDocument)
+aDocument = aSession.activeDocument()
+aSession.finishOperation()
+
+# Create a box
+
+aSession.startOperation()
+aBox = model.addBox(aDocument, 10, 10, 10)
+
+# Perform a translation by an axis and a distance
+aSession.startOperation()
+aTranslation1 = model.addTranslation(aDocument, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), 20).result()
+aSession.finishOperation()
+assert (aTranslation1 is not None)
+
+# Perform a translation by DX, DY, DZ vector
+aSession.startOperation()
+aTranslation2 = model.addTranslation(aDocument, [model.selection("SOLID", "Box_1_1")], 10, 10, 10).result()
+aSession.finishOperation()
+assert (aTranslation2 is not None)
\ No newline at end of file
INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})
ADD_UNIT_TESTS(TestAPI_Box.py
-)
+ TestAPI_Translation.py)
--- /dev/null
+# Copyright (C) 2014-2016 CEA/DEN, EDF R&D
+
+# File: TestAPI_Translation.py
+# Created: 15 Nov 2016
+# Author: Clarisse Genrault (CEA)
+
+from GeomAlgoAPI import GeomAlgoAPI_ShapeAPI as shaperpy
+from GeomAlgoAPI import GeomAlgoAPI_Exception as myExcept
+from GeomAPI import GeomAPI_Ax1 as axis
+from GeomAPI import GeomAPI_Pnt as pnt
+from GeomAPI import GeomAPI_Dir as direction
+
+# Create a box
+try :
+ box = shaperpy.makeBox(10.,10.,10.)
+
+except myExcept, ec:
+ print ec.what()
+
+# Perfom a translation with an axis and a distance.
+try :
+ origin = pnt(0.,0.,0.)
+ xDir = direction(1.,0.,0.)
+ xAxis = axis(origin, xDir)
+ translation1 = shaperpy.makeTranslation(box,xAxis,15.)
+
+except myExcept, ec:
+ print ec.what()
+
+# Perfom a translation with dimensions.
+try :
+ translation2 = shaperpy.makeTranslation(box,10,0,0)
+
+except myExcept, ec:
+ print ec.what()