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
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
float deflection,
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,
#include <Bnd_Box.hxx>
+#include <BOPAlgo_ArgumentAnalyzer.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <TopAbs.hxx>
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,
* \return \c true if shape is valid or \c false otherwise
*/
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
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
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,
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