--- /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
-## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2016 CEA/DEN, EDF R&D
INCLUDE(Common)
+INCLUDE(UnitTest)
SET(PROJECT_HEADERS
FeaturesAPI.h
INSTALL(TARGETS _FeaturesAPI DESTINATION ${SHAPER_INSTALL_SWIG})
INSTALL(TARGETS FeaturesAPI DESTINATION ${SHAPER_INSTALL_BIN})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/FeaturesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+ADD_UNIT_TESTS(APIParam_Translation.py)
\ No newline at end of file
/// Constructor with values.
FEATURESAPI_EXPORT
- FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Selection& theAxisObject,
- const ModelHighAPI_Double& theDistance);
+ explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance);
/// Constructor with values.
FEATURESAPI_EXPORT
- FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
+ explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
const ModelHighAPI_Double& theDx,
const ModelHighAPI_Double& theDy,
const ModelHighAPI_Double& theDz);
TestUnion.py
TestRemoveSubShapes.py
TestPipe.py
- TestRecover.py
- APIParam_Translation.py)
+ TestRecover.py)
+++ /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
aMoveResult = modelAPI_ResultBody(aMoveFt.firstResult())
assert (aMoveResult is not None)
-#import model
-#assert(model.checkPythonDump())
+import model
+assert(model.checkPythonDump())
myError = "Translation builder :: axis is invalid.";
return false;
}
- // TODO : verification de la distance
if (!mySourceShape) {
myError = "Translation builder :: source shape is invalid.";
return false;
return true;
}
case BY_DIM: {
- if ((fabs(myDx) < Precision::Confusion()) &&
- (fabs(myDy) < Precision::Confusion()) &&
- (fabs(myDz) < Precision::Confusion())) {
- myError = "Translation builder :: Dx, Dy and Dz are null.";
- return false;
- }
if (!mySourceShape) {
myError = "Translation builder :: source shape is invalid.";
return false;