From 74cbc56bd08f0deaeffb3e049a6c09be87982ff6 Mon Sep 17 00:00:00 2001 From: Clarisse Genrault Date: Mon, 21 Nov 2016 16:00:03 +0100 Subject: [PATCH] Add test for ShapeAPI translation. --- .../{ => Test}/APIParam_Translation.py | 0 src/GeomAlgoAPI/CMakeLists.txt | 2 +- src/GeomAlgoAPI/Test/TestAPI_Translation.py | 35 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) rename src/FeaturesAPI/{ => Test}/APIParam_Translation.py (100%) create mode 100644 src/GeomAlgoAPI/Test/TestAPI_Translation.py diff --git a/src/FeaturesAPI/APIParam_Translation.py b/src/FeaturesAPI/Test/APIParam_Translation.py similarity index 100% rename from src/FeaturesAPI/APIParam_Translation.py rename to src/FeaturesAPI/Test/APIParam_Translation.py diff --git a/src/GeomAlgoAPI/CMakeLists.txt b/src/GeomAlgoAPI/CMakeLists.txt index 75015c1f3..783cbf385 100644 --- a/src/GeomAlgoAPI/CMakeLists.txt +++ b/src/GeomAlgoAPI/CMakeLists.txt @@ -152,5 +152,5 @@ INSTALL(TARGETS GeomAlgoAPI DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG}) ADD_UNIT_TESTS(TestAPI_Box.py -) + TestAPI_Translation.py) diff --git a/src/GeomAlgoAPI/Test/TestAPI_Translation.py b/src/GeomAlgoAPI/Test/TestAPI_Translation.py new file mode 100644 index 000000000..0d405fbaf --- /dev/null +++ b/src/GeomAlgoAPI/Test/TestAPI_Translation.py @@ -0,0 +1,35 @@ +# 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() -- 2.39.2