USE_TEST_COVERAGE=ON
shift
;;
+ models|test-models)
+ ADD_MODELS_TESTS=TRUE
+ shift
+ ;;
*)
shift
;;
CMAKE_ARGS=""
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Release}"
CMAKE_ARGS="${CMAKE_ARGS} -DUSE_TEST_COVERAGE=${USE_TEST_COVERAGE:-OFF}"
+CMAKE_ARGS="${CMAKE_ARGS} -DADD_MODELS_TESTS=${ADD_MODELS_TESTS:-FALSE}"
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${SHAPER_ROOT_DIR}"
CMAKE_ARGS="${CMAKE_ARGS} ${SOURCES_DIR}"
#include "GeomAPI_Shape.h"
#include <BRep_Tool.hxx>
+#include <BRepAlgoAPI_Common.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_FindPlane.hxx>
#include <BRepTools.hxx>
BRepTools::Write(aShape, aStream);
return aStream.str();
}
+
+GeomShapePtr GeomAPI_Shape::intersect(const GeomShapePtr theShape) const
+{
+ const TopoDS_Shape& aShape1 = const_cast<GeomAPI_Shape*>(this)->impl<TopoDS_Shape>();
+ const TopoDS_Shape& aShape2 = theShape->impl<TopoDS_Shape>();
+
+ BRepAlgoAPI_Common aCommon(aShape1, aShape2);
+ if (!aCommon.IsDone())
+ return GeomShapePtr();
+
+ TopoDS_Shape aResult = aCommon.Shape();
+ if (aResult.ShapeType() == TopAbs_COMPOUND) {
+ NCollection_List<TopoDS_Shape> aSubs;
+ addSimpleToList(aResult, aSubs);
+ if (aSubs.Size() == 1)
+ aResult = aSubs.First();
+ }
+
+ GeomShapePtr aResShape(new GeomAPI_Shape);
+ aResShape->setImpl(new TopoDS_Shape(aResult));
+ return aResShape;
+}
/// Returns the shape as BRep stream
GEOMAPI_EXPORT
std::string getShapeStream() const;
+
+ /// Returns intersection of shapes
+ GEOMAPI_EXPORT
+ std::shared_ptr<GeomAPI_Shape> intersect(const std::shared_ptr<GeomAPI_Shape> theShape) const;
};
//! Pointer on list of shapes
bool GeomAlgoAPI_Scale::check()
{
if (!mySourceShape) {
- myError = "Scale builder :: source shape is invalid.";
+ myError = "Scale builder :: source shape is not valid.";
return false;
}
if (!myCenterPoint) {
- myError = "Scale builder :: center point is invalid.";
+ myError = "Scale builder :: center point is not valid.";
return false;
}
switch (myMethodType) {
switch (myMethodType) {
case BY_POINT: {
if (!myPoint) {
- myError = "Symmetry builder :: point is invalid.";
+ myError = "Symmetry builder :: point is not valid.";
return false;
}
if (!mySourceShape) {
- myError = "Symmetry builder :: source shape is invalid.";
+ myError = "Symmetry builder :: source shape is not valid.";
return false;
}
return true;
}
case BY_AXIS: {
if (!myAxis) {
- myError = "Symmetry builder :: axis is invalid.";
+ myError = "Symmetry builder :: axis is not valid.";
return false;
}
if (!mySourceShape) {
- myError = "Symmetry builder :: source shape is invalid.";
+ myError = "Symmetry builder :: source shape is not valid.";
return false;
}
return true;
}
case BY_PLANE: {
if (!myPlane) {
- myError = "Symmetry builder :: plane is invalid.";
+ myError = "Symmetry builder :: plane is not valid.";
return false;
}
if (!mySourceShape) {
- myError = "Symmetry builder :: source shape is invalid.";
+ myError = "Symmetry builder :: source shape is not valid.";
return false;
}
return true;
aShape->setImpl(new TopoDS_Shape(aResult));
setShape(aShape);
setDone(true);
-}
\ No newline at end of file
+}