mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028187: Add possibility to avoid creation of Internal parts in the result of Volume maker algorithm
1. The possibility to prevent addition of internal parts has been added into the following algorithms: - BOPAlgo_BuilderFace; - BOPAlgo_BuilderSolid; - BOPAlgo_MakerVolume. Setting the option to avoid internal parts for MakerVolume algorithm guarantees that the result solids will be manifold and not contain any internal parts. But it does not prevent from occurrence of the internal edges or vertices in the faces. 2. The Set/Get methods of the BOPAlgo_BuilderArea class have been made inline. 3. Draw command mkvolume has been updated to take into account the new option. 4. BRepOffset_MakeOffset::BuildShellsCompleteInter() has been modified to use the new option of BOPAlgo_MakerVolume to speed up the construction of the final result solid. 5. Documentation has been updated with new section dedicated to BOPAlgo_MakerVolume algorithm. 6. Test case for the issue.
This commit is contained in:
@@ -17,10 +17,6 @@
|
||||
|
||||
|
||||
#include <BOPAlgo_BuilderArea.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
#include <IntTools_Context.hxx>
|
||||
#include <NCollection_BaseAllocator.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@@ -33,7 +29,8 @@ BOPAlgo_BuilderArea::BOPAlgo_BuilderArea()
|
||||
myLoops(myAllocator),
|
||||
myLoopsInternal(myAllocator),
|
||||
myAreas(myAllocator),
|
||||
myShapesToAvoid(100, myAllocator)
|
||||
myShapesToAvoid(100, myAllocator),
|
||||
myAvoidInternalShapes(Standard_False)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -48,7 +45,8 @@ BOPAlgo_BuilderArea::BOPAlgo_BuilderArea
|
||||
myLoops(myAllocator),
|
||||
myLoopsInternal(myAllocator),
|
||||
myAreas(myAllocator),
|
||||
myShapesToAvoid(100, myAllocator)
|
||||
myShapesToAvoid(100, myAllocator),
|
||||
myAvoidInternalShapes(Standard_False)
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
@@ -58,51 +56,3 @@ BOPAlgo_BuilderArea::BOPAlgo_BuilderArea
|
||||
BOPAlgo_BuilderArea::~BOPAlgo_BuilderArea()
|
||||
{
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetContext
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_BuilderArea::SetContext
|
||||
(const Handle(IntTools_Context)& theContext)
|
||||
{
|
||||
myContext=theContext;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : SetShapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void BOPAlgo_BuilderArea::SetShapes(const BOPCol_ListOfShape& theLF)
|
||||
{
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
//
|
||||
myShapes.Clear();
|
||||
aIt.Initialize(theLF);
|
||||
for(; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aF=aIt.Value();
|
||||
myShapes.Append(aF);
|
||||
}
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Shapes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BOPCol_ListOfShape& BOPAlgo_BuilderArea::Shapes()const
|
||||
{
|
||||
return myShapes;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Loops
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BOPCol_ListOfShape& BOPAlgo_BuilderArea::Loops()const
|
||||
{
|
||||
return myLoops;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Areas
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const BOPCol_ListOfShape& BOPAlgo_BuilderArea::Areas()const
|
||||
{
|
||||
return myAreas;
|
||||
}
|
||||
|
@@ -37,24 +37,46 @@ public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT void SetContext (const Handle(IntTools_Context)& theContext);
|
||||
|
||||
Standard_EXPORT const BOPCol_ListOfShape& Shapes() const;
|
||||
Standard_EXPORT void SetShapes(const BOPCol_ListOfShape& theLS);
|
||||
|
||||
Standard_EXPORT const BOPCol_ListOfShape& Loops() const;
|
||||
|
||||
Standard_EXPORT const BOPCol_ListOfShape& Areas() const;
|
||||
//! Sets the context for the algorithms
|
||||
Standard_EXPORT void SetContext (const Handle(IntTools_Context)& theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
//! Returns the input shapes
|
||||
Standard_EXPORT const BOPCol_ListOfShape& Shapes() const {
|
||||
return myShapes;
|
||||
}
|
||||
|
||||
//! Sets the shapes for building areas
|
||||
Standard_EXPORT void SetShapes(const BOPCol_ListOfShape& theLS) {
|
||||
myShapes = theLS;
|
||||
}
|
||||
|
||||
//! Returns the found loops
|
||||
Standard_EXPORT const BOPCol_ListOfShape& Loops() const {
|
||||
return myLoops;
|
||||
}
|
||||
|
||||
//! Returns the found areas
|
||||
Standard_EXPORT const BOPCol_ListOfShape& Areas() const {
|
||||
return myAreas;
|
||||
}
|
||||
|
||||
//! Defines the preventing of addition of internal parts into result.
|
||||
//! The default value is FALSE, i.e. the internal parts are added into result.
|
||||
Standard_EXPORT void SetAvoidInternalShapes(const Standard_Boolean theAvoidInternal) {
|
||||
myAvoidInternalShapes = theAvoidInternal;
|
||||
}
|
||||
|
||||
//! Returns the AvoidInternalShapes flag
|
||||
Standard_EXPORT Standard_Boolean IsAvoidInternalShapes() const {
|
||||
return myAvoidInternalShapes;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Standard_EXPORT BOPAlgo_BuilderArea();
|
||||
Standard_EXPORT virtual ~BOPAlgo_BuilderArea();
|
||||
Standard_EXPORT virtual ~BOPAlgo_BuilderArea();
|
||||
|
||||
Standard_EXPORT BOPAlgo_BuilderArea(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
@@ -73,20 +95,10 @@ Standard_EXPORT virtual ~BOPAlgo_BuilderArea();
|
||||
BOPCol_ListOfShape myLoopsInternal;
|
||||
BOPCol_ListOfShape myAreas;
|
||||
BOPCol_IndexedMapOfOrientedShape myShapesToAvoid;
|
||||
|
||||
Standard_Boolean myAvoidInternalShapes;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_BuilderArea_HeaderFile
|
||||
|
@@ -56,11 +56,6 @@
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
static
|
||||
Standard_Boolean IsGrowthWire(const TopoDS_Shape& ,
|
||||
@@ -688,6 +683,9 @@ void GetWire(const TopoDS_Shape& aF, TopoDS_Shape& aW)
|
||||
void BOPAlgo_BuilderFace::PerformInternalShapes()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
if (myAvoidInternalShapes) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Integer aNbWI=myLoopsInternal.Extent();
|
||||
if (!aNbWI) {// nothing to do
|
||||
|
@@ -751,6 +751,9 @@ void BOPAlgo_BuilderSolid::PerformAreas()
|
||||
void BOPAlgo_BuilderSolid::PerformInternalShapes()
|
||||
{
|
||||
myErrorStatus=0;
|
||||
if (myAvoidInternalShapes) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
Standard_Integer aNbFI=myLoopsInternal.Extent();
|
||||
if (!aNbFI) {// nothing to do
|
||||
|
@@ -270,6 +270,7 @@ void BOPAlgo_MakerVolume::BuildSolids(BOPCol_ListOfShape& theLSR)
|
||||
aBS.SetSolid(mySBox);
|
||||
aBS.SetShapes(myFaces);
|
||||
aBS.SetRunParallel(myRunParallel);
|
||||
aBS.SetAvoidInternalShapes(myAvoidInternalShapes);
|
||||
aBS.Perform();
|
||||
if (aBS.ErrorStatus()) {
|
||||
myErrorStatus = 103;
|
||||
@@ -339,6 +340,10 @@ void BOPAlgo_MakerVolume::BuildShape(const BOPCol_ListOfShape& theLSR)
|
||||
//=======================================================================
|
||||
void BOPAlgo_MakerVolume::FillInternalShapes(const BOPCol_ListOfShape& theLSR)
|
||||
{
|
||||
if (myAvoidInternalShapes) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
UserBreak();
|
||||
//
|
||||
Standard_Integer aNbSI;
|
||||
|
@@ -118,97 +118,79 @@ public:
|
||||
|
||||
|
||||
//! Empty contructor.
|
||||
BOPAlgo_MakerVolume();
|
||||
virtual ~BOPAlgo_MakerVolume();
|
||||
|
||||
BOPAlgo_MakerVolume();
|
||||
virtual ~BOPAlgo_MakerVolume();
|
||||
|
||||
//! Empty contructor.
|
||||
BOPAlgo_MakerVolume(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
BOPAlgo_MakerVolume(const BOPCol_BaseAllocator& theAllocator);
|
||||
|
||||
//! Clears the data.
|
||||
virtual void Clear() Standard_OVERRIDE;
|
||||
|
||||
virtual void Clear() Standard_OVERRIDE;
|
||||
|
||||
//! Sets the flag myIntersect:
|
||||
//! if <bIntersect> is TRUE the shapes from <myArguments> will be intersected.
|
||||
//! if <bIntersect> is FALSE no intersection will be done.
|
||||
void SetIntersect (const Standard_Boolean bIntersect);
|
||||
|
||||
void SetIntersect(const Standard_Boolean bIntersect);
|
||||
|
||||
//! Returns the flag <myIntersect>.
|
||||
Standard_Boolean IsIntersect() const;
|
||||
|
||||
Standard_Boolean IsIntersect() const;
|
||||
|
||||
//! Returns the solid box <mySBox>.
|
||||
const TopoDS_Solid& Box() const;
|
||||
|
||||
const TopoDS_Solid& Box() const;
|
||||
|
||||
//! Returns the processed faces <myFaces>.
|
||||
const BOPCol_ListOfShape& Faces() const;
|
||||
|
||||
const BOPCol_ListOfShape& Faces() const;
|
||||
|
||||
//! Defines the preventing of addition of internal for solid parts into the result.
|
||||
//! By default the internal parts are added into result.
|
||||
Standard_EXPORT void SetAvoidInternalShapes(const Standard_Boolean theAvoidInternal) {
|
||||
myAvoidInternalShapes = theAvoidInternal;
|
||||
}
|
||||
|
||||
//! Returns the AvoidInternalShapes flag
|
||||
Standard_EXPORT Standard_Boolean IsAvoidInternalShapes() const {
|
||||
return myAvoidInternalShapes;
|
||||
}
|
||||
|
||||
//! Performs the operation.
|
||||
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
//! Checks the data.
|
||||
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Performs the operation.
|
||||
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Collects all faces.
|
||||
Standard_EXPORT void CollectFaces();
|
||||
|
||||
|
||||
//! Makes solid box.
|
||||
Standard_EXPORT void MakeBox (BOPCol_MapOfShape& theBoxFaces);
|
||||
|
||||
|
||||
//! Builds solids.
|
||||
Standard_EXPORT void BuildSolids (BOPCol_ListOfShape& theLSR);
|
||||
|
||||
|
||||
//! Removes the covering box.
|
||||
Standard_EXPORT void RemoveBox (BOPCol_ListOfShape& theLSR, const BOPCol_MapOfShape& theBoxFaces);
|
||||
|
||||
|
||||
//! Fills the solids with internal shapes.
|
||||
Standard_EXPORT void FillInternalShapes (const BOPCol_ListOfShape& theLSR);
|
||||
|
||||
|
||||
//! Builds the result.
|
||||
Standard_EXPORT void BuildShape (const BOPCol_ListOfShape& theLSR);
|
||||
|
||||
|
||||
Standard_Boolean myIntersect;
|
||||
Bnd_Box myBBox;
|
||||
TopoDS_Solid mySBox;
|
||||
BOPCol_ListOfShape myFaces;
|
||||
|
||||
Standard_Boolean myAvoidInternalShapes;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#include <BOPAlgo_MakerVolume.lxx>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BOPAlgo_MakerVolume_HeaderFile
|
||||
|
@@ -19,7 +19,8 @@
|
||||
inline BOPAlgo_MakerVolume::BOPAlgo_MakerVolume()
|
||||
:
|
||||
BOPAlgo_Builder(),
|
||||
myIntersect(Standard_True)
|
||||
myIntersect(Standard_True),
|
||||
myAvoidInternalShapes(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -31,7 +32,8 @@ inline BOPAlgo_MakerVolume::BOPAlgo_MakerVolume
|
||||
(const Handle(NCollection_BaseAllocator)& theAllocator)
|
||||
:
|
||||
BOPAlgo_Builder(theAllocator),
|
||||
myIntersect(Standard_True)
|
||||
myIntersect(Standard_True),
|
||||
myAvoidInternalShapes(Standard_False)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -55,6 +57,7 @@ inline void BOPAlgo_MakerVolume::Clear()
|
||||
myBBox = Bnd_Box();
|
||||
mySBox.Nullify();
|
||||
myFaces.Clear();
|
||||
myAvoidInternalShapes = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
Reference in New Issue
Block a user