Refactor the Translation feature.
%feature("kwargs") addPlacement;
%feature("kwargs") addSplit;
%feature("kwargs") addSmash;
+%feature("kwargs") addTranslation;
%feature("kwargs") addUnion;
// shared pointers
// fix compilation error: 'res*' was not declared in this scope
%typemap(freearg) const std::pair<std::list<ModelHighAPI_Selection>, bool> & {}
+
+%typecheck(SWIG_TYPECHECK_POINTER) std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>, const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {
+ ModelHighAPI_Selection* temp_selection;
+ int newmem = 0;
+ if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (temp_selection) {
+ $1 = 1;
+ } else {
+ $1 = 0;
+ }
+ } else {
+ $1 = ((PyFloat_Check($input) || PyLong_Check($input) || PyUnicode_Check($input)) && !PyBool_Check($input)) ? 1 : 0;
+ }
+}
+
+%typemap(in) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & (std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> temp) {
+ ModelHighAPI_Selection* temp_selection;
+ int newmem = 0;
+ if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (temp_selection) {
+ temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(*temp_selection, ModelHighAPI_Double(0.0));
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ delete temp_selection;
+ }
+ }
+ } else if (PyFloat_Check($input) || PyLong_Check($input)) {
+ temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyFloat_AsDouble($input)));
+ } else if (PyUnicode_Check($input)) {
+ temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>(ModelHighAPI_Selection(), ModelHighAPI_Double(PyUnicode_AsUTF8($input)));
+ } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
+ temp = std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>($1->first, $1->second);
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be selection, ModelHighAPI_Double, float, int or string.");
+ return NULL;
+ }
+ $1 = &temp;
+}
+
+// fix compilation error: 'res*' was not declared in this scope
+%typemap(freearg) const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double> & {}
+
+
// all supported interfaces
%include "FeaturesAPI_BooleanCut.h"
%include "FeaturesAPI_BooleanFuse.h"
aBase->selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID());
AttributeDoublePtr anAttrDistance =
aBase->real(FeaturesPlugin_Translation::DISTANCE_ID());
- theDumper << ", " << anAttrAxis << ", " << anAttrDistance;
+ theDumper << ", axis = " << anAttrAxis << ", distance = " << anAttrDistance;
} else if (aCreationMethod == FeaturesPlugin_Translation::CREATION_METHOD_BY_DIMENSIONS()) {
AttributeDoublePtr anAttrDx = aBase->real(FeaturesPlugin_Translation::DX_ID());
AttributeDoublePtr anAttrDy = aBase->real(FeaturesPlugin_Translation::DY_ID());
AttributeDoublePtr anAttrDz = aBase->real(FeaturesPlugin_Translation::DZ_ID());
- theDumper << ", " << anAttrDx << ", " << anAttrDy << ", " << anAttrDz;
+ theDumper << ", vector = [" << anAttrDx << ", " << anAttrDy << ", " << anAttrDz << "]";
} else if (aCreationMethod == FeaturesPlugin_Translation::CREATION_METHOD_BY_TWO_POINTS()) {
AttributeSelectionPtr anAttrStartPoint =
aBase->selection(FeaturesPlugin_Translation::START_POINT_ID());
AttributeSelectionPtr anAttrEndPoint =
aBase->selection(FeaturesPlugin_Translation::END_POINT_ID());
- theDumper << ", " << anAttrStartPoint << ", " << anAttrEndPoint;
+ theDumper << ", startPoint = " << anAttrStartPoint << ", endPoint = " << anAttrEndPoint;
}
+ if (!aBase->data()->version().empty())
+ theDumper << ", keepSubResults = True";
+
theDumper << ")" << std::endl;
}
//==================================================================================================
-TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Selection& theAxisObject,
- const ModelHighAPI_Double& theDistance)
+TranslationPtr addTranslation(
+ const std::shared_ptr<ModelAPI_Document>& part,
+ const std::list<ModelHighAPI_Selection>& objects,
+ const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated1,
+ const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated2,
+ const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated3,
+ const ModelHighAPI_Selection& axis, const ModelHighAPI_Double& distance,
+ const std::list<ModelHighAPI_Double>& vector,
+ const ModelHighAPI_Selection& startPoint, const ModelHighAPI_Selection& endPoint,
+ const bool keepSubResults)
{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
- return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects,
- theAxisObject, theDistance));
-}
+ std::shared_ptr<ModelAPI_Feature> aFeature = part->addFeature(FeaturesAPI_Translation::ID());
+ if (!keepSubResults)
+ aFeature->data()->setVersion("");
+
+ static const int VEC_SIZE = 3;
+
+ bool byAxis = axis.variantType() != ModelHighAPI_Selection::VT_Empty;
+ bool byVector = vector.size() == VEC_SIZE;
+ bool byPoints = startPoint.variantType() != ModelHighAPI_Selection::VT_Empty &&
+ endPoint.variantType() != ModelHighAPI_Selection::VT_Empty;
+
+ ModelHighAPI_Selection firstSel, secondSel;
+ ModelHighAPI_Double values[VEC_SIZE];
+ if (byAxis) {
+ firstSel = axis;
+ values[0] = distance;
+ }
+ else if (byVector) {
+ std::list<ModelHighAPI_Double>::const_iterator it = vector.begin();
+ for (ModelHighAPI_Double* vIt = values; it != vector.end(); ++vIt, ++it)
+ *vIt = *it;
+ }
+ else if (byPoints) {
+ firstSel = startPoint;
+ secondSel = endPoint;
+ }
+ else {
+ byVector = deprecated1.first.variantType() == ModelHighAPI_Selection::VT_Empty;
+ if (byVector) {
+ values[0] = deprecated1.second;
+ values[1] = deprecated2.second;
+ values[2] = deprecated3.second;
+ }
+ else {
+ firstSel = deprecated1.first;
+ secondSel = deprecated2.first;
+ values[0] = deprecated2.second;
+ if (secondSel.variantType() == ModelHighAPI_Selection::VT_Empty)
+ byAxis = true;
+ else
+ byPoints = true;
+ }
+ }
-//==================================================================================================
-TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Double& theDx,
- const ModelHighAPI_Double& theDy,
- const ModelHighAPI_Double& theDz)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
- return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects, theDx, theDy, theDz));
-}
+ TranslationPtr aTranslation;
+ if (byAxis)
+ aTranslation.reset(new FeaturesAPI_Translation(aFeature, objects, firstSel, values[0]));
+ else if (byVector) {
+ aTranslation.reset(new FeaturesAPI_Translation(aFeature, objects,
+ values[0], values[1], values[2]));
+ }
+ else if (byPoints)
+ aTranslation.reset(new FeaturesAPI_Translation(aFeature, objects, firstSel, secondSel));
-//==================================================================================================
-TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Selection& theStartPoint,
- const ModelHighAPI_Selection& theEndPoint)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
- return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects,
- theStartPoint, theEndPoint));
+ return aTranslation;
}
#include <FeaturesPlugin_Translation.h>
+#include <ModelHighAPI_Double.h>
#include <ModelHighAPI_Interface.h>
#include <ModelHighAPI_Macro.h>
+#include <ModelHighAPI_Selection.h>
-class ModelHighAPI_Double;
class ModelHighAPI_Dumper;
-class ModelHighAPI_Selection;
/// \class FeaturesAPI_Translation
/// \ingroup CPPHighAPI
/// Pointer on Translation object.
typedef std::shared_ptr<FeaturesAPI_Translation> TranslationPtr;
-/// \ingroup CPPHighAPI
-/// \brief Create Translation feature.
-FEATURESAPI_EXPORT
-TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Selection& theAxisObject,
- const ModelHighAPI_Double& theDistance);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Translation feature.
-FEATURESAPI_EXPORT
-TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Double& theDx,
- const ModelHighAPI_Double& theDy,
- const ModelHighAPI_Double& theDz);
+#define DUMMY std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>()
/// \ingroup CPPHighAPI
/// \brief Create Translation feature.
-FEATURESAPI_EXPORT
-TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const ModelHighAPI_Selection& theStartPoint,
- const ModelHighAPI_Selection& theEndPoint);
+FEATURESAPI_EXPORT TranslationPtr addTranslation(
+ const std::shared_ptr<ModelAPI_Document>& part,
+ const std::list<ModelHighAPI_Selection>& objects,
+ const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated1 = DUMMY,
+ const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated2 = DUMMY,
+ const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated3 = DUMMY,
+ const ModelHighAPI_Selection& axis = ModelHighAPI_Selection(),
+ const ModelHighAPI_Double& distance = ModelHighAPI_Double(0.0),
+ const std::list<ModelHighAPI_Double>& vector = std::list<ModelHighAPI_Double>(),
+ const ModelHighAPI_Selection& startPoint = ModelHighAPI_Selection(),
+ const ModelHighAPI_Selection& endPoint = ModelHighAPI_Selection(),
+ const bool keepSubResults = false );
#endif // FeaturesAPI_Translation_H_
TestPlacement_MultiLevelCompound_v95_4.py
TestPlacement_MultiLevelCompound_v95_5.py
TestPlacement_MultiLevelCompound_v95_6.py
+ TestTranslation_MultiLevelCompound_v0_1.py
+ TestTranslation_MultiLevelCompound_v0_2.py
+ TestTranslation_MultiLevelCompound_v0_3.py
+ TestTranslation_MultiLevelCompound_v0_4.py
+ TestTranslation_MultiLevelCompound_v0_5.py
+ TestTranslation_MultiLevelCompound_v95_1.py
+ TestTranslation_MultiLevelCompound_v95_2.py
+ TestTranslation_MultiLevelCompound_v95_3.py
+ TestTranslation_MultiLevelCompound_v95_4.py
+ TestTranslation_MultiLevelCompound_v95_5.py
)
GeomAPI_ShapeHierarchy anObjects;
std::list<ResultPtr> aParts;
AttributeSelectionListPtr anObjectsSelList = selectionList(OBJECTS_LIST_ID());
- if(anObjectsSelList->size() == 0) {
+ if (!FeaturesPlugin_Tools::shapesFromSelectionList(
+ anObjectsSelList, isKeepSubShapes, anObjects, aParts))
return;
- }
- for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
- anObjectsSelList->value(anObjectsIndex);
- std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
- if(!anObject.get()) { // may be for not-activated parts
- return;
- }
- ResultPtr aContext = anObjectAttr->context();
- if (aContext->groupName() == ModelAPI_ResultPart::group())
- aParts.push_back(aContext);
- else {
- // store full shape hierarchy for the corresponding version only
- anObjects.addObject(anObject);
- if (isKeepSubShapes)
- ModelAPI_Tools::fillShapeHierarchy(anObject, aContext, anObjects);
- }
- }
// Verify the start shape
AttributeSelectionPtr anObjRef = selection(START_SHAPE_ID());
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Tools.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_ShapeTools.h>
}
return true;
}
+
+//==================================================================================================
+bool FeaturesPlugin_Tools::shapesFromSelectionList(
+ const std::shared_ptr<ModelAPI_AttributeSelectionList> theSelectionList,
+ const bool theStoreFullHierarchy,
+ GeomAPI_ShapeHierarchy& theHierarchy,
+ std::list<ResultPtr>& theParts)
+{
+ int aSize = theSelectionList->size();
+ for (int anObjectsIndex = 0; anObjectsIndex < aSize; anObjectsIndex++) {
+ AttributeSelectionPtr anObjectAttr = theSelectionList->value(anObjectsIndex);
+ std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
+ if (!anObject.get()) { // may be for not-activated parts
+ return false;
+ }
+ ResultPtr aContext = anObjectAttr->context();
+ if (aContext->groupName() == ModelAPI_ResultPart::group())
+ theParts.push_back(aContext);
+ else {
+ // store full shape hierarchy for the corresponding version only
+ theHierarchy.addObject(anObject);
+ if (theStoreFullHierarchy)
+ ModelAPI_Tools::fillShapeHierarchy(anObject, aContext, theHierarchy);
+ }
+ }
+ return true;
+}
#define FeaturesPlugin_Tools_H_
#include <GeomAlgoAPI_MakeShape.h>
+#include <GeomAPI_ShapeHierarchy.h>
#include <ModelAPI_ResultBody.h>
#include <vector>
const bool theShareTopology,
ListOfShape& theShapesList,
std::string& theError);
+
+ /// Collect shapes from the attribute and fill the hierarchy or a list of parts
+ static bool shapesFromSelectionList(
+ const std::shared_ptr<ModelAPI_AttributeSelectionList> theSelectionList,
+ const bool theStoreFullHierarchy,
+ GeomAPI_ShapeHierarchy& theHierarchy,
+ std::list<ResultPtr>& theParts);
};
#endif /* FeaturesPlugin_Tools_H_ */
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
#include <GeomAPI_ShapeIterator.h>
+#include <GeomAPI_ShapeHierarchy.h>
#include <GeomAPI_Trsf.h>
+#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_PointBuilder.h>
#include <GeomAlgoAPI_Tools.h>
+#include <GeomAlgoAPI_Transform.h>
#include <FeaturesPlugin_Tools.h>
+static const std::string TRANSLATION_VERSION_1("v9.5");
+
//=================================================================================================
FeaturesPlugin_Translation::FeaturesPlugin_Translation()
{
ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Translation::END_POINT_ID(),
ModelAPI_AttributeSelection::typeId());
+
+ if (!aSelection->isInitialized()) {
+ // new feature, not read from file
+ data()->setVersion(TRANSLATION_VERSION_1);
+ }
}
//=================================================================================================
AttributeStringPtr aMethodTypeAttr = string(FeaturesPlugin_Translation::CREATION_METHOD());
std::string aMethodType = aMethodTypeAttr->value();
- if (aMethodType == CREATION_METHOD_BY_DISTANCE()) {
- performTranslationByAxisAndDistance();
- }
-
- if (aMethodType == CREATION_METHOD_BY_DIMENSIONS()) {
- performTranslationByDimensions();
- }
+ GeomTrsfPtr aTrsf;
+ if (aMethodType == CREATION_METHOD_BY_DISTANCE())
+ aTrsf = translationByAxisAndDistance();
+ else if (aMethodType == CREATION_METHOD_BY_DIMENSIONS())
+ aTrsf = translationByDimensions();
+ else if (aMethodType == CREATION_METHOD_BY_TWO_POINTS())
+ aTrsf = translationByTwoPoints();
- if (aMethodType == CREATION_METHOD_BY_TWO_POINTS()) {
- performTranslationByTwoPoints();
- }
+ performTranslation(aTrsf);
}
//=================================================================================================
-void FeaturesPlugin_Translation::performTranslationByAxisAndDistance()
+GeomTrsfPtr FeaturesPlugin_Translation::translationByAxisAndDistance()
{
- // Getting objects.
- ListOfShape anObjects;
- std::list<ResultPtr> aContextes;
- AttributeSelectionListPtr anObjectsSelList =
- selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID());
- if (anObjectsSelList->size() == 0) {
- return;
- }
- for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
- anObjectsSelList->value(anObjectsIndex);
- std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
- if(!anObject.get()) { // may be for not-activated parts
- return;
- }
- anObjects.push_back(anObject);
- aContextes.push_back(anObjectAttr->context());
- }
-
//Getting axis.
static const std::string aSelectionError = "Error: The axis shape selection is bad.";
AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
}
if (!aShape.get()) {
setError(aSelectionError);
- return;
+ return GeomTrsfPtr();
}
GeomEdgePtr anEdge;
if (!anEdge.get())
{
setError(aSelectionError);
- return;
+ return GeomTrsfPtr();
}
std::shared_ptr<GeomAPI_Ax1> anAxis(new GeomAPI_Ax1(anEdge->line()->location(),
anEdge->line()->direction()));
-
// Getting distance.
double aDistance = real(FeaturesPlugin_Translation::DISTANCE_ID())->value();
- // Moving each object.
- std::string anError;
- int aResultIndex = 0;
- std::list<ResultPtr>::iterator aContext = aContextes.begin();
- for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
- anObjectsIt++, aContext++) {
- std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
- bool isPart = aContext->get() && (*aContext)->groupName() == ModelAPI_ResultPart::group();
-
- // Setting result.
- if (isPart) {
- std::shared_ptr<GeomAPI_Trsf> aTrsf(new GeomAPI_Trsf());
- aTrsf->setTranslation(anAxis, aDistance);
- ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aContext);
- ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex);
- aResultPart->setTrsf(*aContext, aTrsf);
- setResult(aResultPart, aResultIndex);
- } else {
- std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
- new GeomAlgoAPI_Translation(aBaseShape, anAxis, aDistance));
- // Checking that the algorithm worked properly.
- if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
- setError(anError);
- break;
- }
-
- ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-
- ListOfShape aShapes;
- aShapes.push_back(aBaseShape);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
- aShapes,
- ListOfShape(),
- aTranslationAlgo,
- aTranslationAlgo->shape(),
- "Translated");
- setResult(aResultBody, aResultIndex);
- }
- aResultIndex++;
- }
-
- // Remove the rest results if there were produced in the previous pass.
- removeResults(aResultIndex);
+ GeomTrsfPtr aTrsf(new GeomAPI_Trsf);
+ aTrsf->setTranslation(anAxis, aDistance);
+ return aTrsf;
}
//=================================================================================================
-void FeaturesPlugin_Translation::performTranslationByDimensions()
+GeomTrsfPtr FeaturesPlugin_Translation::translationByDimensions()
{
- // Getting objects.
- ListOfShape anObjects;
- std::list<ResultPtr> aContextes;
- AttributeSelectionListPtr anObjectsSelList =
- selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID());
- if (anObjectsSelList->size() == 0) {
- return;
- }
- for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
- anObjectsSelList->value(anObjectsIndex);
- std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
- if(!anObject.get()) { // may be for not-activated parts
- return;
- }
- anObjects.push_back(anObject);
- aContextes.push_back(anObjectAttr->context());
- }
-
// Getting dimensions in X, in Y and in Z
double aDX = real(FeaturesPlugin_Translation::DX_ID())->value();
double aDY = real(FeaturesPlugin_Translation::DY_ID())->value();
double aDZ = real(FeaturesPlugin_Translation::DZ_ID())->value();
- // Moving each object.
- std::string anError;
- int aResultIndex = 0;
- std::list<ResultPtr>::iterator aContext = aContextes.begin();
- for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
- anObjectsIt++, aContext++) {
- std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
- bool isPart = aContext->get() && (*aContext)->groupName() == ModelAPI_ResultPart::group();
-
- // Setting result.
- if (isPart) {
- std::shared_ptr<GeomAPI_Trsf> aTrsf(new GeomAPI_Trsf());
- aTrsf->setTranslation(aDX, aDY, aDZ);
- ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aContext);
- ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex);
- aResultPart->setTrsf(*aContext, aTrsf);
- setResult(aResultPart, aResultIndex);
- } else {
- std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
- new GeomAlgoAPI_Translation(aBaseShape, aDX, aDY, aDZ));
-
- // Checking that the algorithm worked properly.
- if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
- setError(anError);
- break;
- }
-
- ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-
- ListOfShape aShapes;
- aShapes.push_back(aBaseShape);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
- aShapes,
- ListOfShape(),
- aTranslationAlgo,
- aTranslationAlgo->shape(),
- "Translated");
- setResult(aResultBody, aResultIndex);
- }
- aResultIndex++;
- }
-
- // Remove the rest results if there were produced in the previous pass.
- removeResults(aResultIndex);
+ GeomTrsfPtr aTrsf(new GeomAPI_Trsf);
+ aTrsf->setTranslation(aDX, aDY, aDZ);
+ return aTrsf;
}
//=================================================================================================
-void FeaturesPlugin_Translation::performTranslationByTwoPoints()
+GeomTrsfPtr FeaturesPlugin_Translation::translationByTwoPoints()
{
- // Getting objects.
- ListOfShape anObjects;
- std::list<ResultPtr> aContextes;
- AttributeSelectionListPtr anObjectsSelList =
- selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID());
- if (anObjectsSelList->size() == 0) {
- return;
- }
- for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- std::shared_ptr<ModelAPI_AttributeSelection> anObjectAttr =
- anObjectsSelList->value(anObjectsIndex);
- std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
- if(!anObject.get()) { // may be for not-activated parts
- return;
- }
- anObjects.push_back(anObject);
- aContextes.push_back(anObjectAttr->context());
- }
-
// Getting the start point and the end point
AttributeSelectionPtr aRef1 = data()->selection(FeaturesPlugin_Translation::START_POINT_ID());
AttributeSelectionPtr aRef2 = data()->selection(FeaturesPlugin_Translation::END_POINT_ID());
}
}
- // Moving each object.
+ GeomTrsfPtr aTrsf(new GeomAPI_Trsf);
+ aTrsf->setTranslation(aFirstPoint, aSecondPoint);
+ return aTrsf;
+}
+
+//=================================================================================================
+void FeaturesPlugin_Translation::performTranslation(const GeomTrsfPtr& theTrsf)
+{
+ if (!theTrsf)
+ return;
+
+ bool isKeepSubShapes = data()->version() == TRANSLATION_VERSION_1;
+
+ // Getting objects.
+ GeomAPI_ShapeHierarchy anObjects;
+ std::list<ResultPtr> aParts;
+ AttributeSelectionListPtr anObjectsSelList = selectionList(OBJECTS_LIST_ID());
+ if (!FeaturesPlugin_Tools::shapesFromSelectionList(
+ anObjectsSelList, isKeepSubShapes, anObjects, aParts))
+ return;
+
std::string anError;
int aResultIndex = 0;
- std::list<ResultPtr>::iterator aContext = aContextes.begin();
- for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
- anObjectsIt++, aContext++) {
+ // Moving each part.
+ for (std::list<ResultPtr>::iterator aPRes = aParts.begin(); aPRes != aParts.end(); ++aPRes) {
+ ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aPRes);
+ ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex);
+ aResultPart->setTrsf(anOrigin, theTrsf);
+ setResult(aResultPart, aResultIndex++);
+ }
+
+ // Collect transformations for each object in a part.
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList);
+
+ for (GeomAPI_ShapeHierarchy::iterator anObjectsIt = anObjects.begin();
+ anObjectsIt != anObjects.end(); anObjectsIt++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
- bool isPart = aContext->get() && (*aContext)->groupName() == ModelAPI_ResultPart::group();
-
- // Setting result.
- if (isPart) {
- std::shared_ptr<GeomAPI_Trsf> aTrsf(new GeomAPI_Trsf());
- aTrsf->setTranslation(aFirstPoint, aSecondPoint);
- ResultPartPtr anOrigin = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aContext);
- ResultPartPtr aResultPart = document()->copyPart(anOrigin, data(), aResultIndex);
- aResultPart->setTrsf(*aContext, aTrsf);
- setResult(aResultPart, aResultIndex);
- } else {
- std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
- new GeomAlgoAPI_Translation(aBaseShape, aFirstPoint, aSecondPoint));
-
- // Checking that the algorithm worked properly.
- if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
- setError(anError);
- break;
- }
-
- ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-
- ListOfShape aShapes;
- aShapes.push_back(aBaseShape);
- FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
- aShapes,
- ListOfShape(),
- aTranslationAlgo,
- aTranslationAlgo->shape(),
- "Translated");
- setResult(aResultBody, aResultIndex);
+ std::shared_ptr<GeomAlgoAPI_Transform> aTransformAlgo(
+ new GeomAlgoAPI_Transform(aBaseShape, theTrsf));
+
+ // Checking that the algorithm worked properly.
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTransformAlgo, getKind(), anError)) {
+ setError(anError);
+ break;
}
- aResultIndex++;
+
+ anObjects.markModified(aBaseShape, aTransformAlgo->shape());
+ aMakeShapeList->appendAlgo(aTransformAlgo);
+ }
+
+ // Build results of the operation.
+ const ListOfShape& anOriginalShapes = anObjects.objects();
+ ListOfShape aTopLevel;
+ anObjects.topLevelObjects(aTopLevel);
+ for (ListOfShape::iterator anIt = aTopLevel.begin(); anIt != aTopLevel.end(); ++anIt) {
+ //LoadNamingDS
+ ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, anOriginalShapes, ListOfShape(),
+ aMakeShapeList, *anIt, "Translated");
+ setResult(aResultBody, aResultIndex++);
}
// Remove the rest results if there were produced in the previous pass.
#include <ModelAPI_Feature.h>
-#include <GeomAlgoAPI_Translation.h>
+class GeomAPI_Trsf;
/// \class FeaturesPlugin_Translation
/// \ingroup Plugins
FeaturesPlugin_Translation();
private:
- ///Perform the translation using an axis and a distance.
- void performTranslationByAxisAndDistance();
+ /// Calculate the translation using an axis and a distance.
+ std::shared_ptr<GeomAPI_Trsf> translationByAxisAndDistance();
- ///Perform the translation using three dimensions X, Y and Z
- void performTranslationByDimensions();
+ /// Calculate the translation using three dimensions X, Y and Z
+ std::shared_ptr<GeomAPI_Trsf> translationByDimensions();
- ///Perform the translation usind two points
- void performTranslationByTwoPoints();
+ /// Calculate the translation usind two points
+ std::shared_ptr<GeomAPI_Trsf> translationByTwoPoints();
+
+ /// Perform the translation
+ void performTranslation(const std::shared_ptr<GeomAPI_Trsf>& theTrsf);
};
#endif
model.end()
-# selection of a compound part is prohibited
+# selection of a compsolid part is prohibited
assert(Placement_1.feature().error() != "")
# change the placement arguments
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10)
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_3 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True)
+SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True)
+[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated()
+model.do()
+Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchCircle_1.results()[1]],
+ [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchCircle_2.results()[1]],
+ [SketchCircle_3.results()[1]]
+ ])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")])
+Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")]
+Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
+model.end()
+
+DISTANCE = 10
+TOLERANCE = 1.e-7
+
+model.begin()
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("EDGE", "PartSet/OX"), DISTANCE)
+model.testNbResults(Translation_1, 1)
+model.testNbSubResults(Translation_1, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [5])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [18])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [36])
+model.testResultsVolumes(Translation_1, [542.746463956])
+
+refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setX(refPoint.x() + DISTANCE)
+midPoint = Translation_1.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_1 = model.addRecover(Part_1_doc, Translation_1, [Compound_2.result()], True)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("EDGE", "PartSet/OY"), DISTANCE)
+model.testNbResults(Translation_2, 1)
+model.testNbSubResults(Translation_2, [0])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Translation_2, [785.39816339745])
+
+refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setY(refPoint.y() + DISTANCE)
+midPoint = Translation_2.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_2 = model.addRecover(Part_1_doc, Translation_2, [Recover_1.result()], True)
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_3, 1)
+model.testNbSubResults(Translation_3, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Translation_3, [785.39816339745])
+
+refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_3.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_3 = model.addRecover(Part_1_doc, Translation_3, [Recover_2.result()], True)
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("EDGE", "PartSet/OZ"), -DISTANCE)
+model.testNbResults(Translation_4, 3)
+model.testNbSubResults(Translation_4, [0, 0, 0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1, 1, 1])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6, 3, 3])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24, 6, 6])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48, 12, 12])
+model.testResultsVolumes(Translation_4, [3444.394198615, 785.39816339745, 785.39816339745])
+
+REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(),
+ Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(),
+ Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()]
+for res, ref in zip(Translation_4.results(), REFERENCE):
+ ref.setZ(ref.z() - DISTANCE)
+ midPoint = res.resultSubShapePair()[0].shape().middlePoint()
+ assert(midPoint.distance(ref) < TOLERANCE)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10)
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_3 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True)
+SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True)
+[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated()
+model.do()
+Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchCircle_1.results()[1]],
+ [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchCircle_2.results()[1]],
+ [SketchCircle_3.results()[1]]
+ ])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")])
+Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")]
+Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
+model.end()
+
+DX = 15
+DY = 20
+DZ = 25
+TOLERANCE = 1.e-7
+
+model.begin()
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], DX, 0, 0)
+model.testNbResults(Translation_1, 1)
+model.testNbSubResults(Translation_1, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [5])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [18])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [36])
+model.testResultsVolumes(Translation_1, [542.746463956])
+
+refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setX(refPoint.x() + DX)
+midPoint = Translation_1.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_1 = model.addRecover(Part_1_doc, Translation_1, [Compound_2.result()], True)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], 0, DY, 0)
+model.testNbResults(Translation_2, 1)
+model.testNbSubResults(Translation_2, [0])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Translation_2, [785.39816339745])
+
+refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setY(refPoint.y() + DY)
+midPoint = Translation_2.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_2 = model.addRecover(Part_1_doc, Translation_2, [Recover_1.result()], True)
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], 0, 0, DZ)
+model.testNbResults(Translation_3, 1)
+model.testNbSubResults(Translation_3, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Translation_3, [785.39816339745])
+
+refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setZ(refPoint.z() + DZ)
+midPoint = Translation_3.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_3 = model.addRecover(Part_1_doc, Translation_3, [Recover_2.result()], True)
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], DX, DY, DZ)
+model.testNbResults(Translation_4, 3)
+model.testNbSubResults(Translation_4, [0, 0, 0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1, 1, 1])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6, 3, 3])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24, 6, 6])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48, 12, 12])
+model.testResultsVolumes(Translation_4, [3444.394198615, 785.39816339745, 785.39816339745])
+
+REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(),
+ Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(),
+ Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()]
+for res, ref in zip(Translation_4.results(), REFERENCE):
+ ref.setX(ref.x() + DX)
+ ref.setY(ref.y() + DY)
+ ref.setZ(ref.z() + DZ)
+ midPoint = res.resultSubShapePair()[0].shape().middlePoint()
+ assert(midPoint.distance(ref) < TOLERANCE)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+from GeomAPI import *
+from SketchAPI import *
+
+MAJOR_AXIS = 30
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10)
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), MAJOR_AXIS)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_3 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True)
+SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True)
+[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated()
+model.do()
+Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchCircle_1.results()[1]],
+ [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchCircle_2.results()[1]],
+ [SketchCircle_3.results()[1]]
+ ])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")])
+Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")]
+Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
+model.end()
+
+TOLERANCE = 1.e-7
+
+model.begin()
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"))
+model.testNbResults(Translation_1, 1)
+model.testNbSubResults(Translation_1, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [5])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [18])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [36])
+model.testResultsVolumes(Translation_1, [542.746463956])
+
+refPoint = Extrusion_1.results()[0].subResult(4).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setX(refPoint.x() + MAJOR_AXIS)
+midPoint = Translation_1.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_1 = model.addRecover(Part_1_doc, Translation_1, [Compound_2.result()], True)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_1_1_2_1")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"))
+model.testNbResults(Translation_2, 1)
+model.testNbSubResults(Translation_2, [0])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Translation_2, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Translation_2, [785.39816339745])
+
+refPoint = Recover_1.result().subResult(1).subResult(0).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setX(refPoint.x() + MAJOR_AXIS)
+midPoint = Translation_2.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_2 = model.addRecover(Part_1_doc, Translation_2, [Recover_1.result()], True)
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_2_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"))
+model.testNbResults(Translation_3, 1)
+model.testNbSubResults(Translation_3, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Translation_3, [785.39816339745])
+
+refPoint = Recover_2.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()
+refPoint.setX(refPoint.x() + MAJOR_AXIS)
+midPoint = Translation_3.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+
+Recover_3 = model.addRecover(Part_1_doc, Translation_3, [Recover_2.result()], True)
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_3_1_1_1"), model.selection("SOLID", "Recover_3_1_2_2"), model.selection("SOLID", "Recover_3_1_3")], model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"))
+model.testNbResults(Translation_4, 3)
+model.testNbSubResults(Translation_4, [0, 0, 0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1, 1, 1])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6, 3, 3])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24, 6, 6])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48, 12, 12])
+model.testResultsVolumes(Translation_4, [3444.394198615, 785.39816339745, 785.39816339745])
+
+REFERENCE = [Recover_3.result().subResult(0).subResult(0).resultSubShapePair()[0].shape().middlePoint(),
+ Recover_3.result().subResult(1).subResult(1).resultSubShapePair()[0].shape().middlePoint(),
+ Recover_3.result().subResult(2).resultSubShapePair()[0].shape().middlePoint()]
+for res, ref in zip(Translation_4.results(), REFERENCE):
+ ref.setX(ref.x() + MAJOR_AXIS)
+ midPoint = res.resultSubShapePair()[0].shape().middlePoint()
+ assert(midPoint.distance(ref) < TOLERANCE)
+
+model.end()
+
+assert(model.checkPythonDump(model.CHECK_NAMING))
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031)
+SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center())
+SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117)
+SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547)
+SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154)
+SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154)
+SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371)
+SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362)
+SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362)
+SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result())
+SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result())
+model.do()
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False)
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")])
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")])
+Box_3 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OY"), 50)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3)
+model.end()
+
+DISTANCE = 10
+TOLERANCE = 1.e-7
+
+model.begin()
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_3, 1)
+model.testNbSubResults(Translation_3, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [1])
+model.testResultsVolumes(Translation_3, [0])
+refPoint = Vertex_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_3.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_4, 1)
+model.testNbSubResults(Translation_4, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [1])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [2])
+model.testResultsVolumes(Translation_4, [0])
+refPoint = Edge_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_4.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_5, 1)
+model.testNbSubResults(Translation_5, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.EDGE, [2])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.VERTEX, [4])
+model.testResultsVolumes(Translation_5, [0])
+refPoint = Wire_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_5.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_6, 1)
+model.testNbSubResults(Translation_6, [0])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Translation_6, [109.154152964914914])
+refPoint = Face_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_6.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_7, 1)
+model.testNbSubResults(Translation_7, [0])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.VERTEX, [16])
+model.testResultsVolumes(Translation_7, [182.822012116])
+refPoint = Shell_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_7.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_8, 1)
+model.testNbSubResults(Translation_8, [0])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Translation_8, [1000])
+refPoint = Translation_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_8.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_9, 1)
+model.testNbSubResults(Translation_9, [3])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.FACE, [17])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.EDGE, [66])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.VERTEX, [132])
+model.testResultsVolumes(Translation_9, [1589.0486226])
+refPoint = Partition_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_9.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_10, 1)
+model.testNbSubResults(Translation_10, [3])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.FACE, [18])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.EDGE, [72])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.VERTEX, [144])
+model.testResultsVolumes(Translation_10, [3000])
+refPoint = AngularCopy_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_10.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031)
+SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center())
+SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117)
+SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547)
+SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154)
+SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154)
+SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371)
+SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362)
+SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362)
+SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result())
+SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result())
+model.do()
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False)
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")])
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")])
+Box_3 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OY"), 50)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3)
+Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")]
+Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
+model.end()
+
+# collect reference data
+DISTANCE = 10
+REFERENCE = []
+TOLERANCE = 1.e-7
+for ind in range(0, Compound_1.result().numberOfSubs()):
+ p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint()
+ p.setZ(p.z() + DISTANCE)
+ REFERENCE.append(p)
+
+index = 0
+
+model.begin()
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_3, 1)
+model.testNbSubResults(Translation_3, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [1])
+model.testResultsVolumes(Translation_3, [0])
+midPoint = Translation_3.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+index += 1
+
+Recover_1 = model.addRecover(Part_1_doc, Translation_3, [Compound_1.result()], True)
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Recover_1_1_2")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_4, 1)
+model.testNbSubResults(Translation_4, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [1])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [2])
+model.testResultsVolumes(Translation_4, [0])
+midPoint = Translation_4.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+index += 1
+
+Recover_2 = model.addRecover(Part_1_doc, Translation_4, [Recover_1.result()])
+Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Recover_2_1_3")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_5, 1)
+model.testNbSubResults(Translation_5, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.EDGE, [2])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.VERTEX, [4])
+model.testResultsVolumes(Translation_5, [0])
+midPoint = Translation_5.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+index += 1
+
+Recover_3 = model.addRecover(Part_1_doc, Translation_5, [Recover_2.result()])
+Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1_4")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_6, 1)
+model.testNbSubResults(Translation_6, [0])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Translation_6, [109.154152964914914])
+midPoint = Translation_6.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+index += 1
+
+Recover_4 = model.addRecover(Part_1_doc, Translation_6, [Recover_3.result()])
+Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Recover_4_1_5")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_7, 1)
+model.testNbSubResults(Translation_7, [0])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.VERTEX, [16])
+model.testResultsVolumes(Translation_7, [182.822012116])
+midPoint = Translation_7.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+index += 1
+
+Recover_5 = model.addRecover(Part_1_doc, Translation_7, [Recover_4.result()])
+Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Recover_5_1_6")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_8, 1)
+model.testNbSubResults(Translation_8, [0])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Translation_8, [1000])
+midPoint = Translation_8.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+index += 1
+
+Recover_6 = model.addRecover(Part_1_doc, Translation_8, [Recover_5.result()])
+Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Recover_6_1_7")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_9, 1)
+model.testNbSubResults(Translation_9, [3])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.FACE, [17])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.EDGE, [66])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.VERTEX, [132])
+model.testResultsVolumes(Translation_9, [1589.0486226])
+midPoint = Translation_9.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+index += 1
+
+Recover_7 = model.addRecover(Part_1_doc, Translation_9, [Recover_6.result()])
+Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Recover_7_1_8")], model.selection("EDGE", "PartSet/OZ"), DISTANCE)
+model.testNbResults(Translation_10, 1)
+model.testNbSubResults(Translation_10, [3])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.FACE, [18])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.EDGE, [72])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.VERTEX, [144])
+model.testResultsVolumes(Translation_10, [3000])
+midPoint = Translation_10.defaultResult().shape().middlePoint()
+assert(midPoint.distance(REFERENCE[index]) < TOLERANCE)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10)
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_3 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True)
+SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True)
+[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated()
+model.do()
+Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchCircle_1.results()[1]],
+ [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchCircle_2.results()[1]],
+ [SketchCircle_3.results()[1]]
+ ])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")])
+Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")]
+Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
+model.end()
+
+DISTANCE = 10
+TOLERANCE = 1.e-7
+REFERENCE = []
+for ind in range(0, Compound_2.result().numberOfSubs()):
+ p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint()
+ REFERENCE.append(p)
+
+def assertResult(theFeature):
+ model.testNbResults(theFeature, 1)
+ model.testNbSubResults(theFeature, [3])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [10])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.FACE, [47])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.EDGE, [162])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.VERTEX, [324])
+ model.testResultsVolumes(theFeature, [14319.99602674256])
+
+ for ind in range(0, theFeature.result().numberOfSubs()):
+ ref = REFERENCE[ind]
+ midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint()
+ assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z())
+
+
+model.begin()
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], axis = model.selection("EDGE", "PartSet/OX"), distance = DISTANCE, keepSubResults = True)
+model.end()
+# selection of a compsolid part is prohibited
+assert(Translation_1.feature().error() != "")
+
+model.begin()
+Translation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")])
+REFERENCE[0].setX(REFERENCE[0].x() + DISTANCE)
+assertResult(Translation_1)
+
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1_2_1")], axis = model.selection("EDGE", "PartSet/OY"), distance = DISTANCE, keepSubResults = True)
+REFERENCE[1].setY(REFERENCE[1].y() + DISTANCE / 2)
+assertResult(Translation_2)
+
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_2_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+REFERENCE[2].setZ(REFERENCE[2].z() + DISTANCE)
+assertResult(Translation_3)
+
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_3_1_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), distance = -DISTANCE, keepSubResults = True)
+model.end()
+# selection of a compsolid part is prohibited
+assert(Translation_4.feature().error() != "")
+
+model.begin()
+Translation_4.setMainObjects([model.selection("COMPSOLID", "Translation_3_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")])
+REFERENCE[0].setZ(REFERENCE[0].z() - DISTANCE)
+REFERENCE[1].setZ(REFERENCE[1].z() - DISTANCE / 2)
+REFERENCE[2].setZ(REFERENCE[2].z() - DISTANCE)
+assertResult(Translation_4)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+from GeomAPI import *
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10)
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 30)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_3 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True)
+SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True)
+[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated()
+model.do()
+Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchCircle_1.results()[1]],
+ [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchCircle_2.results()[1]],
+ [SketchCircle_3.results()[1]]
+ ])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")])
+Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")]
+Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
+model.end()
+
+DX = 15
+DY = 20
+DZ = 25
+TOLERANCE = 1.e-7
+REFERENCE = []
+for ind in range(0, Compound_2.result().numberOfSubs()):
+ p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint()
+ REFERENCE.append(p)
+
+def assertResult(theFeature):
+ model.testNbResults(theFeature, 1)
+ model.testNbSubResults(theFeature, [3])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [10])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.FACE, [47])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.EDGE, [162])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.VERTEX, [324])
+ model.testResultsVolumes(theFeature, [14319.99602674256])
+
+ for ind in range(0, theFeature.result().numberOfSubs()):
+ ref = REFERENCE[ind]
+ midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint()
+ assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z())
+
+
+model.begin()
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], vector = [DX, 0, 0], keepSubResults = True)
+model.end()
+# selection of a compsolid part is prohibited
+assert(Translation_1.feature().error() != "")
+
+model.begin()
+Translation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")])
+REFERENCE[0].setX(REFERENCE[0].x() + DX)
+assertResult(Translation_1)
+
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1_2_1")], vector = [0, DY, 0], keepSubResults = True)
+REFERENCE[1].setY(REFERENCE[1].y() + DY / 2)
+assertResult(Translation_2)
+
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_2_1_3")], vector = [0, 0, DZ], keepSubResults = True)
+REFERENCE[2].setZ(REFERENCE[2].z() + DZ)
+assertResult(Translation_3)
+
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_3_1_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")], vector = [DX, DY, DZ], keepSubResults = True)
+model.end()
+# selection of a compsolid part is prohibited
+assert(Translation_4.feature().error() != "")
+
+model.begin()
+Translation_4.setMainObjects([model.selection("COMPSOLID", "Translation_3_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")])
+REFERENCE = [GeomAPI_Pnt(REFERENCE[0].x() + DX, REFERENCE[0].y() + DY, REFERENCE[0].z() + DZ),
+ GeomAPI_Pnt(REFERENCE[1].x() + DX / 2, REFERENCE[1].y() + DY / 2, REFERENCE[1].z() + DZ / 2),
+ GeomAPI_Pnt(REFERENCE[2].x() + DX, REFERENCE[2].y() + DY, REFERENCE[2].z() + DZ)]
+assertResult(Translation_4)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+
+from GeomAPI import *
+from SketchAPI import *
+
+MAJOR_AXIS = 30
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchEllipse_1 = Sketch_1.addEllipse(11.18033988749894, -50, 22.36067977499789, -50, 10)
+[SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_1, SketchLine_2] = SketchEllipse_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), MAJOR_AXIS)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 20)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_3 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_3.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_3).startPoint(), SketchAPI_Point(SketchPoint_3).coordinates(), 50, True)
+SketchCircle_1 = Sketch_1.addCircle(41.18033988749897, -50, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchEllipse_1.majorAxisPositive(), SketchCircle_1.center(), 15, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchEllipse_1.result(), SketchCircle_1.results()[1]], SketchAPI_Point(SketchPoint_3).coordinates(), 360, 3, True)
+[SketchEllipse_2, SketchEllipse_3, SketchCircle_2, SketchCircle_3] = SketchMultiRotation_1.rotated()
+model.do()
+Sketch_1.changeFacesOrder([[SketchEllipse_1.result(), SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchCircle_1.results()[1]],
+ [SketchEllipse_2.result(), SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_3.result(), SketchEllipse_2.result(), SketchEllipse_1.result()],
+ [SketchEllipse_1.result(), SketchEllipse_2.result(), SketchEllipse_3.result()],
+ [SketchEllipse_1.result(), SketchEllipse_3.result(), SketchEllipse_2.result()],
+ [SketchEllipse_2.result(), SketchEllipse_3.result(), SketchEllipse_3.result(), SketchEllipse_1.result()],
+ [SketchCircle_2.results()[1]],
+ [SketchCircle_3.results()[1]]
+ ])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")])
+Compound_2_objects = [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPOUND", "Compound_1_1"), model.selection("SOLID", "Extrusion_1_4")]
+Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
+model.end()
+
+TOLERANCE = 1.e-7
+REFERENCE = []
+for ind in range(0, Compound_2.result().numberOfSubs()):
+ p = Compound_2.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint()
+ REFERENCE.append(p)
+
+def assertResult(theFeature):
+ model.testNbResults(theFeature, 1)
+ model.testNbSubResults(theFeature, [3])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [10])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.FACE, [47])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.EDGE, [162])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.VERTEX, [324])
+ model.testResultsVolumes(theFeature, [14319.99602674256])
+
+ for ind in range(0, theFeature.result().numberOfSubs()):
+ ref = REFERENCE[ind]
+ midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint()
+ assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z())
+
+
+model.begin()
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Compound_2_1_1_5")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), keepSubResults = True)
+model.end()
+# selection of a compsolid part is prohibited
+assert(Translation_1.feature().error() != "")
+
+model.begin()
+Translation_1.setMainObjects([model.selection("COMPSOLID", "Compound_2_1_1")])
+REFERENCE[0].setX(REFERENCE[0].x() + MAJOR_AXIS)
+assertResult(Translation_1)
+
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1_2_1")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), keepSubResults = True)
+REFERENCE[1].setX(REFERENCE[1].x() + MAJOR_AXIS / 2)
+assertResult(Translation_2)
+
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_2_1_3")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), keepSubResults = True)
+REFERENCE[2].setX(REFERENCE[2].x() + MAJOR_AXIS)
+assertResult(Translation_3)
+
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_3_1_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")], startPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_major_axis_EndVertex"), endPoint = model.selection("VERTEX", "Sketch_1/SketchEllipse_1_ellipse_major_axis_start_point"), keepSubResults = True)
+model.end()
+# selection of a compsolid part is prohibited
+assert(Translation_4.feature().error() != "")
+
+model.begin()
+Translation_4.setMainObjects([model.selection("COMPSOLID", "Translation_3_1_1"), model.selection("SOLID", "Translation_3_1_2_2"), model.selection("SOLID", "Translation_3_1_3")])
+REFERENCE[0].setX(REFERENCE[0].x() - MAJOR_AXIS)
+REFERENCE[1].setX(REFERENCE[1].x() - MAJOR_AXIS / 2)
+REFERENCE[2].setX(REFERENCE[2].x() - MAJOR_AXIS)
+assertResult(Translation_4)
+
+model.end()
+
+assert(model.checkPythonDump(model.CHECK_NAMING))
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031)
+SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center())
+SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117)
+SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547)
+SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154)
+SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154)
+SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371)
+SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362)
+SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362)
+SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result())
+SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result())
+model.do()
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False)
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")])
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True)
+Box_3 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OY"), 50)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3)
+model.end()
+
+DISTANCE = 10
+TOLERANCE = 1.e-7
+
+model.begin()
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_3, 1)
+model.testNbSubResults(Translation_3, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [0])
+model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [1])
+model.testResultsVolumes(Translation_3, [0])
+refPoint = Vertex_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_3.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_4, 1)
+model.testNbSubResults(Translation_4, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [1])
+model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [2])
+model.testResultsVolumes(Translation_4, [0])
+refPoint = Edge_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_4.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_5, 1)
+model.testNbSubResults(Translation_5, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.FACE, [0])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.EDGE, [2])
+model.testNbSubShapes(Translation_5, GeomAPI_Shape.VERTEX, [4])
+model.testResultsVolumes(Translation_5, [0])
+refPoint = Wire_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_5.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_6, 1)
+model.testNbSubResults(Translation_6, [0])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Translation_6, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Translation_6, [109.154152964914914])
+refPoint = Face_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_6.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_7, 1)
+model.testNbSubResults(Translation_7, [0])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Translation_7, GeomAPI_Shape.VERTEX, [16])
+model.testResultsVolumes(Translation_7, [182.822012116])
+refPoint = Shell_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_7.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_8, 1)
+model.testNbSubResults(Translation_8, [0])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Translation_8, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Translation_8, [1000])
+refPoint = Translation_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_8.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_9, 1)
+model.testNbSubResults(Translation_9, [3])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.FACE, [17])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.EDGE, [66])
+model.testNbSubShapes(Translation_9, GeomAPI_Shape.VERTEX, [132])
+model.testResultsVolumes(Translation_9, [1589.0486226])
+refPoint = Partition_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_9.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "AngularCopy_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+model.testNbResults(Translation_10, 1)
+model.testNbSubResults(Translation_10, [3])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.FACE, [18])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.EDGE, [72])
+model.testNbSubShapes(Translation_10, GeomAPI_Shape.VERTEX, [144])
+model.testResultsVolumes(Translation_10, [3000])
+refPoint = AngularCopy_1.defaultResult().shape().middlePoint()
+refPoint.setZ(refPoint.z() + DISTANCE)
+midPoint = Translation_10.defaultResult().shape().middlePoint()
+assert(midPoint.distance(refPoint) < TOLERANCE)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# Copyright (C) 2020 CEA/DEN, EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchPoint_1 = Sketch_1.addPoint(44.29784155360136, 17.09942588468031)
+SketchArc_1 = Sketch_1.addArc(44.29784155360136, 17.09942588468031, 47.1668727423061, 12.27945348765633, 45.38299232715926, 22.60269052200972, False)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.center())
+SketchLine_1 = Sketch_1.addLine(42.5764228403785, 22.14892077680068, 39.70739165167375, 16.41085839939117)
+SketchLine_2 = Sketch_1.addLine(39.70739165167375, 16.41085839939117, 43.03546783057126, 12.04993099255995)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(28.57555063949931, 12.96802097294547, 15.72229091410204, 12.96802097294547)
+SketchLine_4 = Sketch_1.addLine(15.72229091410204, 12.96802097294547, 15.72229091410204, 21.46035329151154)
+SketchLine_5 = Sketch_1.addLine(15.72229091410204, 21.46035329151154, 28.57555063949931, 21.46035329151154)
+SketchLine_6 = Sketch_1.addLine(28.57555063949931, 21.46035329151154, 28.57555063949931, 12.96802097294547)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchLine_7 = Sketch_1.addLine(-10.67279602198167, 14.78814178154371, -28.34602814440294, 14.78814178154371)
+SketchLine_8 = Sketch_1.addLine(-28.34602814440294, 14.78814178154371, -28.34602814440294, 25.13271321305362)
+SketchLine_9 = Sketch_1.addLine(-28.34602814440294, 25.13271321305362, -10.67279602198167, 25.13271321305362)
+SketchLine_10 = Sketch_1.addLine(-10.67279602198167, 25.13271321305362, -10.67279602198167, 14.78814178154371)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result())
+SketchLine_11 = Sketch_1.addLine(-17.67323212242127, 25.13271321305362, -21.80463703415611, 14.78814178154371)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.startPoint(), SketchLine_9.result())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_7.result())
+model.do()
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchArc_1")], False)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")], False)
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")], False)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_11f-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_9r-SketchLine_8r-SketchLine_7r")])
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("SOLID", "Cylinder_1_1")], keepSubResults = True)
+Box_3 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OY"), 50)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_2_1")], model.selection("EDGE", "PartSet/OZ"), 30, 3)
+Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("WIRE", "Wire_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Translation_1_1"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPOUND", "AngularCopy_1_1")]
+Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
+model.end()
+
+# collect reference data
+DISTANCE = 10
+REFERENCE = []
+TOLERANCE = 1.e-7
+for ind in range(0, Compound_1.result().numberOfSubs()):
+ p = Compound_1.result().subResult(ind).resultSubShapePair()[1].middlePoint()
+ REFERENCE.append(p)
+
+def assertResult(theFeature, theNbMoved):
+ model.testNbResults(theFeature, 1)
+ model.testNbSubResults(theFeature, [8])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.SOLID, [7])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.FACE, [44])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.EDGE, [177])
+ model.testNbSubShapes(theFeature, GeomAPI_Shape.VERTEX, [355])
+ model.testResultsVolumes(theFeature, [5589.0486226])
+
+ for ind in range(0, theFeature.result().numberOfSubs()):
+ ref = GeomAPI_Pnt(REFERENCE[ind].x(), REFERENCE[ind].y(), REFERENCE[ind].z())
+ if ind < theNbMoved:
+ ref.setZ(ref.z() + DISTANCE)
+ midPoint = theFeature.result().subResult(ind).resultSubShapePair()[0].shape().middlePoint()
+ assert(midPoint.distance(ref) < TOLERANCE), "Sub-result {}; actual ({}, {}, {}) != expected ({}, {}, {})".format(ind, midPoint.x(), midPoint.y(), midPoint.z(), ref.x(), ref.y(), ref.z())
+
+
+model.begin()
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Compound_1_1_1")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_3, 1)
+
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Translation_3_1_2")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_4, 2)
+
+Translation_5 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Translation_4_1_3")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_5, 3)
+
+Translation_6 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Translation_5_1_4")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_6, 4)
+
+Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Translation_6_1_5")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_7, 5)
+
+Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_7_1_6")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_8, 6)
+
+Translation_9 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Translation_8_1_7")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_9, 7)
+
+Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Translation_9_1_8")], axis = model.selection("EDGE", "PartSet/OZ"), distance = DISTANCE, keepSubResults = True)
+assertResult(Translation_10, 8)
+
+model.end()
+
+assert(model.checkPythonDump())
}
GeomTrsfPtr aTrsf(new GeomAPI_Trsf);
- aTrsf->setRotation(theAxis, theAngle / 180.0 * M_PI);
+ aTrsf->setRotation(theAxis, theAngle);
build(theSourceShape, aTrsf);
}
std::shared_ptr<GeomAPI_Trsf> theTrsf)
{
if (!theSourceShape || !theTrsf) {
- myError = "Transformation :: incorrect input data";
+ myError = "Transformation :: incorrect input data.";
return;
}
try:
Translation_22 = shaperpy.makeTranslation(None, ax1, 15.)
except myExcept as ec:
- assert(ec.what() == "Translation builder :: source shape is not valid.")
+ assert(ec.what() == "Transformation :: incorrect input data.")
try:
Translation_23 = shaperpy.makeTranslation(None, 10., 20., 15.)
except myExcept as ec:
- assert(ec.what() == "Translation builder :: source shape is not valid.")
+ assert(ec.what() == "Transformation :: incorrect input data.")
try:
Translation_24 = shaperpy.makeTranslation(None, pnt1, pnt2)
except myExcept as ec:
- assert(ec.what() == "Translation builder :: source shape is invalid.")
+ assert(ec.what() == "Transformation :: incorrect input data.")
try:
Translation_25 = shaperpy.makeTranslation(shape(), ax1, 15.)
except myExcept as ec:
- assert(ec.what() == "Translation builder :: source shape does not contain any actual shape.")
+ assert(ec.what() == "Transformation :: source shape does not contain any actual shape.")