0023361: EDF - Partition by plane fails

This commit is contained in:
skv 2016-10-18 13:00:19 +03:00
parent d27962672e
commit afce74184a
8 changed files with 120 additions and 0 deletions

View File

@ -4548,6 +4548,14 @@ module GEOM
in double theTolerance,
out ListOfLong theIntersections);
/*!
* \brief Check boolean and partition operations agruments.
* \param theShape the agrument of an operation to be checked.
* \return TRUE if the agrument is valid for a boolean or partition
* operation; FALSE otherwise.
*/
boolean CheckBOPArguments (in GEOM_Object theShape);
/*!
* \brief Detect intersections of the given shapes with algorithm based on mesh intersections.
* \param theShape1 First source object

View File

@ -1672,6 +1672,40 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersectionsFast
return theIntersections->IsEmpty();
}
//=============================================================================
/*!
* CheckBOPArguments
*/
//=============================================================================
bool GEOMImpl_IMeasureOperations::CheckBOPArguments
(const Handle(GEOM_Object) &theShape)
{
SetErrorCode(KO);
if (theShape.IsNull()) {
return false;
}
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) {
return false;
}
TopoDS_Shape aShape = aRefShape->GetValue();
if (aShape.IsNull()) {
return false;
}
//Compute the parameters
bool isValid = GEOMUtils::CheckBOPArguments(aShape);
SetErrorCode(OK);
return isValid;
}
//=============================================================================
/*!
* FastIntersect

View File

@ -165,6 +165,8 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
double tolerance,
Handle(TColStd_HSequenceOfInteger)& theIntersections);
Standard_EXPORT bool CheckBOPArguments (const Handle(GEOM_Object) &theShape);
Standard_EXPORT bool FastIntersect (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2,
double tolerance, float deflection,
Handle(TColStd_HSequenceOfInteger)& theIntersections1,

View File

@ -49,6 +49,7 @@
#include <Bnd_Box.hxx>
#include <BOPAlgo_ArgumentAnalyzer.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopAbs.hxx>
@ -1098,6 +1099,29 @@ bool GEOMUtils::CheckShape( TopoDS_Shape& shape,
return analyzer.IsValid();
}
bool GEOMUtils::CheckBOPArguments(const TopoDS_Shape &theShape)
{
BOPAlgo_ArgumentAnalyzer aChecker;
aChecker.SetShape1(theShape);
// Set default options
aChecker.ArgumentTypeMode() = Standard_True;
aChecker.SelfInterMode() = Standard_True;
aChecker.SmallEdgeMode() = Standard_True;
aChecker.RebuildFaceMode() = Standard_True;
aChecker.ContinuityMode() = Standard_True;
aChecker.CurveOnSurfaceMode() = Standard_True;
aChecker.StopOnFirstFaulty() = Standard_True;
aChecker.Perform();
// process result of checking
const bool isValid = !aChecker.HasFaulty();
return isValid;
}
bool GEOMUtils::FixShapeTolerance( TopoDS_Shape& shape,
TopAbs_ShapeEnum type,
Standard_Real tolerance,

View File

@ -253,6 +253,15 @@ namespace GEOMUtils
*/
Standard_EXPORT bool CheckShape( TopoDS_Shape& shape, bool checkGeometry = false );
/*!
* \brief Check boolean and partition operations agruments
*
* \param theShape the agrument of an operation to be checked
* \return \c true if the agrument is valid for a boolean or partition
* operation or \c false otherwise
*/
Standard_EXPORT bool CheckBOPArguments(const TopoDS_Shape &theShape);
/*!
* \brief Limit shape tolerance to the given value
*

View File

@ -808,6 +808,29 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersectionsFast
return isGood;
}
//=============================================================================
/*!
* CheckBOPArguments
*/
//=============================================================================
CORBA::Boolean GEOM_IMeasureOperations_i::CheckBOPArguments
(GEOM::GEOM_Object_ptr theShape)
{
// Set a not done flag
GetOperations()->SetNotDone();
// Get the reference shape
HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
bool isGood = false;
if (!aShape.IsNull()) {
// Check BOP agruments
isGood = GetOperations()->CheckBOPArguments(aShape);
}
return isGood;
}
//=============================================================================
/*!
* FastIntersect

View File

@ -105,6 +105,8 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i :
CORBA::Double theTolerance,
GEOM::ListOfLong_out theIntersections);
CORBA::Boolean CheckBOPArguments (GEOM::GEOM_Object_ptr theShape);
CORBA::Boolean FastIntersect (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Double theTolerance,

View File

@ -11443,6 +11443,24 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
return IsValid
## Check boolean and partition operations agruments.
# @param theShape the agrument of an operation to be checked
# @return TRUE if the agrument is valid for a boolean or partition
# operation; FALSE otherwise.
@ManageTransactions("MeasuOp")
def CheckBOPArguments(self, theShape):
"""
Check boolean and partition operations agruments.
Parameters:
theShape the agrument of an operation to be checked
Returns:
TRUE if the agrument is valid for a boolean or partition
operation; FALSE otherwise.
"""
return self.MeasuOp.CheckBOPArguments(theShape)
## Detect intersections of the given shapes with algorithm based on mesh intersections.
# @param theShape1 First source object
# @param theShape2 Second source object