// * \param theShortReport Whether to display the error report in short format
// * \param theRunParallel Whether to run the computations in parallel
// * \param theDoExact Whether to perform exact checking
- // * \param theErrors Structure, containing discovered errors and incriminated sub-shapes.
+ // * \param theResultShape Output parameter. The result of BOP General Fuse. Indices of its sub-shapes are reported in theErrors structure.
+ // * \param theErrors Output parameter. Structure, containing discovered errors and incriminated sub-shapes.
// * \return TRUE, if the input shapes "seem to be valid" for BOP.
// */
boolean ExtractBOPFailure (in ListOfGO theShapes,
in boolean theShortReport,
in boolean theRunParallel,
in boolean theDoExact,
+ out GEOM_Object theResultShape,
out ShapeErrors theErrors);
/*!
#include <GEOMImpl_IConformity.hxx>
#include <GEOMImpl_ConformityDriver.hxx>
+#include <GEOMImpl_IPartition.hxx>
+#include <GEOMImpl_PartitionDriver.hxx>
+
#include <GEOMUtils.hxx>
#include <GEOMAlgo_AlgoTools.hxx>
*/
//=============================================================================
bool GEOMImpl_IMeasureOperations::ExtractBOPFailure
- (const Handle(TColStd_HSequenceOfTransient)& theShapes,
- const bool theUseTimer,
- const bool theTopoOnly,
- const bool theShortReport,
- const bool theRunParallel,
- const bool theDoExact,
- std::list<ShapeError>& theErrors)
+ (const Handle(TColStd_HSequenceOfTransient)& theShapes,
+ const bool theUseTimer,
+ const bool theTopoOnly,
+ const bool theShortReport,
+ const bool theRunParallel,
+ const bool theDoExact,
+ Handle(GEOM_Object)& theResultShape,
+ std::list<ShapeError>& theErrors)
{
SetErrorCode(KO);
theErrors.clear();
Standard_Integer aNbShapes = theShapes->Length();
if (!aNbShapes) return false;
+ // Create Partition object
+ theResultShape = GetEngine()->AddObject(GEOM_PARTITION);
+ Handle(GEOM_Function) aFunction = theResultShape->AddFunction
+ (GEOMImpl_PartitionDriver::GetID(), PARTITION_GENERAL_FUSE);
+ // For creation information filling
+ GEOMImpl_IPartition aCI (aFunction);
+ Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient;
+
TopTools_ListOfShape aList;
- for (int i=1; i<=aNbShapes; i++) {
+ for (int i = 1; i <= aNbShapes; i++) {
Handle(GEOM_Object) aGeomObj = Handle(GEOM_Object)::DownCast(theShapes->Value(i));
if (aGeomObj.IsNull())
continue;
if (aShape.IsNull())
continue;
+ aShapesSeq->Append(aRefShape);
aList.Append(aShape);
}
+ aCI.SetShapes(aShapesSeq);
+
// Call the GeomAnaTool API to extract BOP failures
// TopTools_ListOfShape aFailuresList = GeomAnaTool::ExtractBOPFailure(aList, theUseTimer, theTopoOnly, theShortReport, theRunParallel, theDoExact);
// std::cout << "ExtractBOPFailure: " << aFailuresList.Extent() << " failures" << std::endl;
aTool.SetRunParallel(theRunParallel);
aTool.SetExactCheck(theDoExact);
aTool.Perform();
+
+ // Set General Fuse result right here
+ // (without driver execution, as we already have the result shape)
+ TopoDS_Shape aShapeRes = aTool.Result();
+ aFunction->SetValue(aShapeRes);
+
if (aTool.HasFailures())
{
std::cout << "--- The operation has failures ---" << std::endl;
std::cout << "+++ The operation has no failures +++" << std::endl;
isValid = true;
}
+
+ //Make a Python command
+ GEOM::TPythonDump aPD (aFunction);
+ aPD << "(isBOPFailure, " << theResultShape
+ << ", anErrors) = geompy.ExtractBOPFailure([";
+ for (int i = 1; i <= aNbShapes; i++) {
+ aPD << Handle(GEOM_Object)::DownCast(theShapes->Value(i));
+ if (i < aNbShapes) aPD << ", ";
+ }
+ aPD << "], " << theUseTimer << ", " << theTopoOnly << ", " << theShortReport
+ << ", " << theRunParallel << ", " << theDoExact << ")";
}
catch(Standard_Failure& aFail)
{
const std::list<ShapeError> &theErrors);
Standard_EXPORT bool ExtractBOPFailure
- (const Handle(TColStd_HSequenceOfTransient)& theShapes,
- const bool theUseTimer,
- const bool theTopoOnly,
- const bool theShortReport,
- const bool theRunParallel,
- const bool theDoExact,
- std::list<ShapeError>& theErrors);
+ (const Handle(TColStd_HSequenceOfTransient)& theShapes,
+ const bool theUseTimer,
+ const bool theTopoOnly,
+ const bool theShortReport,
+ const bool theRunParallel,
+ const bool theDoExact,
+ Handle(GEOM_Object)& theResultShape,
+ std::list<ShapeError>& theErrors);
Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
const SICheckLevel theCheckLevel,
AddParam( theParams, "Object", aCI.GetShape() );
AddParam( theParams, "Plane", aCI.GetPlane() );
break;
+ case PARTITION_GENERAL_FUSE:
+ AddParam( theParams, "Objects", aCI.GetShapes() );
+ break;
default:
return false;
}
#define PARTITION_PARTITION 1
#define PARTITION_HALF 2
#define PARTITION_NO_SELF_INTERSECTIONS 3
+#define PARTITION_GENERAL_FUSE 4
#define POLYLINE_POINTS 1
#define POLYLINE2D_PLN_COORDS 2
CORBA::Boolean theShortReport,
CORBA::Boolean theRunParallel,
CORBA::Boolean theDoExact,
+ GEOM::GEOM_Object_out theResultShape,
GEOM::GEOM_IMeasureOperations::ShapeErrors_out theErrors)
{
+ GEOM::GEOM_Object_var aNullRes;
+ theResultShape = aNullRes._retn();
+
// Set the not done flag
GetOperations()->SetNotDone();
}
// Perform partition operation and check for failures
+ Handle(::GEOM_Object) aResultShape;
std::list<GEOMImpl_IMeasureOperations::ShapeError> anErrList;
- bool isOk = GetOperations()->ExtractBOPFailure(aSeqShapes, theUseTimer, theTopoOnly,
- theShortReport, theRunParallel, theDoExact,
- anErrList);
+ bool isOk = GetOperations()->ExtractBOPFailure
+ (aSeqShapes, theUseTimer, theTopoOnly,
+ theShortReport, theRunParallel, theDoExact,
+ aResultShape, anErrList);
+
+ if (!aResultShape.IsNull()) {
+ theResultShape = GetObject(aResultShape);
+ }
ConvertShapeError(anErrList, theErrors);
CORBA::Boolean theShortReport,
CORBA::Boolean theRunParallel,
CORBA::Boolean theDoExact,
+ GEOM::GEOM_Object_out theResultShape,
GEOM::GEOM_IMeasureOperations::ShapeErrors_out theErrors);
CORBA::Boolean CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
return self.MeasuOp.CheckBOPArguments(theShape)
+ ## Extracts the BOP failure information from the given list of faces.
+ # @param lFaces - list of faces to extract the BOP failure information from.
+ # @param timer - if True, the time of the operation is measured.
+ # @param topo - if True, only the topological entities will be checked.
+ # @param short - if True, the error report will be in short format.
+ # @param parallel - if True, the operation will be executed in parallel.
+ # @param exact - if True, an exact check will be performed.
+ # @return (isValid, shapeResult, listOfErrors), where
+ # isValid - a boolean value (if result shape is valid or not),
+ # shapeResult - the result shape itself as GEOM::Object,
+ # listOfErrors - the list of GEOM.GEOM_IMeasureOperations.ShapeError.
def ExtractBOPFailure(self, lFaces, timer=None, topo=None, short=None, parallel=None, exact=None):
"""
Extracts the BOP failure information from the given list of faces.
-
+
Parameters:
lFaces - list of faces to extract the BOP failure information from.
timer - if True, the time of the operation is measured.
short - if True, the error report will be in short format.
parallel - if True, the operation will be executed in parallel.
exact - if True, an exact check will be performed.
-
+
Returns:
- the list of failed shapes.
+ a boolean value (if result shape is valid or not),
+ the result shape itself,
+ the list of GEOM.GEOM_IMeasureOperations.ShapeError.
"""
# Check for default parameter values
if timer is None: