#include <BOPAlgo_PPaveFiller.hxx>
#include <BOPAlgo_BuilderShape.hxx>
#include <BOPAlgo_GlueEnum.hxx>
+#include <BOPAlgo_Operation.hxx>
#include <BOPDS_PDS.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <Standard_Integer.hxx>
class IntTools_Context;
class TopoDS_Shape;
class BOPAlgo_PaveFiller;
+class TopoDS_Solid;
//!
//! The class is a General Fuse algorithm - base algorithm for the
Standard_EXPORT virtual void PerformWithFiller (const BOPAlgo_PaveFiller& theFiller);
+public: //! @name BOPs on open solids
+
+ //! Builds the result shape according to the given states for the objects
+ //! and tools. These states can be unambiguously converted into the Boolean operation type.
+ //! Thus, it performs the Boolean operation on the given groups of shapes.
+ //!
+ //! The result is built basing on the result of Builder operation (GF or any other).
+ //! The only condition for the Builder is that the splits of faces should be created
+ //! and classified relatively solids.
+ //!
+ //! The method uses classification approach for choosing the faces which will
+ //! participate in building the result shape:
+ //! - All faces from each group having the given state for the opposite group
+ //! will be taken into result.
+ //!
+ //! Such approach shows better results (in comparison with BOPAlgo_BuilderSolid approach)
+ //! when working with open solids. However, the result may not be always
+ //! correct on such data (at least, not as expected) as the correct classification
+ //! of the faces relatively open solids is not always possible and may vary
+ //! depending on the chosen classification point on the face.
+ //!
+ //! History is not created for the solids in this method.
+ //!
+ //! To avoid pollution of the report of Builder algorithm, there is a possibility to pass
+ //! the different report to collect the alerts of the method only. But, if the new report
+ //! is not given, the Builder report will be used.
+ //! So, even if Builder passed without any errors, but some error has been stored into its report
+ //! in this method, for the following calls the Builder report must be cleared.
+ //!
+ //! The method may set the following errors:
+ //! - BOPAlgo_AlertBuilderFailed - Building operation has not been performed yet or failed;
+ //! - BOPAlgo_AlertBOPNotSet - invalid BOP type is given (COMMON/FUSE/CUT/CUT21 are supported);
+ //! - BOPAlgo_AlertTooFewArguments - arguments are not given;
+ //! - BOPAlgo_AlertUnknownShape - the shape is unknown for the operation.
+ //!
+ //! Parameters:
+ //! @param theObjects - The group of Objects for BOP;
+ //! @param theObjState - State for objects faces to pass into result;
+ //! @param theTools - The group of Tools for BOP;
+ //! @param theObjState - State for tools faces to pass into result;
+ //! @param theReport - The alternative report to avoid pollution of the main one.
+ Standard_EXPORT virtual void BuildBOP(const TopTools_ListOfShape& theObjects,
+ const TopAbs_State theObjState,
+ const TopTools_ListOfShape& theTools,
+ const TopAbs_State theToolsState,
+ Handle(Message_Report) theReport = NULL);
+
+ //! Builds the result of Boolean operation of given type
+ //! basing on the result of Builder operation (GF or any other).
+ //!
+ //! The method converts the given type of operation into the states
+ //! for the objects and tools required for their face to pass into result
+ //! and performs the call to the same method, but with states instead
+ //! of operation type.
+ //!
+ //! The conversion looks as follows:
+ //! - COMMON is built from the faces of objects located IN any of the tools
+ //! and vice versa.
+ //! - FUSE is built from the faces OUT of all given shapes;
+ //! - CUT is built from the faces of the objects OUT of the tools and
+ //! faces of the tools located IN solids of the objects.
+ //!
+ //! @param theObjects - The group of Objects for BOP;
+ //! @param theTools - The group of Tools for BOP;
+ //! @param theOperation - The BOP type;
+ //! @param theReport - The alternative report to avoid pollution of the global one.
+ void BuildBOP(const TopTools_ListOfShape& theObjects,
+ const TopTools_ListOfShape& theTools,
+ const BOPAlgo_Operation theOperation,
+ Handle(Message_Report) theReport = NULL)
+ {
+ TopAbs_State anObjState, aToolsState;
+ switch (theOperation)
+ {
+ case BOPAlgo_COMMON:
+ {
+ anObjState = TopAbs_IN;
+ aToolsState = TopAbs_IN;
+ break;
+ }
+ case BOPAlgo_FUSE:
+ {
+ anObjState = TopAbs_OUT;
+ aToolsState = TopAbs_OUT;
+ break;
+ }
+ case BOPAlgo_CUT:
+ {
+ anObjState = TopAbs_OUT;
+ aToolsState = TopAbs_IN;
+ break;
+ }
+ case BOPAlgo_CUT21:
+ {
+ anObjState = TopAbs_IN;
+ aToolsState = TopAbs_OUT;
+ break;
+ }
+ default:
+ {
+ anObjState = TopAbs_UNKNOWN;
+ aToolsState = TopAbs_UNKNOWN;
+ break;
+ }
+ }
+ BuildBOP(theObjects, anObjState, theTools, aToolsState, theReport);
+ }
+
protected: //! @name History methods
//! Prepare information for history support.
TopTools_ListOfShape& theLIF);
//! Finds faces located inside each solid.
- Standard_EXPORT virtual void FillIn3DParts (TopTools_DataMapOfShapeListOfShape& theInParts,
- TopTools_DataMapOfShapeShape& theDraftSolids,
- const Handle(NCollection_BaseAllocator)& theAllocator);
+ Standard_EXPORT virtual void FillIn3DParts(TopTools_DataMapOfShapeShape& theDraftSolids);
//! Builds the splits of the solids using their draft versions
//! and faces located inside.
- Standard_EXPORT void BuildSplitSolids (TopTools_DataMapOfShapeListOfShape& theInParts,
- TopTools_DataMapOfShapeShape& theDraftSolids,
- const Handle(NCollection_BaseAllocator)& theAllocator);
+ Standard_EXPORT void BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSolids);
//! Classifies the vertices and edges from the arguments relatively
//! splits of solids and makes them INTERNAL for solids.
TopTools_DataMapOfShapeListOfShape myImages; //!< Images - map of Images of the sub-shapes of arguments
TopTools_DataMapOfShapeShape myShapesSD; //!< ShapesSD - map of SD Shapes
TopTools_DataMapOfShapeListOfShape myOrigins; //!< Origins - map of Origins, back map of Images
+ TopTools_DataMapOfShapeListOfShape myInParts; //!< InParts - map of own and acquired IN faces of the arguments solids
Standard_Boolean myNonDestructive; //!< Safe processing option allows avoiding modification of the input shapes
BOPAlgo_GlueEnum myGlue; //!< Gluing option allows speeding up the intersection of the input shapes
Standard_Boolean myCheckInverted; //!< Check inverted option allows disabling the check of input solids on inverted status