#include <ModelHighAPI_Tools.h>
//==================================================================================================
-FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(
- const std::shared_ptr<ModelAPI_Feature>& theFeature)
+FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptr<ModelAPI_Feature>& theFeature)
: ModelHighAPI_Interface(theFeature)
{
initialize();
: ModelHighAPI_Interface(theFeature)
{
if(initialize()) {
- fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theMainObjects, mainObjects());
GeomAPI_Shape::ShapeType aType = getShapeType(theObject);
if(aType == GeomAPI_Shape::VERTEX) {
setPoint(theObject);
//==================================================================================================
FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry()
{
-
}
//==================================================================================================
//==================================================================================================
void FeaturesAPI_Symmetry::dump(ModelHighAPI_Dumper& theDumper) const
{
- std::cout << "DUMP SYMMETRY" << std::endl;
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
theDumper << ", " << anAttrPlane;
}
- theDumper << ")" << std::endl;
+ theDumper << ")" << std::endl;
}
//==================================================================================================
"""
-Test case for Translation feature.
+Test case for Symmetry feature.
Written on High API.
"""
from ModelAPI import *
aSession.finishOperation()
# Create a box
-
aSession.startOperation()
aBox1 = model.addBox(aDocument, 10, 10, 10)
aBox2 = model.addBox(aDocument, 10, 10, 10)
aBox3 = model.addBox(aDocument, 10, 10, 10)
+aSession.finishOperation()
# Perform a symmetry by a point
aSession.startOperation()
#include <FeaturesPlugin_Symmetry.h>
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_AttributeString.h>
-#include <ModelAPI_ResultBody.h>
+#include <GeomAlgoAPI_PointBuilder.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Face.h>
#include <GeomAPI_Lin.h>
#include <GeomAPI_Pln.h>
-#include <GeomAlgoAPI_PointBuilder.h>
-
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
//=================================================================================================
/// Symmetry kind.
inline static const std::string& ID()
{
- static const std::string MY_SYMMETRY("Symmetry");
- return MY_SYMMETRY;
+ static const std::string MY_SYMMETRY_ID("Symmetry");
+ return MY_SYMMETRY_ID;
}
/// Attribute name for creation method.
return MY_CREATION_METHOD_ID;
}
- /// Attribute name for creation method "ByAxisAndDistance".
+ /// Attribute name for creation method "ByPoint".
inline static const std::string& CREATION_METHOD_BY_POINT()
{
static const std::string MY_CREATION_METHOD_ID("ByPoint");
return MY_CREATION_METHOD_ID;
}
- /// Attribute name for creation method "ByDimensions".
+ /// Attribute name for creation method "ByAxis".
inline static const std::string& CREATION_METHOD_BY_AXIS()
{
static const std::string MY_CREATION_METHOD_ID("ByAxis");
return MY_CREATION_METHOD_ID;
}
- /// Attribute name for creation method "ByTwoPoints".
+ /// Attribute name for creation method "ByPlane".
inline static const std::string& CREATION_METHOD_BY_PLANE()
{
static const std::string MY_CREATION_METHOD_ID("ByPlane");
FeaturesPlugin_Symmetry();
private:
- ///Perform symmetry with respect to a point.
+ /// Perform symmetry with respect to a point.
void performSymmetryByPoint();
- ///Perform symmetry with respect to an axis.
+ /// Perform symmetry with respect to an axis.
void performSymmetryByAxis();
- ///Perform symmetry with respect to a plane.
+ /// Perform symmetry with respect to a plane.
void performSymmetryByPlane();
+ /// Perform the naming
void loadNamingDS(GeomAlgoAPI_Symmetry& theSymmetryAlgo,
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
std::shared_ptr<GeomAPI_Shape> theBaseShape);
break;
}
default: {
- myError = "Mirror builder :: method not supported";
+ myError = "Symmetry builder :: method not supported";
return;
}
}
const TopoDS_Shape& aSourceShape = mySourceShape->impl<TopoDS_Shape>();
if(aSourceShape.IsNull()) {
- myError = "Mirror builder :: source shape does not contain any actual shape.";
+ myError = "Symmetry builder :: source shape does not contain any actual shape.";
return;
}
// Transform the shape while copying it.
BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true);
if(!aBuilder) {
- myError = "Mirror builder :: source shape does not contain any actual shape.";
+ myError = "Symmetry builder :: transform initialization failed.";
return;
}
setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
if(!aBuilder->IsDone()) {
- myError = "Mirror builder :: source shape does not contain any actual shape.";
+ myError = "Symmetry builder :: algorithm failed.";
return;
}
class GeomAlgoAPI_Symmetry : public GeomAlgoAPI_MakeShape
{
public:
- /// Type of mirror operation
+ /// Type of symmetry operation
enum MethodType {
BY_POINT, ///< Symmetry by point.
BY_AXIS, ///< Symmetry by axis.
/// \brief Creates an object which is obtained from current object by performing
/// a symmetry operation by a point.
- /// \param[in] theSourceShape a shape to be moved.
- /// \param[in] thePoint symmetry point.
+ /// \param[in] theSourceShape the shape to be moved.
+ /// \param[in] thePoint the symmetry point.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr<GeomAPI_Shape> theSourceShape,
std::shared_ptr<GeomAPI_Pnt> thePoint);
/// \brief Creates an object which is obtained from current object by performing
/// a symmetry operation by a point.
- /// \param[in] theSourceShape a shape to be moved.
- /// \param[in] theAxis symmetry axis.
+ /// \param[in] theSourceShape the shape to be moved.
+ /// \param[in] theAxis the symmetry axis.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr<GeomAPI_Shape> theSourceShape,
std::shared_ptr<GeomAPI_Ax1> theAxis);
/// \brief Creates an object which is obtained from current object by performing
/// a symmetry operation by a point.
- /// \param[in] theSourceShape a shape to be moved.
- /// \param[in] thePlane symmetry plane.
+ /// \param[in] theSourceShape the shape to be moved.
+ /// \param[in] thePlane the symmetry plane.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr<GeomAPI_Shape> theSourceShape,
std::shared_ptr<GeomAPI_Ax2> thePlane);
- /// Checks if data for the translation execution is OK.
+ /// Checks if data for the symmetry execution is OK.
GEOMALGOAPI_EXPORT bool check();
- /// Execute the translation.
+ /// Execute the symmetry.
GEOMALGOAPI_EXPORT void build();
private: