1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0028786: Refactoring of the Warning/Error reporting system of Boolean Operations Algorithm

0. Basic tools for defining classes representing alerts (errors, warnings etc.) and collecting them during execution of algorithms are added in Message package.

1. Refactoring of the Error/Warning reporting system of the algorithms in Boolean Component.
   To dump the description of the Error/Warning status of the algorithm the DumpErrors/DumpWarnings method should be called.
   Also, the methods GerErrorMsg(int Error) and GetWarningMsg(int Warning) have been implemented to get the description for the given Error/Warning.
   All Error/Warning statuses are now listed in the enumeration ErrorStatusEnum/WarningStatusEnum of the algorithm.
   It is also possible to get the shapes for which the warning has been set by using the method GetWarningShapes().

2. The new class BOPAlgo_Options has been created to unify the options of the BOPAlgo_* and BRepAlgoAPI* algorithms.

3. The new checks across the algorithms have been added to detect and report errors and warnings.

4. Test cases
  boolean bopcut_complex B9 E1 E5 E8
  boolean bopfuse_complex B4 B5 C9 D1 D4 D5 D6 D7
have been rewritten to use Cells Builder algorithm instead of Boolean Operations algorithm, because latter always returns error "Unsupported Boolean operation" for these cases.

5. New chapter has been added in the user guide for Boolean Operations - Error / Warning reporting system.

6. Added comment to NCollection_List::Remove(Iterator&)
This commit is contained in:
emv
2017-05-29 11:08:08 +03:00
committed by bugmaster
parent b09d86369b
commit 33ba856502
109 changed files with 2661 additions and 1235 deletions

69
src/BOPAlgo/BOPAlgo.msg Normal file
View File

@@ -0,0 +1,69 @@
!!!!!!!!!! ----- Messages file for BOPAlgo package --------- !!!!!!!!!
! Keyword is name of corresponding alert (error or warning) class
! Special key used to check that messages are loaded; see BOPAlgo_Options.cxx
.BOPAlgo_LOAD_CHECKER
N/A
.BOPAlgo_AlertBOPIsNotSet
Error: The type of Boolean Operation is not set
.BOPAlgo_AlertBOPNotAllowed
Error: Boolean operation of the given type is not allowed on the given inputs
.BOPAlgo_AlertSolidBuilderFailed
Error: Building Fused solid has failed
.BOPAlgo_AlertTooFewArguments
Error: There are no enough arguments to perform the operation
.BOPAlgo_AlertMultipleArguments
Error: More than one argument is provided
.BOPAlgo_AlertNoFiller
Error: The Pave Filler (the intersection tool) has not been created
.BOPAlgo_AlertIntersectionFailed
Error: The intersection of the arguments has failed
.BOPAlgo_AlertBuilderFailed
Error: Building of the result shape has failed
.BOPAlgo_AlertNullFace
Error: The face given to be split is a null shape
.BOPAlgo_AlertNullInputShapes
Error: No or null input shapes
.BOPAlgo_AlertPostTreatFF
Error: Cannot connect face intersection curves
.BOPAlgo_AlertEmptyShape
Warning: Some of the arguments are empty shapes
.BOPAlgo_AlertSelfInterferingShape
Warning: Some of the arguments are self-interfering shapes
.BOPAlgo_AlertTooSmallEdge
Warning: Some edges are too small and have no valid range
.BOPAlgo_AlertNotSplittableEdge
Warning: Some edges are very small and have such a small valid range, that they cannot be split
.BOPAlgo_AlertBadPositioning
Warning: The positioning of the shapes leads to creation of the small edges without valid range
.BOPAlgo_AlertShellSplitterFailed
Warning: Unable to build loops from the given faces
.BOPAlgo_AlertRemovalOfIBForMDimShapes
Warning: Removal of internal boundaries among the multi-dimensional shapes is not supported yet
.BOPAlgo_AlertRemovalOfIBForSolidsFailed
Warning: Removal of internal boundaries among Solids has failed
.BOPAlgo_AlertRemovalOfIBForFacesFailed
Warning: Removal of internal boundaries among Faces has failed
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
Warning: Removal of internal boundaries among Edges has failed

View File

@@ -0,0 +1,81 @@
// Created on: 2017-06-26
// Created by: Andrey Betenev
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BOPAlgo_Alerts_HeaderFile
#define _BOPAlgo_Alerts_HeaderFile
#include <TopoDS_AlertWithShape.hxx>
//! Boolean operation of given type is not allowed on the given inputs
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertBOPNotAllowed)
//! The type of Boolean Operation is not set
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertBOPNotSet)
//! Building of the result shape has failed
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertBuilderFailed)
//! The intersection of the arguments has failed
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertIntersectionFailed)
//! The type of Boolean Operation is not set
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertMultipleArguments)
//! The Pave Filler (the intersection tool) has not been created
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertNoFiller)
//! Null input shapes
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertNullInputShapes)
//! Cannot connect face intersection curves
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertPostTreatFF)
//! The BuilderSolid algorithm has failed
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertSolidBuilderFailed)
//! There are no enough arguments to perform the operation
DEFINE_SIMPLE_ALERT(BOPAlgo_AlertTooFewArguments)
//! The positioning of the shapes leads to creation of the small edges without valid range
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertBadPositioning)
//! Some of the arguments are empty shapes
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertEmptyShape)
//! Some edges are very small and have such a small valid range, that they cannot be split
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertNotSplittableEdge)
//! Removal of internal boundaries among Edges has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertRemovalOfIBForEdgesFailed)
//! Removal of internal boundaries among Faces has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertRemovalOfIBForFacesFailed)
//! Removal of internal boundaries among the multi-dimensional shapes is not supported yet
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertRemovalOfIBForMDimShapes)
//! Removal of internal boundaries among Solids has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertRemovalOfIBForSolidsFailed)
//! Some of the arguments are self-interfering shapes
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertSelfInterferingShape)
//! The positioning of the shapes leads to creation of the small edges without valid range
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShellSplitterFailed)
//! Some edges are too small and have no valid range
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertTooSmallEdge)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

@@ -17,35 +17,6 @@
#include <BOPAlgo_Algo.hxx>
#include <Message_ProgressIndicator.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ProgramError.hxx>
namespace
{
Standard_Boolean myGlobalRunParallel = Standard_False;
}
//=======================================================================
// function:
// purpose:
//=======================================================================
void BOPAlgo_Algo::SetParallelMode(Standard_Boolean theNewMode)
{
myGlobalRunParallel = theNewMode;
}
//=======================================================================
// function:
// purpose:
//=======================================================================
Standard_Boolean BOPAlgo_Algo::GetParallelMode()
{
return myGlobalRunParallel;
}
//=======================================================================
// function:
@@ -53,11 +24,7 @@ Standard_Boolean BOPAlgo_Algo::GetParallelMode()
//=======================================================================
BOPAlgo_Algo::BOPAlgo_Algo()
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myErrorStatus(1),
myWarningStatus(0),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
BOPAlgo_Options(NCollection_BaseAllocator::CommonBaseAllocator())
{}
//=======================================================================
// function:
@@ -66,11 +33,7 @@ BOPAlgo_Algo::BOPAlgo_Algo()
BOPAlgo_Algo::BOPAlgo_Algo
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myErrorStatus(1),
myWarningStatus(0),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
BOPAlgo_Options(theAllocator)
{}
//=======================================================================
@@ -80,21 +43,14 @@ BOPAlgo_Algo::BOPAlgo_Algo
BOPAlgo_Algo::~BOPAlgo_Algo()
{
}
//=======================================================================
//function : Allocator
//purpose :
//=======================================================================
const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const
{
return myAllocator;
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
void BOPAlgo_Algo::CheckData()
{
myErrorStatus=0;
GetReport()->Clear(Message_Fail);
}
//=======================================================================
// function: CheckResult
@@ -102,80 +58,5 @@ void BOPAlgo_Algo::CheckData()
//=======================================================================
void BOPAlgo_Algo::CheckResult()
{
myErrorStatus=0;
GetReport()->Clear(Message_Fail);
}
//=======================================================================
// function: ErrorStatus
// purpose:
//=======================================================================
Standard_Integer BOPAlgo_Algo::ErrorStatus()const
{
return myErrorStatus;
}
//=======================================================================
// function: WarningStatus
// purpose:
//=======================================================================
Standard_Integer BOPAlgo_Algo::WarningStatus()const
{
return myWarningStatus;
}
//=======================================================================
//function : SetRunParallel
//purpose :
//=======================================================================
void BOPAlgo_Algo::SetRunParallel(const Standard_Boolean theFlag)
{
myRunParallel=theFlag;
}
//=======================================================================
//function : RunParallel
//purpose :
//=======================================================================
Standard_Boolean BOPAlgo_Algo::RunParallel()const
{
return myRunParallel;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BOPAlgo_Algo::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = Max(theFuzz, Precision::Confusion());
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BOPAlgo_Algo::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
//function : SetProgressIndicator
//purpose :
//=======================================================================
void BOPAlgo_Algo::SetProgressIndicator
(const Handle(Message_ProgressIndicator)& theObj)
{
if (!theObj.IsNull()) {
myProgressIndicator=theObj;
}
}
//=======================================================================
//function : UserBreak
//purpose :
//=======================================================================
void BOPAlgo_Algo::UserBreak() const
{
if (myProgressIndicator.IsNull()) {
return;
}
if (myProgressIndicator->UserBreak()) {
throw Standard_NotImplemented ("BOPAlgo_Algo::UserBreak(), method is not implemented");
}
}
// myErrorStatus
//
// 1 - object is just initialized

View File

@@ -22,89 +22,33 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BOPCol_BaseAllocator.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Message_ProgressIndicator;
#include <BOPAlgo_Options.hxx>
#include <BOPCol_DataMapOfIntegerListOfShape.hxx>
//! provides the root interface for algorithms
class BOPAlgo_Algo
//! The class provides the root interface for the algorithms in Boolean Component.<br>
class BOPAlgo_Algo : public BOPAlgo_Options
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT static Standard_Boolean GetParallelMode();
Standard_EXPORT static void SetParallelMode (const Standard_Boolean theNewMode);
Standard_EXPORT virtual void Perform() = 0;
Standard_EXPORT Standard_Integer ErrorStatus() const;
Standard_EXPORT Standard_Integer WarningStatus() const;
Standard_EXPORT const BOPCol_BaseAllocator& Allocator() const;
//! Set the flag of parallel processing
//! if <theFlag> is true the parallel processing is switched on
//! if <theFlag> is false the parallel processing is switched off
Standard_EXPORT void SetRunParallel (const Standard_Boolean theFlag);
//! Returns the flag of parallel processing
Standard_EXPORT Standard_Boolean RunParallel() const;
//! Sets the additional tolerance
Standard_EXPORT void SetFuzzyValue (const Standard_Real theFuzz);
//! Returns the additional tolerance
Standard_EXPORT Standard_Real FuzzyValue() const;
//! Set the Progress Indicator object.
Standard_EXPORT void SetProgressIndicator (const Handle(Message_ProgressIndicator)& theObj);
protected:
//! Default constructor
Standard_EXPORT BOPAlgo_Algo();
Standard_EXPORT virtual ~BOPAlgo_Algo();
Standard_EXPORT virtual ~BOPAlgo_Algo();
Standard_EXPORT BOPAlgo_Algo(const BOPCol_BaseAllocator& theAllocator);
//! Checks input data
Standard_EXPORT virtual void CheckData();
//! Checks the obtained result
Standard_EXPORT virtual void CheckResult();
//! Breaks the execution if the break signal
//! is indicated by myProgressIndicator.
Standard_EXPORT void UserBreak() const;
BOPCol_BaseAllocator myAllocator;
Standard_Integer myErrorStatus;
Standard_Integer myWarningStatus;
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
Handle(Message_ProgressIndicator) myProgressIndicator;
private:
};
#endif // _BOPAlgo_Algo_HeaderFile

View File

@@ -351,7 +351,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
continue;
}
//
Standard_Integer iErr, n1, n2;
Standard_Integer n1, n2;
BOPDS_MapIteratorOfMapOfPair aItMPK;
BOPCol_ListOfShape anArgs;
BOPAlgo_CheckerSI aChecker;
@@ -364,7 +364,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
aChecker.SetProgressIndicator(myProgressIndicator);
//
aChecker.Perform();
iErr=aChecker.ErrorStatus();
Standard_Boolean hasError = aChecker.HasErrors();
//
const BOPDS_DS& aDS=*(aChecker.PDS());
const BOPDS_MapOfPair& aMPK=aDS.Interferences();
@@ -397,7 +397,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
myResult.Append(aResult);
}
//
if (iErr) {
if (hasError) {
BOPAlgo_CheckResult aResult;
if(ii == 0) {
aResult.SetShape1(myShape1);

View File

@@ -16,6 +16,7 @@
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
@@ -159,41 +160,34 @@ void BOPAlgo_BOP::SetTools(const BOPCol_ListOfShape& theShapes)
void BOPAlgo_BOP::CheckData()
{
Standard_Integer i, j, iDim, aNbArgs, aNbTools;
Standard_Boolean bFlag, bFuse;
Standard_Boolean bFuse;
BOPCol_ListIteratorOfListOfShape aItLS;
//
myErrorStatus=0;
//
if (!(myOperation==BOPAlgo_COMMON ||
myOperation==BOPAlgo_FUSE ||
myOperation==BOPAlgo_CUT||
myOperation==BOPAlgo_CUT21)) {
// non-licit operation
myErrorStatus=14;
AddError (new BOPAlgo_AlertBOPNotSet);
return;
}
//
aNbArgs=myArguments.Extent();
if (!aNbArgs) {
// invalid number of Arguments
myErrorStatus=100;
AddError (new BOPAlgo_AlertTooFewArguments);
return;
}
//
aNbTools=myTools.Extent();
if (!aNbTools) {
// invalid number of Tools
myErrorStatus=100;
AddError (new BOPAlgo_AlertTooFewArguments);
return;
}
//
if (!myPaveFiller) {
myErrorStatus=101;
return;
}
//
myErrorStatus=myPaveFiller->ErrorStatus();
if (myErrorStatus) {
CheckFiller();
if (HasErrors()) {
return;
}
//
@@ -208,24 +202,28 @@ void BOPAlgo_BOP::CheckData()
// 4. COMMON: The arguments and tools could have any dimensions.
//
Standard_Integer iDimMin[2], iDimMax[2];
Standard_Boolean bHasValid[2] = {Standard_False, Standard_False};
//
for (i=0; i<2; ++i) {
const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
aItLS.Initialize(aLS);
for (j=0; aItLS.More(); aItLS.Next(), ++j) {
const TopoDS_Shape& aS=aItLS.Value();
bFlag=BOPTools_AlgoTools3D::IsEmptyShape(aS);
if(bFlag) {
myWarningStatus=2;
Standard_Boolean bIsEmpty = BOPTools_AlgoTools3D::IsEmptyShape(aS);
if (bIsEmpty) {
AddWarning(new BOPAlgo_AlertEmptyShape (aS));
continue;
}
//
iDim=BOPTools_AlgoTools::Dimension(aS);
if (iDim<0) {
// non-homogenious argument
myErrorStatus=13;
iDim = BOPTools_AlgoTools::Dimension(aS);
if (iDim < 0) {
// non-homogeneous argument
AddError (new BOPAlgo_AlertBOPNotAllowed);
return;
}
//
bHasValid[i] = Standard_True;
//
if (!j) {
iDimMin[i] = iDim;
iDimMax[i] = iDim;
@@ -240,77 +238,101 @@ void BOPAlgo_BOP::CheckData()
}
//
if (bFuse && (iDimMin[i] != iDimMax[i])) {
// non-homogenious argument
myErrorStatus=13;
// non-homogeneous argument
AddError (new BOPAlgo_AlertBOPNotAllowed);
return;
}
}
}
//
if (((myOperation == BOPAlgo_FUSE) && (iDimMax[0] != iDimMax[1])) ||
((myOperation == BOPAlgo_CUT) && (iDimMax[0] > iDimMin[1])) ||
((myOperation == BOPAlgo_CUT21) && (iDimMin[0] < iDimMax[1])) ) {
// non-licit operation for the arguments
myErrorStatus=14;
return;
if (bHasValid[0] && bHasValid[1]) {
if (((myOperation == BOPAlgo_FUSE) && (iDimMax[0] != iDimMax[1])) ||
((myOperation == BOPAlgo_CUT) && (iDimMax[0] > iDimMin[1])) ||
((myOperation == BOPAlgo_CUT21) && (iDimMin[0] < iDimMax[1])) )
{
// non-licit operation for the arguments
AddError (new BOPAlgo_AlertBOPNotAllowed);
return;
}
myDims[0] = iDimMin[0];
myDims[1] = iDimMin[1];
}
//
myDims[0] = iDimMin[0];
myDims[1] = iDimMin[1];
}
//=======================================================================
//function : Prepare
//function : TreatEmtpyShape
//purpose :
//=======================================================================
void BOPAlgo_BOP::Prepare()
Standard_Boolean BOPAlgo_BOP::TreatEmptyShape()
{
//
BOPAlgo_Builder::Prepare();
//
if(myWarningStatus == 2) {
Standard_Integer i;
BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aItLS;
//
switch(myOperation) {
case BOPAlgo_FUSE: {
for (i=0; i<2; ++i) {
const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
aBB.Add(myShape, aS);
}
}
}
break;
//
case BOPAlgo_CUT: {
aItLS.Initialize(myArguments);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
if(!BOPTools_AlgoTools3D::IsEmptyShape(aS)) {
aBB.Add(myShape, aS);
}
}
}
break;
case BOPAlgo_CUT21: {
aItLS.Initialize(myTools);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS=aItLS.Value();
if(!BOPTools_AlgoTools3D::IsEmptyShape(aS)) {
aBB.Add(myShape, aS);
}
}
}
break;
//
default:
break;
}
if (! GetReport()->HasAlert (STANDARD_TYPE(BOPAlgo_AlertEmptyShape)))
{
return Standard_False;
}
//
// Find non-empty objects
BOPCol_ListOfShape aLValidObjs;
BOPCol_ListIteratorOfListOfShape aItLS(myArguments);
for (; aItLS.More(); aItLS.Next()) {
if (!BOPTools_AlgoTools3D::IsEmptyShape(aItLS.Value())) {
aLValidObjs.Append(aItLS.Value());
}
}
//
// Find non-empty tools
BOPCol_ListOfShape aLValidTools;
aItLS.Initialize(myTools);
for (; aItLS.More() ; aItLS.Next()) {
if (!BOPTools_AlgoTools3D::IsEmptyShape(aItLS.Value())) {
aLValidTools.Append(aItLS.Value());
}
}
//
Standard_Boolean bHasValidObj = (aLValidObjs .Extent() > 0);
Standard_Boolean bHasValidTool = (aLValidTools.Extent() > 0);
//
if (bHasValidObj && bHasValidTool) {
// We need to continue the operation to obtain the result
return Standard_False;
}
//
if (!bHasValidObj && !bHasValidTool) {
// All shapes are empty shapes, the result will always be empty shape
return Standard_True;
}
//
// One of the groups of arguments consists of empty shapes only,
// so we can build the result of operation right away just by
// choosing the list of shapes to add to result, depending on
// the type of the operation
BOPCol_ListOfShape *pLResult = NULL;
//
switch (myOperation) {
case BOPAlgo_FUSE:
// Add not empty shapes into result
pLResult = bHasValidObj ? &aLValidObjs : &aLValidTools;
break;
case BOPAlgo_CUT:
// Add objects into result
pLResult = &aLValidObjs;
break;
case BOPAlgo_CUT21:
// Add tools into result
pLResult = &aLValidTools;
break;
case BOPAlgo_COMMON:
// Common will be empty
break;
default:
break;
}
//
if (pLResult) {
aItLS.Initialize(*pLResult);
for (; aItLS.More(); aItLS.Next()) {
BRep_Builder().Add(myShape, aItLS.Value());
}
}
return Standard_True;
}
//=======================================================================
//function : BuildResult
@@ -323,8 +345,6 @@ void BOPAlgo_BOP::BuildResult(const TopAbs_ShapeEnum theType)
BOPCol_MapOfShape aM;
BOPCol_ListIteratorOfListOfShape aIt, aItIm;
//
myErrorStatus=0;
//
const BOPCol_ListOfShape& aLA=myDS->Arguments();
aIt.Initialize(aLA);
for (; aIt.More(); aIt.Next()) {
@@ -359,7 +379,7 @@ void BOPAlgo_BOP::Perform()
BOPAlgo_PaveFiller* pPF;
BOPCol_ListIteratorOfListOfShape aItLS;
//
myErrorStatus=0;
GetReport()->Clear();
//
if (myEntryPoint==1) {
if (myPaveFiller) {
@@ -403,9 +423,6 @@ void BOPAlgo_BOP::Perform()
//=======================================================================
void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
myWarningStatus=0;
//
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
myDS=myPaveFiller->PDS();
myContext=myPaveFiller->Context();
@@ -414,110 +431,115 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
//
// 1. CheckData
CheckData();
if (myErrorStatus && !myWarningStatus) {
if (HasErrors()) {
return;
}
//
// 2. Prepare
Prepare();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
if(myWarningStatus == 2) {
return;
if (GetReport()->HasAlert (STANDARD_TYPE(BOPAlgo_AlertEmptyShape)))
{
Standard_Boolean bDone = TreatEmptyShape();
if (bDone) {
return;
}
}
//
// 3. Fill Images
// 3.1 Vertices
FillImagesVertices();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_VERTEX);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.2 Edges
FillImagesEdges();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_EDGE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3.3 Wires
FillImagesContainers(TopAbs_WIRE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_WIRE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3.4 Faces
FillImagesFaces();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
BuildResult(TopAbs_FACE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3.5 Shells
FillImagesContainers(TopAbs_SHELL);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_SHELL);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3.6 Solids
FillImagesSolids();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_SOLID);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3.7 CompSolids
FillImagesContainers(TopAbs_COMPSOLID);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_COMPSOLID);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3.8 Compounds
FillImagesCompounds();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_COMPOUND);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 4.BuildShape;
BuildShape();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
@@ -537,8 +559,6 @@ void BOPAlgo_BOP::BuildRC()
TopoDS_Compound aC;
BRep_Builder aBB;
//
myErrorStatus = 0;
//
aBB.MakeCompound(aC);
//
// A. Fuse
@@ -571,6 +591,9 @@ void BOPAlgo_BOP::BuildRC()
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aS = aItLS.Value();
iDim = BOPTools_AlgoTools::Dimension(aS);
if (iDim < 0) {
continue;
}
aType = TypeToExplore(iDim);
BOPTools::MapShapes(aS, aType, aMS);
}
@@ -900,8 +923,6 @@ void BOPAlgo_BOP::BuildSolid()
TopExp_Explorer aExp;
BRep_Builder aBB;
//
myErrorStatus=0;
//
// Get solids from input arguments
BOPCol_MapOfShape aMSA;
// Map the arguments to find shared faces
@@ -1033,8 +1054,8 @@ void BOPAlgo_BOP::BuildSolid()
aSB.SetContext(myContext);
aSB.SetShapes(aSFS);
aSB.Perform();
if (aSB.ErrorStatus()) {
myErrorStatus = 30; // SolidBuilder failed
if (aSB.HasErrors()) {
AddError (new BOPAlgo_AlertSolidBuilderFailed); // SolidBuilder failed
return;
}
// new solids

View File

@@ -32,8 +32,40 @@
class TopoDS_Shape;
class BOPAlgo_PaveFiller;
//!
//! The class represents the Building part of the Boolean Operations
//! algorithm.<br>
//! The arguments of the algorithms are divided in two groups - *Objects*
//! and *Tools*.<br>
//! The algorithm builds the splits of the given arguments using the intersection
//! results and combines the result of Boolean Operation of given type:<br>
//! - *FUSE* - union of two groups of objects;<br>
//! - *COMMON* - intersection of two groups of objects;<br>
//! - *CUT* - subtraction of one group from the other.<br>
//!
//! The rules for the arguments and type of the operation are the following:<br>
//! - For Boolean operation *FUSE* all arguments should have equal dimensions;<br>
//! - For Boolean operation *CUT* the minimal dimension of *Tools* should not be
//! less than the maximal dimension of *Objects*;<br>
//! - For Boolean operation *COMMON* the arguments can have any dimension.<br>
//!
//! The class is a General Fuse based algorithm. Thus, all options
//! of the General Fuse algorithm such as Fuzzy mode, safe processing mode,
//! parallel processing mode, gluing mode and history support are also
//! available in this algorithm.<br>
//!
//! Additionally to the Warnings of the parent class the algorithm returns
//! the following warnings:
//! - *BOPAlgo_AlertEmptyShape* - in case some of the input shapes are empty shapes.
//!
//! Additionally to Errors of the parent class the algorithm returns
//! the following Error statuses:
//! - *BOPAlgo_AlertBOPIsNotSet* - in case the type of Boolean operation is not set;
//! - *BOPAlgo_AlertBOPNotAllowed* - in case the operation of given type is not allowed on
//! given inputs;
//! - *BOPAlgo_AlertSolidBuilderFailed* - in case the BuilderSolid algorithm failed to
//! produce the Fused solid.
//!
class BOPAlgo_BOP : public BOPAlgo_Builder
{
public:
@@ -61,17 +93,10 @@ Standard_EXPORT virtual ~BOPAlgo_BOP();
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
protected:
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
//! Provides preparing actions
Standard_EXPORT virtual void Prepare() Standard_OVERRIDE;
//! Performs calculations using prepared Filler
//! object <thePF>
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
@@ -86,6 +111,11 @@ protected:
Standard_EXPORT Standard_Boolean IsBoundSplits (const TopoDS_Shape& theS, BOPCol_IndexedDataMapOfShapeListOfShape& theMEF);
//! Treatment of the cases with empty shapes.<br>
//! It returns TRUE if there is nothing to do, i.e.
//! all shapes in one of the groups are empty shapes.
Standard_EXPORT Standard_Boolean TreatEmptyShape();
BOPAlgo_Operation myOperation;
Standard_Integer myDims[2];
@@ -96,16 +126,6 @@ protected:
private:
};
#endif // _BOPAlgo_BOP_HeaderFile

View File

@@ -0,0 +1,72 @@
// This file has been automatically generated from resource file src/BOPAlgo/BOPAlgo.msg
static const char BOPAlgo_BOPAlgo_msg[] =
"!!!!!!!!!! ----- Messages file for BOPAlgo package --------- !!!!!!!!!\n"
"! Keyword is name of corresponding alert (error or warning) class\n"
"\n"
"! Special key used to check that messages are loaded; see BOPAlgo_Options.cxx\n"
".BOPAlgo_LOAD_CHECKER\n"
"N/A\n"
"\n"
".BOPAlgo_AlertBOPIsNotSet\n"
"Error: The type of Boolean Operation is not set\n"
"\n"
".BOPAlgo_AlertBOPNotAllowed\n"
"Error: Boolean operation of the given type is not allowed on the given inputs\n"
"\n"
".BOPAlgo_AlertSolidBuilderFailed\n"
"Error: Building Fused solid has failed\n"
"\n"
".BOPAlgo_AlertTooFewArguments\n"
"Error: There are no enough arguments to perform the operation\n"
"\n"
".BOPAlgo_AlertMultipleArguments\n"
"Error: More than one argument is provided\n"
"\n"
".BOPAlgo_AlertNoFiller\n"
"Error: The Pave Filler (the intersection tool) has not been created\n"
"\n"
".BOPAlgo_AlertIntersectionFailed\n"
"Error: The intersection of the arguments has failed\n"
"\n"
".BOPAlgo_AlertBuilderFailed\n"
"Error: Building of the result shape has failed\n"
"\n"
".BOPAlgo_AlertNullFace\n"
"Error: The face given to be split is a null shape\n"
"\n"
".BOPAlgo_AlertNullInputShapes\n"
"Error: No or null input shapes\n"
"\n"
".BOPAlgo_AlertPostTreatFF\n"
"Error: Cannot connect face intersection curves\n"
"\n"
".BOPAlgo_AlertEmptyShape\n"
"Warning: Some of the arguments are empty shapes\n"
"\n"
".BOPAlgo_AlertSelfInterferingShape\n"
"Warning: Some of the arguments are self-interfering shapes\n"
"\n"
".BOPAlgo_AlertTooSmallEdge\n"
"Warning: Some edges are too small and have no valid range\n"
"\n"
".BOPAlgo_AlertNotSplittableEdge\n"
"Warning: Some edges are very small and have such a small valid range, that they cannot be split\n"
"\n"
".BOPAlgo_AlertBadPositioning\n"
"Warning: The positioning of the shapes leads to creation of the small edges without valid range\n"
"\n"
".BOPAlgo_AlertShellSplitterFailed\n"
"Warning: Unable to build loops from the given faces\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForMDimShapes\n"
"Warning: Removal of internal boundaries among the multi-dimensional shapes is not supported yet\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForSolidsFailed\n"
"Warning: Removal of internal boundaries among Solids has failed\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForFacesFailed\n"
"Warning: Removal of internal boundaries among Faces has failed\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
"Warning: Removal of internal boundaries among Edges has failed\n";

View File

@@ -18,6 +18,7 @@
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <IntTools_Context.hxx>
@@ -95,6 +96,7 @@ BOPAlgo_Builder::~BOPAlgo_Builder()
//=======================================================================
void BOPAlgo_Builder::Clear()
{
BOPAlgo_Algo::Clear();
myArguments.Clear();
myMapFence.Clear();
myImages.Clear();
@@ -223,36 +225,33 @@ BOPAlgo_GlueEnum BOPAlgo_Builder::Glue() const
//=======================================================================
void BOPAlgo_Builder::CheckData()
{
Standard_Integer aNb;
//
myErrorStatus=0;
//
aNb=myArguments.Extent();
Standard_Integer aNb = myArguments.Extent();
if (aNb<2) {
myErrorStatus=100; // too few arguments to process
AddError (new BOPAlgo_AlertTooFewArguments); // too few arguments to process
return;
}
//
// myPaveFiller
if (!myPaveFiller) {
myErrorStatus=101;
return;
}
//
myErrorStatus=myPaveFiller->ErrorStatus();
if (myErrorStatus) {
myErrorStatus=102; // PaveFiller is failed
return;
}
CheckFiller();
}
//=======================================================================
// function: CheckFiller
// purpose:
//=======================================================================
void BOPAlgo_Builder::CheckFiller()
{
if (!myPaveFiller) {
AddError (new BOPAlgo_AlertNoFiller);
return;
}
GetReport()->Merge (myPaveFiller->GetReport());
}
//=======================================================================
//function : Prepare
//purpose :
//=======================================================================
void BOPAlgo_Builder::Prepare()
{
myErrorStatus=0;
//
BRep_Builder aBB;
TopoDS_Compound aC;
//
@@ -267,7 +266,7 @@ void BOPAlgo_Builder::Prepare()
//=======================================================================
void BOPAlgo_Builder::Perform()
{
myErrorStatus=0;
GetReport()->Clear();
//
if (myEntryPoint==1) {
if (myPaveFiller) {
@@ -299,6 +298,7 @@ void BOPAlgo_Builder::Perform()
//=======================================================================
void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
{
GetReport()->Clear();
myEntryPoint=0;
myNonDestructive = theFiller.NonDestructive();
myFuzzyValue = theFiller.FuzzyValue();
@@ -311,14 +311,16 @@ void BOPAlgo_Builder::PerformWithFiller(const BOPAlgo_PaveFiller& theFiller)
//=======================================================================
void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
{
try {
GetReport()->Clear();
//
try {
OCC_CATCH_SIGNALS
PerformInternal1(theFiller);
}
//
catch (Standard_Failure) {
myErrorStatus=191;
}
AddError (new BOPAlgo_AlertBuilderFailed);
}
}
//=======================================================================
//function : PerformInternal1
@@ -326,8 +328,6 @@ void BOPAlgo_Builder::PerformInternal(const BOPAlgo_PaveFiller& theFiller)
//=======================================================================
void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
//
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
myDS=myPaveFiller->PDS();
myContext=myPaveFiller->Context();
@@ -336,98 +336,98 @@ void BOPAlgo_Builder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
//
// 1. CheckData
CheckData();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 2. Prepare
Prepare();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3. Fill Images
// 3.1 Vertice
FillImagesVertices();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_VERTEX);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.2 Edges
FillImagesEdges();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_EDGE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 3.3 Wires
FillImagesContainers(TopAbs_WIRE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_WIRE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.4 Faces
FillImagesFaces();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_FACE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.5 Shells
FillImagesContainers(TopAbs_SHELL);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
BuildResult(TopAbs_SHELL);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.6 Solids
FillImagesSolids();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
BuildResult(TopAbs_SOLID);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.7 CompSolids
FillImagesContainers(TopAbs_COMPSOLID);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
BuildResult(TopAbs_COMPSOLID);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.8 Compounds
FillImagesCompounds();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
BuildResult(TopAbs_COMPOUND);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//

View File

@@ -40,8 +40,27 @@ class IntTools_Context;
class TopoDS_Shape;
class BOPAlgo_PaveFiller;
//!
//! The class is a General Fuse algorithm - base algorithm for the
//! algorithms in the Boolean Component. Its main purpose is to build
//! the split parts of the argument shapes from which the result of
//! the operations is combined.<br>
//! The result of the General Fuse algorithm itself is a compound
//! containing all split parts of the arguments. <br>
//!
//! Additionally to the options of the base classes, the algorithm has
//! the following options:<br>
//! - *Safe processing mode* - allows to avoid modification of the input
//! shapes during the operation (by default it is off);<br>
//! - *Gluing options* - allows to speed up the calculation of the intersections
//! on the special cases, in which some sub-shapes are coinciding.<br>
//!
//! The algorithm returns the following Error statuses:
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to perform the operation;
//! - *BOPAlgo_AlertNoFiller* - in case the intersection tool has not been created;
//! - *BOPAlgo_AlertIntersectionFailed* - in case the intersection of the arguments has failed;
//! - *BOPAlgo_AlertBuilderFailed* - in case building splits of arguments has failed with some unexpected error.
//!
class BOPAlgo_Builder : public BOPAlgo_BuilderShape
{
public:
@@ -54,7 +73,7 @@ Standard_EXPORT virtual ~BOPAlgo_Builder();
Standard_EXPORT BOPAlgo_Builder(const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT virtual void Clear();
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
Standard_EXPORT BOPAlgo_PPaveFiller PPaveFiller();
@@ -124,6 +143,9 @@ protected:
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF);
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
//! Checks if the intersection algorithm has Errors/Warnings
Standard_EXPORT void CheckFiller();
Standard_EXPORT virtual void Prepare();

View File

@@ -20,6 +20,7 @@
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_WireEdgeSet.hxx>
#include <BOPAlgo_WireSplitter.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_Box2DBndTree.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
@@ -187,10 +188,8 @@ const TopoDS_Face& BOPAlgo_BuilderFace::Face()const
//=======================================================================
void BOPAlgo_BuilderFace::CheckData()
{
myErrorStatus=0;
//
if (myFace.IsNull()) {
myErrorStatus=12;// Null face generix
AddError (new BOPAlgo_AlertNullInputShapes);
return;
}
if (myContext.IsNull()) {
@@ -203,38 +202,38 @@ void BOPAlgo_BuilderFace::CheckData()
//=======================================================================
void BOPAlgo_BuilderFace::Perform()
{
myErrorStatus=0;
GetReport()->Clear();
//
CheckData();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UserBreak();
//
PerformShapesToAvoid();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UserBreak();
//
PerformLoops();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UserBreak();
//
PerformAreas();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UserBreak();
//
PerformInternalShapes();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
}
@@ -317,10 +316,8 @@ void BOPAlgo_BuilderFace::PerformShapesToAvoid()
//=======================================================================
void BOPAlgo_BuilderFace::PerformLoops()
{
myErrorStatus=0;
//
Standard_Boolean bFlag;
Standard_Integer i, iErr, aNbEA;
Standard_Integer i, aNbEA;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_IndexedDataMapOfShapeListOfShape aVEMap;
BOPCol_MapOfOrientedShape aMAdded;
@@ -345,8 +342,7 @@ void BOPAlgo_BuilderFace::PerformLoops()
aWSp.SetRunParallel(myRunParallel);
aWSp.SetContext(myContext);
aWSp.Perform();
iErr=aWSp.ErrorStatus();
if (iErr) {
if (aWSp.HasErrors()) {
return;
}
//
@@ -458,7 +454,6 @@ void BOPAlgo_BuilderFace::PerformAreas()
BOPCol_Box2DBndTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, Bnd_Box2d> aTreeFiller(aBBTree);
//
myErrorStatus=0;
aNbHoles=0;
//
aTol=BRep_Tool::Tolerance(myFace);
@@ -682,7 +677,6 @@ void GetWire(const TopoDS_Shape& aF, TopoDS_Shape& aW)
//=======================================================================
void BOPAlgo_BuilderFace::PerformInternalShapes()
{
myErrorStatus=0;
if (myAvoidInternalShapes) {
return;
}
@@ -872,9 +866,3 @@ Standard_Boolean IsGrowthWire(const TopoDS_Shape& theWire,
}
return bRet;
}
//BRepTools::Write(aFF, "ff");
//
// ErrorStatus :
// 11 - Null Context
// 12 - Null face generix

View File

@@ -29,7 +29,12 @@
class TopoDS_Face;
//! The algorithm to build faces from set of edges
//! The algorithm to build new faces from the given faces and
//! set of edges lying on this face.
//!
//! The algorithm returns the following Error statuses:
//! - *BOPAlgo_AlertNullInputShapes* - in case the given face is a null shape.
//!
class BOPAlgo_BuilderFace : public BOPAlgo_BuilderArea
{
public:
@@ -53,11 +58,7 @@ Standard_EXPORT virtual ~BOPAlgo_BuilderFace();
Standard_EXPORT TopAbs_Orientation Orientation() const;
protected:
//! Collect the edges that
//! a) are internal

View File

@@ -32,7 +32,10 @@
class TopoDS_Shape;
//! Root class for algorithms that has shape as result
//! Root class for algorithms that has shape as result.<br>
//! The class provides the History mechanism, which allows
//! tracking the modification of the input shapes during
//! the operation.
class BOPAlgo_BuilderShape : public BOPAlgo_Algo
{
public:

View File

@@ -17,6 +17,7 @@
//
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_ShellSplitter.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_BoxBndTree.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
@@ -297,7 +298,7 @@ const TopoDS_Solid& BOPAlgo_BuilderSolid::Solid()const
//=======================================================================
void BOPAlgo_BuilderSolid::Perform()
{
myErrorStatus=0;
GetReport()->Clear();
//
if (myContext.IsNull()) {
myContext=new IntTools_Context;
@@ -317,28 +318,28 @@ void BOPAlgo_BuilderSolid::Perform()
UserBreak();
//
PerformShapesToAvoid();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UserBreak();
//
PerformLoops();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UserBreak();
//
PerformAreas();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UserBreak();
//
PerformInternalShapes();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
}
@@ -428,12 +429,11 @@ void BOPAlgo_BuilderSolid::PerformShapesToAvoid()
//=======================================================================
void BOPAlgo_BuilderSolid::PerformLoops()
{
Standard_Integer iErr, i, aNbSh;
Standard_Integer i, aNbSh;
BOPCol_ListIteratorOfListOfShape aIt;
TopoDS_Iterator aItS;
Handle(NCollection_BaseAllocator) aAlr;
//
myErrorStatus=0;
myLoops.Clear();
//
aAlr=
@@ -461,8 +461,17 @@ void BOPAlgo_BuilderSolid::PerformLoops()
//
aSSp.SetRunParallel(myRunParallel);
aSSp.Perform();
iErr=aSSp.ErrorStatus();
if (iErr) {
if (aSSp.HasErrors()) {
// add warning status
{
TopoDS_Compound aFacesSp;
BRep_Builder().MakeCompound(aFacesSp);
BOPCol_ListIteratorOfListOfShape aItLF(aSSp.StartElements());
for (; aItLF.More(); aItLF.Next()) {
BRep_Builder().Add(aFacesSp, aItLF.Value());
}
AddWarning (new BOPAlgo_AlertShellSplitterFailed (aFacesSp));
}
return;
}
//
@@ -579,8 +588,6 @@ void BOPAlgo_BuilderSolid::PerformAreas()
BOPCol_IndexedDataMapOfShapeListOfShape aMSH;
BOPAlgo_DataMapIteratorOfDataMapOfIntegerBSSB aItDMISB;
//
myErrorStatus=0;
//
myAreas.Clear();
//
// Draft solids [aNewSolids]
@@ -750,7 +757,6 @@ void BOPAlgo_BuilderSolid::PerformAreas()
//=======================================================================
void BOPAlgo_BuilderSolid::PerformInternalShapes()
{
myErrorStatus=0;
if (myAvoidInternalShapes) {
return;
}
@@ -877,7 +883,7 @@ void BOPAlgo_BuilderSolid::PerformInternalShapes()
if (!aNbVFS) {
return;
}
// 4. Refine candidares
// 4. Refine candidates
//=============================================================
BOPAlgo_FaceSolidCnt::Perform(myRunParallel, aVFS, myContext);
//=============================================================

View File

@@ -50,11 +50,7 @@ Standard_EXPORT virtual ~BOPAlgo_BuilderSolid();
//! Performs the algorithm
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
protected:
//! Collect the faces that
//! a) are internal

View File

@@ -40,8 +40,6 @@
//=======================================================================
void BOPAlgo_Builder::FillImagesVertices()
{
myErrorStatus=0;
//
Standard_Integer nV, nVSD;
BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aIt;
//
@@ -73,8 +71,6 @@ void BOPAlgo_Builder::FillImagesVertices()
//=======================================================================
void BOPAlgo_Builder::FillImagesEdges()
{
myErrorStatus=0;
//
Standard_Integer i, aNbS = myDS->NbSourceShapes();
for (i = 0; i < aNbS; ++i) {
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(i);
@@ -144,8 +140,6 @@ void BOPAlgo_Builder::FillImagesVertices()
//=======================================================================
void BOPAlgo_Builder::BuildResult(const TopAbs_ShapeEnum theType)
{
myErrorStatus=0;
//
TopAbs_ShapeEnum aType;
BRep_Builder aBB;
BOPCol_MapOfShape aM;
@@ -180,8 +174,6 @@ void BOPAlgo_Builder::FillImagesVertices()
//=======================================================================
void BOPAlgo_Builder::FillImagesContainers(const TopAbs_ShapeEnum theType)
{
myErrorStatus=0;
//
Standard_Integer i, aNbS;
BOPCol_MapOfShape aMFP(100, myAllocator);
//
@@ -200,8 +192,6 @@ void BOPAlgo_Builder::FillImagesVertices()
//=======================================================================
void BOPAlgo_Builder::FillImagesCompounds()
{
myErrorStatus=0;
//
Standard_Integer i, aNbS;
BOPCol_MapOfShape aMFP(100, myAllocator);
//

View File

@@ -228,8 +228,6 @@ typedef BOPCol_ContextCnt
//=======================================================================
void BOPAlgo_Builder::FillImagesFaces()
{
myErrorStatus=0;
//
BuildSplitFaces();
FillSameDomainFaces();
FillImagesFaces1();
@@ -254,8 +252,6 @@ void BOPAlgo_Builder::BuildSplitFaces()
BOPCol_ListOfShape aLFIm(myAllocator);
BOPAlgo_VectorOfBuilderFace aVBF;
//
myErrorStatus=0;
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~scope f
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
@@ -474,8 +470,6 @@ void BOPAlgo_Builder::FillSameDomainFaces()
BOPAlgo_IndexedDataMapOfSetInteger aIDMSS;
BOPAlgo_VectorOfVectorOfShape aVVS;
//
myErrorStatus=0;
//
const BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
aNbFFs=aFFs.Extent();

View File

@@ -503,8 +503,6 @@ void BOPAlgo_Builder::FillImagesSolids()
Standard_Boolean bHasSolids;
Standard_Integer i, aNbS;
//
myErrorStatus=0;
//
bHasSolids=Standard_False;
aNbS=myDS->NbSourceShapes();
for (i=0; i<aNbS; ++i) {
@@ -558,7 +556,6 @@ void BOPAlgo_Builder::FillIn3DParts
BOPCol_MapOfShape aMFence(100, aAlr0);
BOPAlgo_VectorOfShapeBox aVSB(256, aAlr0);
//
myErrorStatus=0;
theDraftSolids.Clear();
//
// 1. aVSB vector Index/FaceBox
@@ -704,8 +701,6 @@ void BOPAlgo_Builder::BuildDraftSolid(const TopoDS_Shape& theSolid,
TopoDS_Shape& theDraftSolid,
BOPCol_ListOfShape& theLIF)
{
myErrorStatus=0;
//
Standard_Boolean bToReverse;
Standard_Integer iFlag;
TopAbs_Orientation aOrF, aOrSh, aOrSd;
@@ -798,8 +793,6 @@ void BOPAlgo_Builder::BuildSplitSolids
BOPCol_DataMapOfShapeShape& theDraftSolids,
const BOPCol_BaseAllocator& )
{
myErrorStatus=0;
//
Standard_Boolean bFlagSD;
Standard_Integer i, aNbS;
TopExp_Explorer aExp;
@@ -928,8 +921,6 @@ void BOPAlgo_Builder::BuildSplitSolids
//=======================================================================
void BOPAlgo_Builder::FillInternalShapes()
{
myErrorStatus=0;
//
Standard_Integer i, j, aNbS, aNbSI, aNbSx;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
@@ -1191,7 +1182,3 @@ void TreatCompound(const TopoDS_Shape& theS,
TreatCompound(aS, aMFence, theLS);
}
}
//
// ErrorStatus
// 30 - SolidBuilder failed

View File

@@ -25,6 +25,7 @@
#include <BOPTools_AlgoTools.hxx>
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_MapOfInteger.hxx>
@@ -117,7 +118,7 @@ void BOPAlgo_CellsBuilder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
{
BOPAlgo_Builder::PerformInternal1(theFiller);
//
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
@@ -446,8 +447,6 @@ void BOPAlgo_CellsBuilder::RemoveAllFromResult()
//=======================================================================
void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
{
myWarningStatus = 0;
//
if (myMaterials.IsEmpty()) {
return;
}
@@ -489,7 +488,15 @@ void BOPAlgo_CellsBuilder::RemoveInternalBoundaries()
//
BOPCol_ListOfShape aLSNew;
if (aItLS.More()) {
myWarningStatus |= RemovalOfIBForMDimShapes;
// add the warning
{
TopoDS_Compound aMultiDimS;
aBB.MakeCompound(aMultiDimS);
aBB.Add(aMultiDimS, aLS.First());
aBB.Add(aMultiDimS, aItLS.Value());
//
AddWarning (new BOPAlgo_AlertRemovalOfIBForMDimShapes (aMultiDimS));
}
aLSNew.Assign(aLS);
}
else {
@@ -755,7 +762,12 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
}
//
if (theLSNew.IsEmpty()) {
myWarningStatus |= (bFaces ? RemovalOfIBForFacesFailed : RemovalOfIBForEdgesFailed);
// add the warning
if (bFaces)
AddWarning (new BOPAlgo_AlertRemovalOfIBForFacesFailed (aShape));
else
AddWarning (new BOPAlgo_AlertRemovalOfIBForEdgesFailed (aShape));
//
theLSNew.Assign(theLS);
return bRemoved;
}
@@ -855,8 +867,18 @@ Standard_Boolean BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape&
aBS.SetShapes(aLFUnique);
aBS.Perform();
//
if (aBS.ErrorStatus() || aBS.Areas().Extent() != 1) {
myWarningStatus |= RemovalOfIBForSolidsFailed;
if (aBS.HasErrors() || aBS.Areas().Extent() != 1) {
// add the warning
{
TopoDS_Compound aUniqeFaces;
aBB.MakeCompound(aUniqeFaces);
BOPCol_ListIteratorOfListOfShape aItLFUniqe(aLFUnique);
for (; aItLFUniqe.More(); aItLFUniqe.Next()) {
aBB.Add(aUniqeFaces, aItLFUniqe.Value());
}
//
AddWarning (new BOPAlgo_AlertRemovalOfIBForSolidsFailed (aUniqeFaces));
}
//
aItS.Initialize(aCB);
for (; aItS.More(); aItS.Next()) {
@@ -1078,30 +1100,3 @@ TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim)
}
return aRet;
}
//=======================================================================
//function : DumpWarnings
//purpose :
//=======================================================================
void BOPAlgo_CellsBuilder::DumpWarnings(Standard_OStream& theOS) const
{
Standard_Integer aWarningStatus[4] = {
RemovalOfIBForMDimShapes,
RemovalOfIBForSolidsFailed,
RemovalOfIBForFacesFailed,
RemovalOfIBForEdgesFailed,
};
//
Standard_CString aWarningMessage[4] = {
"Removal of internal boundaries among the multi-dimensional shapes is not supported yet.",
"Removal of internal boundaries among Solids has failed.",
"Removal of internal boundaries among Faces has failed.",
"Removal of internal boundaries among Edges has failed."
};
//
for (Standard_Integer i = 0; i < 4; ++i) {
if (myWarningStatus & aWarningStatus[i]) {
theOS << "Warning: " << aWarningMessage[i] << "\n";
}
}
}

View File

@@ -93,19 +93,21 @@
//! There could be Generated shapes only after removing of the internal boundaries
//! between faces and edges, i.e. after using ShapeUpgrade_UnifySameDomain tool.<br>
//!
//! The algorithm can return the following Error Statuses:<br>
//! - 0 - in case of success;<br>
//! - Error status acquired in the General Fuse algorithm.<br>
//! The Error status can be checked with ErrorStatus() method.
//! If the Error status is not equal to zero, the result cannot be trustworthy.<br>
//! The algorithm can return the following Error Statuses:
//! - Error status acquired in the General Fuse algorithm.
//! The Error status can be checked with HasErrors() method.
//! If the Error status is not equal to zero, the result cannot be trustworthy.
//!
//! The algorithm can return the following Warning Statuses:<br>
//! - 0 - no warnings occurred;<br>
//! - Warning status acquired in the General Fuse algorithm;<br>
//! - One of the warnings from BOPAlgo_CellsBuilder_WarningStatusEnum.<br>
//! The Warning status can be checked with WarningStatus() method or
//! printed with the DumpWarnings() method. If the Warning status is not equal
//! to zero, the result may be not as expected.<br>
//! The algorithm can set the following Warning Statuses:
//! - Warning status acquired in the General Fuse algorithm;
//! - BOPAlgo_AlertRemovalOfIBForMDimShapes
//! - BOPAlgo_AlertRemovalOfIBForFacesFailed
//! - BOPAlgo_AlertRemovalOfIBForEdgesFailed
//! - BOPAlgo_AlertRemovalOfIBForSolidsFailed
//!
//! The Warning status can be checked with HasWarnings() method or
//! printed with the DumpWarnings() method. If warnings are recorded,
//! the result may be not as expected.<br>
//!
//! Examples:<br>
//! 1. API<br>
@@ -121,7 +123,7 @@
//! aCBuilder.SetFuzzyValue(aTol);<br>
//! //<br>
//! aCBuilder.Perform();<br>
//! if (aCBuilder.ErrorStatus()) { // check error status<br>
//! if (aCBuilder.HasErrors()) { // check error status<br>
//! return;<br>
//! }<br>
//! /* empty compound, as nothing has been added yet */<br>
@@ -226,8 +228,8 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
//! Removes internal boundaries between cells with the same material.<br>
//! If the result contains the cells with same material but of different dimension
//! the removal of internal boundaries between these cells will not be performed.<br>
//! In case of some errors during the removal the method will set the appropriate warning status -
//! see the WarningStatusEnum enumeration.
//! In case of some errors during the removal the method will set the appropriate warning
//! status - use GetReport() to access them.
Standard_EXPORT void RemoveInternalBoundaries();
//! Get all split parts.
@@ -242,23 +244,6 @@ class BOPAlgo_CellsBuilder : public BOPAlgo_Builder
//! Returns true if the shape theS has been deleted.
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE;
//! Define possible warning statuses of the CellsBuilder algorithm:<br>
//! - RemovalOfIBForMDimShapes - The result contains multi-dimensional shapes with the same
//! material. Removal of internal boundaries has not been performed.<br>
//! - RemovalOfIBForSolidsFailed - Removal of internal boundaries among Solids has failed.<br>
//! - RemovalOfIBForFacesFailed - Removal of internal boundaries among Faces has failed.<br>
//! - RemovalOfIBForEdgesFailed - Removal of internal boundaries among Edges has failed.<br>
enum WarningStatusEnum
{
RemovalOfIBForMDimShapes = 2,
RemovalOfIBForSolidsFailed = 4,
RemovalOfIBForFacesFailed = 8,
RemovalOfIBForEdgesFailed = 16
};
//! Dumps the warning status
Standard_EXPORT virtual void DumpWarnings(Standard_OStream& theOS) const;
protected:
//! Redefined method Prepare - no need to prepare history

View File

@@ -18,6 +18,7 @@
//
#include <BOPAlgo_CheckerSI.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_MapOfShape.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_DS.hxx>
@@ -151,8 +152,6 @@ void BOPAlgo_CheckerSI::SetLevelOfCheck(const Standard_Integer theLevel)
//=======================================================================
void BOPAlgo_CheckerSI::Init()
{
myErrorStatus=0;
//
Clear();
//
// 1. myDS
@@ -170,8 +169,6 @@ void BOPAlgo_CheckerSI::Init()
//
// 3 myContext
myContext=new IntTools_Context;
//
myErrorStatus=0;
}
//=======================================================================
//function : Perform
@@ -182,9 +179,8 @@ void BOPAlgo_CheckerSI::Perform()
try {
OCC_CATCH_SIGNALS
//
myErrorStatus = 0;
if (myArguments.Extent() != 1) {
myErrorStatus = 10;
AddError (new BOPAlgo_AlertMultipleArguments);
return;
}
//
@@ -194,16 +190,16 @@ void BOPAlgo_CheckerSI::Perform()
CheckFaceSelfIntersection();
// Perform intersection with solids
if (!myErrorStatus)
if (!HasErrors())
PerformVZ();
//
if (!myErrorStatus)
if (!HasErrors())
PerformEZ();
//
if (!myErrorStatus)
if (!HasErrors())
PerformFZ();
//
if (!myErrorStatus)
if (!HasErrors())
PerformZZ();
//
// Treat the intersection results
@@ -211,7 +207,7 @@ void BOPAlgo_CheckerSI::Perform()
}
//
catch (Standard_Failure) {
myErrorStatus = 11;
AddError (new BOPAlgo_AlertIntersectionFailed);
}
}
//=======================================================================
@@ -223,8 +219,6 @@ void BOPAlgo_CheckerSI::PostTreat()
Standard_Integer i, aNb, n1, n2;
BOPDS_Pair aPK;
//
myErrorStatus=0;
//
BOPDS_MapOfPair& aMPK=
*((BOPDS_MapOfPair*)&myDS->Interferences());

View File

@@ -27,12 +27,13 @@
#include <BOPAlgo_PaveFiller.hxx>
//! Checks the shape on self-interference.<br>
//! In case of error the algorithm may return the following ErrorStatus:<br>
//! 10 - The number of the input arguments is not one;<br>
//! 11 - The check has been aborted during intersection of sub-shapes.<br>
//! Checks the shape on self-interference.
//!
//! The algorithm can set the following errors:
//! - *BOPAlgo_AlertMultipleArguments* - The number of the input arguments is not one;
//! - *BOPALgo_ErrorIntersectionFailed* - The check has been aborted during intersection of sub-shapes.
//! In case the error has occurred during intersection of sub-shapes, i.e.
//! in BOPAlgo_PaveFiller::PerformInternal() method, the ErrorStatus from this method
//! in BOPAlgo_PaveFiller::PerformInternal() method, the errors from this method
//! directly will be returned.
class BOPAlgo_CheckerSI : public BOPAlgo_PaveFiller

View File

@@ -247,8 +247,6 @@ void BOPAlgo_CheckerSI::PerformVZ()
TopAbs_State aState;
BOPDS_MapOfPair aMPK;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
@@ -327,8 +325,6 @@ void BOPAlgo_CheckerSI::PerformZZ()
Standard_Boolean bHasInterf;
Standard_Integer iSize, nZ1, nZ, k, aNbSolidSolid;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_SOLID, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {
@@ -376,8 +372,6 @@ void BOPAlgo_CheckerSI::PerformSZ(const TopAbs_ShapeEnum aTS)
Standard_Boolean bHasInterf;
Standard_Integer iSize, nS, nZ, k, aNbShapeSolid;
//
myErrorStatus=0;
//
myIterator->Initialize(aTS, TopAbs_SOLID);
iSize=myIterator->ExpectedLength();
if (!iSize) {

View File

@@ -16,6 +16,7 @@
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_MakerVolume.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
@@ -40,20 +41,11 @@ static
void BOPAlgo_MakerVolume::CheckData()
{
if (myArguments.IsEmpty()) {
myErrorStatus = 100; // no arguments to process
return;
}
// myPaveFiller
if (!myPaveFiller) {
myErrorStatus = 101;
AddError (new BOPAlgo_AlertTooFewArguments); // no arguments to process
return;
}
//
myErrorStatus = myPaveFiller->ErrorStatus();
if (myErrorStatus) {
myErrorStatus = 102; // PaveFiller is failed
return;
}
CheckFiller();
}
//=======================================================================
@@ -62,7 +54,7 @@ void BOPAlgo_MakerVolume::CheckData()
//=======================================================================
void BOPAlgo_MakerVolume::Perform()
{
myErrorStatus = 0;
GetReport()->Clear();
//
if (myEntryPoint == 1) {
if (myPaveFiller) {
@@ -115,21 +107,19 @@ void BOPAlgo_MakerVolume::Perform()
void BOPAlgo_MakerVolume::PerformInternal1
(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
//
myPaveFiller = (BOPAlgo_PaveFiller*)&theFiller;
myDS = myPaveFiller->PDS();
myContext = myPaveFiller->Context();
//
// 1. CheckData
CheckData();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
// 2. Prepare
Prepare();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
@@ -137,29 +127,29 @@ void BOPAlgo_MakerVolume::PerformInternal1
// 3.1. Vertice
if (myIntersect) {
FillImagesVertices();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.2. Edges
FillImagesEdges();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.3. Wires
FillImagesContainers(TopAbs_WIRE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.4. Faces
FillImagesFaces();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
}
//
// 4. Collect faces
CollectFaces();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
@@ -171,7 +161,7 @@ void BOPAlgo_MakerVolume::PerformInternal1
//
// 6. Make volumes
BuildSolids(aLSR);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
@@ -272,8 +262,9 @@ void BOPAlgo_MakerVolume::BuildSolids(BOPCol_ListOfShape& theLSR)
aBS.SetRunParallel(myRunParallel);
aBS.SetAvoidInternalShapes(myAvoidInternalShapes);
aBS.Perform();
if (aBS.ErrorStatus()) {
myErrorStatus = 103;
if (aBS.HasErrors())
{
AddError (new BOPAlgo_AlertSolidBuilderFailed); // SolidBuilder failed
return;
}
//
@@ -472,4 +463,3 @@ void TreatCompound(const TopoDS_Shape& theS,
TreatCompound(aS, aMFence, theLS);
}
}

View File

@@ -89,11 +89,9 @@ class BOPAlgo_PaveFiller;
//!
//! <myRunParallel> - Defines whether the parallel processing is
//! switched on or not.
//! <myErrorStatus> - Error status of the operation:
//! 0 - operation successful;
//! 100 - no shapes to process;
//! 102 - BOPAlgo_PaveFiller algorithm has failed;
//! 103 - BOPAlgo_BuilderSolid algorithm has failed.
//! <myReport> - Error status of the operation. Additionally to the
//! errors of the parent algorithm it can have the following values:
//! - *BOPAlgo_AlertSolidBuilderFailed* - BOPAlgo_BuilderSolid algorithm has failed.
//!
//! Example:
//!
@@ -181,6 +179,7 @@ protected:
//! Builds the result.
Standard_EXPORT void BuildShape (const BOPCol_ListOfShape& theLSR);
Standard_Boolean myIntersect;
Bnd_Box myBBox;
TopoDS_Solid mySBox;

View File

@@ -0,0 +1,151 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_Options.hxx>
#include <Message_MsgFile.hxx>
#include <Message_ProgressIndicator.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ProgramError.hxx>
namespace
{
Standard_Boolean myGlobalRunParallel = Standard_False;
// Initialize textual messages for errors and warnings defined in BOPAlgo
#include "BOPAlgo_BOPAlgo_msg.pxx"
bool BOPAlgo_InitMessages = false;
void BOPAlgo_LoadMessages ()
{
if (BOPAlgo_InitMessages)
return;
BOPAlgo_InitMessages = true;
if (! Message_MsgFile::HasMsg ("BOPAlgo_LOAD_CHECKER"))
{
Message_MsgFile::LoadFromString (BOPAlgo_BOPAlgo_msg);
}
}
}
//=======================================================================
// function:
// purpose:
//=======================================================================
BOPAlgo_Options::BOPAlgo_Options()
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
{
BOPAlgo_LoadMessages();
}
//=======================================================================
// function:
// purpose:
//=======================================================================
BOPAlgo_Options::BOPAlgo_Options
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion())
{
BOPAlgo_LoadMessages();
}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
BOPAlgo_Options::~BOPAlgo_Options()
{
}
//=======================================================================
//function : DumpErrors
//purpose :
//=======================================================================
void BOPAlgo_Options::DumpErrors(Standard_OStream& theOS) const
{
myReport->Dump (theOS, Message_Fail);
}
//=======================================================================
//function : DumpWarnings
//purpose :
//=======================================================================
void BOPAlgo_Options::DumpWarnings(Standard_OStream& theOS) const
{
myReport->Dump (theOS, Message_Warning);
}
//=======================================================================
// function:
// purpose:
//=======================================================================
void BOPAlgo_Options::SetParallelMode(Standard_Boolean theNewMode)
{
myGlobalRunParallel = theNewMode;
}
//=======================================================================
// function:
// purpose:
//=======================================================================
Standard_Boolean BOPAlgo_Options::GetParallelMode()
{
return myGlobalRunParallel;
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BOPAlgo_Options::SetFuzzyValue(const Standard_Real theFuzz)
{
myFuzzyValue = Max(theFuzz, Precision::Confusion());
}
//=======================================================================
//function : SetProgressIndicator
//purpose :
//=======================================================================
void BOPAlgo_Options::SetProgressIndicator
(const Handle(Message_ProgressIndicator)& theObj)
{
if (!theObj.IsNull()) {
myProgressIndicator = theObj;
}
}
//=======================================================================
//function : UserBreak
//purpose :
//=======================================================================
void BOPAlgo_Options::UserBreak() const
{
if (myProgressIndicator.IsNull()) {
return;
}
if (myProgressIndicator->UserBreak()) {
throw Standard_NotImplemented("BOPAlgo_Options::UserBreak(), method is not implemented");
}
}

View File

@@ -0,0 +1,175 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BOPAlgo_Options_HeaderFile
#define _BOPAlgo_Options_HeaderFile
#include <Message_Report.hxx>
#include <Standard_OStream.hxx>
#include <BOPCol_BaseAllocator.hxx>
class Message_ProgressIndicator;
//! The class provides the following options for the algorithms in Boolean Component:
//! - *Memory allocation tool* - tool for memory allocations;
//! - *Error and warning reporting* - allows recording warnings and errors occurred
//! during the operation.
//! Error means that the algorithm has failed.
//! - *Parallel processing mode* - provides the possibility to perform operation in parallel mode;
//! - *Fuzzy tolerance* - additional tolerance for the operation to detect
//! touching or coinciding cases;
//! - *Progress indicator* - provides interface to track the progress of
//! operation and stop the operation by user's break.
//!
class BOPAlgo_Options
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT BOPAlgo_Options();
//! Constructor with allocator
Standard_EXPORT BOPAlgo_Options(const BOPCol_BaseAllocator& theAllocator);
//! Destructor
Standard_EXPORT virtual ~BOPAlgo_Options();
//! Returns allocator
const BOPCol_BaseAllocator& Allocator() const
{
return myAllocator;
}
//! Clears all warnings and errors, and any data cached by the algorithm.
//! User defined options are not cleared.
virtual void Clear()
{
myReport->Clear();
}
public:
//!@name Error reporting mechanism
//! Adds the alert as error (fail)
void AddError (const Handle(Message_Alert)& theAlert)
{
myReport->AddAlert (Message_Fail, theAlert);
}
//! Adds the alert as warning
void AddWarning (const Handle(Message_Alert)& theAlert)
{
myReport->AddAlert (Message_Warning, theAlert);
}
//! Returns true if algorithm has failed
Standard_Boolean HasErrors() const
{
return ! myReport->GetAlerts(Message_Fail).IsEmpty();
}
//! Returns true if algorithm has generated error of specified type
Standard_Boolean HasError (const Handle(Standard_Type)& theType) const
{
return myReport->HasAlert(theType, Message_Fail);
}
//! Returns true if algorithm has generated some warning alerts
Standard_Boolean HasWarnings() const
{
return ! myReport->GetAlerts(Message_Warning).IsEmpty();
}
//! Returns true if algorithm has generated warning of specified type
Standard_Boolean HasWarning (const Handle(Standard_Type)& theType) const
{
return myReport->HasAlert(theType, Message_Warning);
}
//! Returns report collecting all errors and warnings
const Handle(Message_Report)& GetReport () const { return myReport; }
//! Dumps the error status into the given stream
Standard_EXPORT void DumpErrors(Standard_OStream& theOS) const;
//! Dumps the warning statuses into the given stream
Standard_EXPORT void DumpWarnings(Standard_OStream& theOS) const;
//! Clears the warnings of the algorithm
void ClearWarnings()
{
myReport->Clear (Message_Warning);
}
public:
//!@name Parallel processing mode
//! Gets the global parallel mode
Standard_EXPORT static Standard_Boolean GetParallelMode();
//! Sets the global parallel mode
Standard_EXPORT static void SetParallelMode(const Standard_Boolean theNewMode);
//! Set the flag of parallel processing
//! if <theFlag> is true the parallel processing is switched on
//! if <theFlag> is false the parallel processing is switched off
void SetRunParallel(const Standard_Boolean theFlag)
{
myRunParallel = theFlag;
}
//! Returns the flag of parallel processing
Standard_Boolean RunParallel() const
{
return myRunParallel;
}
public:
//!@name Fuzzy tolerance
//! Sets the additional tolerance
Standard_EXPORT void SetFuzzyValue(const Standard_Real theFuzz);
//! Returns the additional tolerance
Standard_Real FuzzyValue() const
{
return myFuzzyValue;
}
public:
//!@name Progress indicator
//! Set the Progress Indicator object.
Standard_EXPORT void SetProgressIndicator(const Handle(Message_ProgressIndicator)& theObj);
protected:
//! Breaks the execution if the break signal
//! is indicated by myProgressIndicator.
Standard_EXPORT void UserBreak() const;
protected:
BOPCol_BaseAllocator myAllocator;
Handle(Message_Report) myReport;
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
Handle(Message_ProgressIndicator) myProgressIndicator;
};
#endif // _BOPAlgo_Options_HeaderFile

View File

@@ -18,6 +18,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
@@ -124,6 +125,7 @@ Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const
//=======================================================================
void BOPAlgo_PaveFiller::Clear()
{
BOPAlgo_Algo::Clear();
if (myIterator) {
delete myIterator;
myIterator=NULL;
@@ -188,13 +190,19 @@ const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
//=======================================================================
void BOPAlgo_PaveFiller::Init()
{
myErrorStatus=0;
//
if (!myArguments.Extent()) {
myErrorStatus=10;
AddError (new BOPAlgo_AlertTooFewArguments);
return;
}
//
BOPCol_ListIteratorOfListOfShape aIt(myArguments);
for (; aIt.More(); aIt.Next()) {
if (aIt.Value().IsNull()) {
AddError (new BOPAlgo_AlertNullInputShapes);
return;
}
}
//
// 0 Clear
Clear();
//
@@ -214,8 +222,6 @@ void BOPAlgo_PaveFiller::Init()
//
// 4 NonDestructive flag
SetNonDestructive();
//
myErrorStatus=0;
}
//=======================================================================
// function: Perform
@@ -223,15 +229,14 @@ void BOPAlgo_PaveFiller::Init()
//=======================================================================
void BOPAlgo_PaveFiller::Perform()
{
myErrorStatus=0;
try {
try {
OCC_CATCH_SIGNALS
//
PerformInternal();
}
//
catch (Standard_Failure) {
myErrorStatus=11;
AddError (new BOPAlgo_AlertIntersectionFailed);
}
}
//=======================================================================
@@ -240,44 +245,42 @@ void BOPAlgo_PaveFiller::Perform()
//=======================================================================
void BOPAlgo_PaveFiller::PerformInternal()
{
myErrorStatus=0;
//
Init();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
Prepare();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 00
PerformVV();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 01
PerformVE();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UpdatePaveBlocksWithSDVertices();
// 11
PerformEE();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
UpdatePaveBlocksWithSDVertices();
// 02
PerformVF();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
UpdatePaveBlocksWithSDVertices();
// 12
PerformEF();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
UpdatePaveBlocksWithSDVertices();
@@ -285,35 +288,37 @@ void BOPAlgo_PaveFiller::PerformInternal()
//
// 22
PerformFF();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UpdateBlocksWithSharedVertices();
//
MakeSplitEdges();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
UpdatePaveBlocksWithSDVertices();
//
MakeBlocks();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
CheckSelfInterference();
//
UpdateInterfsWithSDVertices();
myDS->ReleasePaveBlocks();
myDS->RefineFaceInfoOn();
//
MakePCurves();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
ProcessDE();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
}

View File

@@ -51,6 +51,7 @@
#include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPAlgo_GlueEnum.hxx>
#include <IntTools_ShrunkRange.hxx>
class IntTools_Context;
class BOPDS_DS;
class BOPAlgo_SectionAttribute;
@@ -62,7 +63,44 @@ class TopoDS_Vertex;
class TopoDS_Edge;
class TopoDS_Face;
//!
//! The class represents the Intersection phase of the
//! Boolean Operations algorithm.<br>
//! It performs the pairwise intersection of the sub-shapes of
//! the arguments in the following order:<br>
//! 1. Vertex/Vertex;<br>
//! 2. Vertex/Edge;<br>
//! 3. Edge/Edge;<br>
//! 4. Vertex/Face;<br>
//! 5. Edge/Face;<br>
//! 6. Face/Face.<br>
//!
//! The results of intersection are stored into the Data Structure
//! of the algorithm.<br>
//!
//! Additionally to the options provided by the parent class,
//! the algorithm has the following options:<br>
//! - *Section attributes* - allows to customize the intersection of the faces
//! (avoid approximation or building 2d curves);<br>
//! - *Safe processing mode* - allows to avoid modification of the input
//! shapes during the operation (by default it is off);<br>
//! - *Gluing options* - allows to speed up the calculation on the special
//! cases, in which some sub-shapes are coincide.<br>
//!
//! The algorithm returns the following Warning statuses:<br>
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;<br>
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;<br>
//! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small
//! valid range so it cannot be split;<br>
//! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation
//! of small edges.<br>
//!
//! The algorithm returns the following Error alerts:
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to
//! perform the operation;<br>
//! - *BOPAlgo_AlertIntersectionFailed* - in case some unexpected error occurred;<br>
//! - *BOPAlgo_AlertNullInputShapes* - in case some of the arguments are null shapes.<br>
//!
class BOPAlgo_PaveFiller : public BOPAlgo_Algo
{
public:
@@ -140,7 +178,7 @@ protected:
Standard_EXPORT virtual void PerformInternal();
Standard_EXPORT virtual void Clear();
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
Standard_EXPORT virtual void Init();
@@ -193,6 +231,12 @@ protected:
Standard_EXPORT void FillShrunkData (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2);
//! Analyzes the results of computation of the valid range for the
//! pave block and in case of error adds the warning status, otherwise
//! saves the valid range in the pave block.
Standard_EXPORT void AnalyzeShrunkData(const Handle(BOPDS_PaveBlock)& thePB,
const IntTools_ShrunkRange& theSR);
//! Performs intersection of new vertices, obtained in E/E and E/F intersections
Standard_EXPORT void PerformNewVertices(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
const BOPCol_BaseAllocator& theAllocator,
@@ -242,11 +286,11 @@ protected:
//! Treatment of section edges.
Standard_EXPORT Standard_Integer PostTreatFF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
const BOPCol_IndexedMapOfShape& theMicroEdges,
const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT void PostTreatFF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
const BOPCol_IndexedMapOfShape& theMicroEdges,
const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB);
@@ -420,6 +464,17 @@ protected:
//! and will be used for splitting.
Standard_EXPORT void PutSEInOtherFaces();
//! Analyzes the results of interferences of sub-shapes of the shapes
//! looking for self-interfering entities by the following rules:<br>
//! 1. The Faces of the same shape considered interfering in case they:<br>
//! - Interfere with the other shapes in the same place (in the same vertex) or;<br>
//! - Included in the same common block.
//! 2. The Faces of the same shape considered interfering in case they
//! share the IN or SECTION edges.<br>
//! In case self-interference is found the warning is added.
Standard_EXPORT void CheckSelfInterference();
BOPCol_ListOfShape myArguments;
BOPDS_PDS myDS;
BOPDS_PIterator myIterator;

View File

@@ -19,6 +19,7 @@
#include <Bnd_Box.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx>
@@ -30,6 +31,7 @@
#include <BOPDS_ShapeInfo.hxx>
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
@@ -39,6 +41,7 @@
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
//=======================================================================
// function: PerformVV
@@ -49,8 +52,6 @@ void BOPAlgo_PaveFiller::PerformVV()
Standard_Integer n1, n2, iFlag, aSize;
Handle(NCollection_BaseAllocator) aAllocator;
//
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
aSize=myIterator->ExpectedLength();
if (!aSize) {
@@ -163,12 +164,27 @@ Standard_Integer BOPAlgo_PaveFiller::MakeSDVertices
Standard_Integer n1 = aItLI.Value();
myDS->AddShapeSD(n1, nV);
//
if (theAddInterfs) {
BOPCol_ListIteratorOfListOfInteger aItLI2 = aItLI;
aItLI2.Next();
for (; aItLI2.More(); aItLI2.Next()) {
Standard_Integer n2 = aItLI2.Value();
Standard_Integer iR1 = myDS->Rank(n1);
const TopoDS_Shape& aV1 = myDS->Shape(n1);
//
BOPCol_ListIteratorOfListOfInteger aItLI2 = aItLI;
aItLI2.Next();
for (; aItLI2.More(); aItLI2.Next()) {
Standard_Integer n2 = aItLI2.Value();
//
if (iR1 >= 0 && iR1 == myDS->Rank(n2)) {
// add warning status
const TopoDS_Shape& aV2 = myDS->Shape(n2);
//
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aV1);
BRep_Builder().Add(aWC, aV2);
//
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
}
//
if (theAddInterfs) {
myDS->AddInterf(n1, n2);
BOPDS_InterfVV& aVV = aVVs.Append1();
//

View File

@@ -0,0 +1,184 @@
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_MapOfCommonBlock.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
//=======================================================================
//function : CheckSelfInterference
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::CheckSelfInterference()
{
if (myArguments.Extent() == 1) {
// Self-interference mode
return;
}
//
BRep_Builder aBB;
//
Standard_Integer i, aNbR = myDS->NbRanges();
for (i = 0; i < aNbR; ++i) {
const BOPDS_IndexRange& aR = myDS->Range(i);
//
// Map of connections of interfering shapes
NCollection_IndexedDataMap<TopoDS_Shape,
BOPCol_IndexedMapOfShape,
TopTools_ShapeMapHasher> aMCSI;
BOPDS_MapOfCommonBlock aMCBFence;
//
Standard_Integer j = aR.First(), aRLast = aR.Last();
for (; j <= aRLast; ++j) {
const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo(j);
if (!aSI.HasReference()) {
// No pave blocks and no face info
continue;
}
//
const TopoDS_Shape& aS = aSI.Shape();
//
if (aSI.ShapeType() == TopAbs_EDGE) {
if (aSI.HasFlag()) {
continue;
}
//
// Analyze the shared vertices and common blocks
//
BOPCol_MapOfInteger aMSubS;
BOPCol_ListIteratorOfListOfInteger aItLI(aSI.SubShapes());
for (; aItLI.More(); aItLI.Next()) {
Standard_Integer nV = aItLI.Value();
myDS->HasShapeSD(nV, nV);
aMSubS.Add(nV);
}
//
const BOPDS_ListOfPaveBlock& aLPB = myDS->PaveBlocks(j);
Standard_Boolean bAnalyzeV = aLPB.Extent() > 1;
//
BOPDS_ListIteratorOfListOfPaveBlock aIt(aLPB);
for (; aIt.More(); aIt.Next()) {
const Handle(BOPDS_PaveBlock)& aPB = aIt.Value();
//
// Check the vertices
if (bAnalyzeV) {
Standard_Integer nV[2];
aPB->Indices(nV[0], nV[1]);
for (Standard_Integer k = 0; k < 2; ++k) {
if (!aR.Contains(nV[k]) && !aMSubS.Contains(nV[k])) {
// Add connection
const TopoDS_Shape& aV = myDS->Shape(nV[k]);
BOPCol_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aV);
if (!pMSOr) {
pMSOr = &aMCSI(aMCSI.Add(aV, BOPCol_IndexedMapOfShape()));
}
pMSOr->Add(aS);
}
}
}
//
// Check common blocks
if (myDS->IsCommonBlock(aPB)) {
const Handle(BOPDS_CommonBlock)& aCB = myDS->CommonBlock(aPB);
if (aMCBFence.Add(aCB)) {
const BOPDS_ListOfPaveBlock& aLPBCB = aCB->PaveBlocks();
//
BOPCol_ListOfInteger aLE;
BOPDS_ListIteratorOfListOfPaveBlock aItCB(aLPBCB);
for (; aItCB.More(); aItCB.Next()) {
const Handle(BOPDS_PaveBlock)& aPBCB = aItCB.Value();
Standard_Integer nEOr = aPBCB->OriginalEdge();
if (aR.Contains(nEOr)) {
aLE.Append(nEOr);
}
}
//
if (aLE.Extent() > 1) {
// Add warning
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
BOPCol_ListIteratorOfListOfInteger aItLE(aLE);
for (; aItLE.More(); aItLE.Next()) {
const TopoDS_Shape& aE1 = myDS->Shape(aItLE.Value());
aBB.Add(aWC, aE1);
}
//
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
}
}
}
}
}
else if(aSI.ShapeType() == TopAbs_FACE) {
// Analyze IN and Section vertices and edges of the faces
const BOPDS_FaceInfo& aFI = myDS->FaceInfo(j);
//
for (Standard_Integer k = 0; k < 2; ++k) {
const BOPCol_MapOfInteger& aMVF = !k ? aFI.VerticesIn() : aFI.VerticesSc();
BOPCol_MapIteratorOfMapOfInteger aItM(aMVF);
for (; aItM.More(); aItM.Next()) {
const TopoDS_Shape& aV = myDS->Shape(aItM.Value());
// add connection
BOPCol_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aV);
if (!pMSOr) {
pMSOr = &aMCSI(aMCSI.Add(aV, BOPCol_IndexedMapOfShape()));
}
pMSOr->Add(aS);
}
}
//
for (Standard_Integer k = 0; k < 2; ++k) {
const BOPDS_IndexedMapOfPaveBlock& aMPBF = !k ? aFI.PaveBlocksIn() : aFI.PaveBlocksSc();
Standard_Integer iPB, aNbPB = aMPBF.Extent();
for (iPB = 1; iPB <= aNbPB; ++iPB) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBF(iPB);
const TopoDS_Shape& aE = myDS->Shape(aPB->Edge());
// add connection
BOPCol_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aE);
if (!pMSOr) {
pMSOr = &aMCSI(aMCSI.Add(aE, BOPCol_IndexedMapOfShape()));
}
pMSOr->Add(aS);
}
}
}
}
//
// Analyze connections
Standard_Integer aNbC = aMCSI.Extent();
for (j = 1; j <= aNbC; ++j) {
const BOPCol_IndexedMapOfShape& aMCS = aMCSI(j);
if (aMCS.Extent() > 1) {
// Add self-interference warning
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
Standard_Integer iS, aNbS = aMCS.Extent();
for (iS = 1; iS <= aNbS; ++iS) {
const TopoDS_Shape& aSx = aMCS(iS);
aBB.Add(aWC, aSx);
}
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
}
}
}
}

View File

@@ -145,8 +145,6 @@ typedef BOPCol_ContextCnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformVE()
{
myErrorStatus=0;
//
FillShrunkData(TopAbs_VERTEX, TopAbs_EDGE);
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);

View File

@@ -19,6 +19,7 @@
#include <Bnd_Box.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
#include <BOPDS_CommonBlock.hxx>
@@ -33,6 +34,7 @@
#include <BOPTools_AlgoTools.hxx>
#include <BndLib_Add3dCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_CommonPrt.hxx>
@@ -118,14 +120,10 @@ typedef BOPCol_Cnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformEE()
{
Standard_Integer iSize;
//
myErrorStatus=0;
//
FillShrunkData(TopAbs_EDGE, TopAbs_EDGE);
//
myIterator->Initialize(TopAbs_EDGE, TopAbs_EDGE);
iSize=myIterator->ExpectedLength();
Standard_Integer iSize = myIterator->ExpectedLength();
if (!iSize) {
return;
}
@@ -582,40 +580,72 @@ void BOPAlgo_PaveFiller::TreatNewVertices
//=======================================================================
void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
{
Standard_Integer nE, nV1, nV2;
Standard_Real aT1, aT2, aTS1, aTS2;
IntTools_ShrunkRange aSR;
//
myErrorStatus=0;
myWarningStatus = 0;
//
const BOPDS_Pave& aPave1=thePB->Pave1();
nV1=aPave1.Index();
aT1=aPave1.Parameter();
// Vertices
Standard_Integer nV1, nV2;
thePB->Indices(nV1, nV2);
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
//
const BOPDS_Pave& aPave2=thePB->Pave2();
nV2=aPave2.Index();
aT2=aPave2.Parameter();
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
//
nE=thePB->OriginalEdge();
// Original edge
Standard_Integer nE = thePB->OriginalEdge();
const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE)));
// Range
Standard_Real aT1, aT2;
thePB->Range(aT1, aT2);
//
IntTools_ShrunkRange aSR;
aSR.SetContext(myContext);
aSR.SetData(aE, aT1, aT2, aV1, aV2);
//
aSR.Perform();
if (!aSR.IsDone()) {
myWarningStatus = 1;
return;
// Analyze the results of computations
AnalyzeShrunkData(thePB, aSR);
}
//=======================================================================
// function: AnalyzeShrunkData
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::AnalyzeShrunkData(const Handle(BOPDS_PaveBlock)& thePB,
const IntTools_ShrunkRange& theSR)
{
// in case of error treat the warning status
Standard_Boolean bWholeEdge = Standard_False;
TopoDS_Shape aWarnShape;
//
if (!theSR.IsDone() || !theSR.IsSplittable()) {
Standard_Real aEFirst, aELast, aPBFirst, aPBLast;
BRep_Tool::Range(theSR.Edge(), aEFirst, aELast);
thePB->Range(aPBFirst, aPBLast);
bWholeEdge = !(aPBFirst > aEFirst || aPBLast < aELast);
if (bWholeEdge) {
aWarnShape = theSR.Edge();
}
else {
const TopoDS_Shape& aV1 = myDS->Shape(thePB->Pave1().Index());
const TopoDS_Shape& aV2 = myDS->Shape(thePB->Pave2().Index());
BRep_Builder().MakeCompound(TopoDS::Compound(aWarnShape));
BRep_Builder().Add(aWarnShape, theSR.Edge());
BRep_Builder().Add(aWarnShape, aV1);
BRep_Builder().Add(aWarnShape, aV2);
}
//
if (!theSR.IsDone()) {
if (bWholeEdge)
AddWarning (new BOPAlgo_AlertTooSmallEdge (aWarnShape));
else
AddWarning (new BOPAlgo_AlertBadPositioning (aWarnShape));
return;
}
//
if (bWholeEdge)
AddWarning (new BOPAlgo_AlertNotSplittableEdge (aWarnShape));
else
AddWarning (new BOPAlgo_AlertBadPositioning (aWarnShape));
}
//
aSR.ShrunkRange(aTS1, aTS2);
const Bnd_Box& aBox=aSR.BndBox();
Standard_Boolean bIsSplittable = aSR.IsSplittable();
//
thePB->SetShrunkData(aTS1, aTS2, aBox, bIsSplittable);
Standard_Real aTS1, aTS2;
theSR.ShrunkRange(aTS1, aTS2);
Bnd_Box aBox = theSR.BndBox();
aBox.SetGap(aBox.GetGap() + myFuzzyValue / 2.);
thePB->SetShrunkData(aTS1, aTS2, aBox, theSR.IsSplittable());
}
//=======================================================================
//function : ForceInterfVE
@@ -637,7 +667,7 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
//
if (myDS->HasInterf(nV, nE)) {
return;
}
}
//
if (myDS->HasInterfShapeSubShapes(nV, nE)) {
return;
@@ -682,6 +712,17 @@ void BOPAlgo_PaveFiller::ForceInterfVE(const Standard_Integer nV,
aPB->AppendExtPave(aPave);
//
theMEdges.Add(nE);
//
// check for self-interference
Standard_Integer iRV = myDS->Rank(nV);
if (iRV >= 0 && iRV == myDS->Rank(nE)) {
// add warning status
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aV);
BRep_Builder().Add(aWC, aE);
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
}
}
}

View File

@@ -142,8 +142,6 @@ typedef BOPCol_ContextCnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformVF()
{
myErrorStatus=0;
//
myIterator->Initialize(TopAbs_VERTEX, TopAbs_FACE);
Standard_Integer iSize = myIterator->ExpectedLength();
//
@@ -260,9 +258,6 @@ void BOPAlgo_PaveFiller::TreatVerticesEE()
BOPCol_MapOfInteger aMI(100, aAllocator);
BOPDS_MapOfPaveBlock aMPBF(100, aAllocator);
//
myErrorStatus=0;
//
aNbS=myDS->NbSourceShapes();
//
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();

View File

@@ -18,6 +18,7 @@
#include <Bnd_Box.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
@@ -132,8 +133,6 @@ typedef BOPCol_ContextCnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformEF()
{
myErrorStatus=0;
//
FillShrunkData(TopAbs_EDGE, TopAbs_FACE);
//
myIterator->Initialize(TopAbs_EDGE, TopAbs_FACE);
@@ -564,6 +563,18 @@ Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
aMVIn.Add(nVx);
//
// check for self-interference
Standard_Integer iRV = myDS->Rank(nV);
if (iRV >= 0 && iRV == myDS->Rank(nF)) {
// add warning status
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aV);
BRep_Builder().Add(aWC, aF);
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
}
}
return bRet;
}

View File

@@ -19,6 +19,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeInteger.hxx>
#include <BOPCol_ListOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
@@ -172,8 +173,6 @@ typedef BOPCol_Cnt
//=======================================================================
void BOPAlgo_PaveFiller::PerformFF()
{
myErrorStatus = 0;
//
myIterator->Initialize(TopAbs_FACE, TopAbs_FACE);
Standard_Integer iSize = myIterator->ExpectedLength();
if (!iSize) {
@@ -339,12 +338,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
return;
}
//
Standard_Integer aNbFF;
//
myErrorStatus=0;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
aNbFF=aFFs.Extent();
Standard_Integer aNbFF = aFFs.Extent();
if (!aNbFF) {
return;
}
@@ -644,8 +639,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
//
// post treatment
MakeSDVerticesFF(aDMVLV, aDMNewSD);
myErrorStatus=PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
if (myErrorStatus) {
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
if (HasErrors()) {
return;
}
// reduce tolerances of section edges where it is appropriate
@@ -697,23 +692,20 @@ void BOPAlgo_PaveFiller::MakeSDVerticesFF
//function : PostTreatFF
//purpose :
//=======================================================================
Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
void BOPAlgo_PaveFiller::PostTreatFF
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
BOPCol_DataMapOfIntegerInteger& aDMNewSD,
const BOPCol_IndexedMapOfShape& theMicroEdges,
const Handle(NCollection_BaseAllocator)& theAllocator)
{
Standard_Integer iRet, aNbS;
//
iRet=0;
aNbS=theMSCPB.Extent();
Standard_Integer aNbS = theMSCPB.Extent();
if (!aNbS) {
return iRet;
return;
}
//
Standard_Boolean bHasPaveBlocks, bOld;
Standard_Integer iErr, nSx, nVSD, iX, iP, iC, j, nV, iV = 0, iE, k;
Standard_Integer nSx, nVSD, iX, iP, iC, j, nV, iV = 0, iE, k;
Standard_Integer aNbLPBx;
TopAbs_ShapeEnum aType;
TopoDS_Shape aV, aE;
@@ -765,7 +757,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
aPB1->SetEdge(iE);
}
}
return iRet;
return;
}
//
// 1 prepare arguments
@@ -838,9 +830,9 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS);
aPF.Perform();
iErr=aPF.ErrorStatus();
if (iErr) {
return iRet;
if (aPF.HasErrors()) {
AddError (new BOPAlgo_AlertPostTreatFF);
return;
}
aPDS=aPF.PDS();
//
@@ -1061,7 +1053,7 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
myDS->AddShapeSD(itDM.Key(), *pSD);
}
}
return iRet;
return;
}
//=======================================================================
@@ -2753,8 +2745,6 @@ void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
return;
}
//
myErrorStatus=0;
//
Standard_Integer aNbFF;
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();

View File

@@ -356,12 +356,8 @@ typedef BOPCol_Cnt
//=======================================================================
void BOPAlgo_PaveFiller::MakeSplitEdges()
{
Standard_Integer aNbPBP;
//
myErrorStatus=0;
//
BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
aNbPBP=aPBP.Extent();
Standard_Integer aNbPBP = aPBP.Extent();
if(!aNbPBP) {
return;
}
@@ -541,8 +537,6 @@ void BOPAlgo_PaveFiller::MakePCurves()
TopoDS_Face aF1F, aF2F;
BOPAlgo_VectorOfMPC aVMPC;
//
myErrorStatus=0;
//
// 1. Process Common Blocks
const BOPDS_VectorOfFaceInfo& aFIP=myDS->FaceInfoPool();
//
@@ -746,8 +740,6 @@ void BOPAlgo_PaveFiller::Prepare()
TopExp_Explorer aExp;
BOPCol_IndexedMapOfShape aMF;
//
myErrorStatus=0;
//
aNb=3;
for(i=0; i<aNb; ++i) {
myIterator->Initialize(aType[i], aType[2]);

View File

@@ -63,8 +63,6 @@ void BOPAlgo_PaveFiller::ProcessDE()
Handle(BOPDS_PaveBlock) aPBD;
BOPCol_ListIteratorOfListOfInteger aItLI;
//
myErrorStatus=0;
//
// 1. Find degnerated edges
//-----------------------------------------------------scope f
//

View File

@@ -84,19 +84,14 @@ typedef BOPCol_ContextCnt
void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
const TopAbs_ShapeEnum aType2)
{
Standard_Integer iSize;
//
myErrorStatus=0;
//
myIterator->Initialize(aType1, aType2);
iSize=myIterator->ExpectedLength();
Standard_Integer iSize = myIterator->ExpectedLength();
if (!iSize) {
return;
}
//
Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k;
Standard_Real aT1, aT2, aTS1, aTS2;
Standard_Real aT1, aT2;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
BOPCol_MapOfInteger aMI;
BOPAlgo_VectorOfShrunkRange aVSD;
@@ -149,19 +144,8 @@ void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
//=============================================================
//
Standard_Real aFuzz = myFuzzyValue / 2.;
for (k=0; k < aNbVSD; ++k) {
BOPAlgo_ShrunkRange& aSD=aVSD(k);
if (!aSD.IsDone()) {
continue;
}
//
Handle(BOPDS_PaveBlock)& aPB=aSD.PaveBlock();
aSD.ShrunkRange(aTS1, aTS2);
Bnd_Box aBox=aSD.BndBox();
aBox.SetGap(aBox.GetGap() + aFuzz);
Standard_Boolean bIsSplittable = aSD.IsSplittable();
//
aPB->SetShrunkData(aTS1, aTS2, aBox, bIsSplittable);
BOPAlgo_ShrunkRange& aSD = aVSD(k);
AnalyzeShrunkData(aSD.PaveBlock(), aSD);
}
}

View File

@@ -16,6 +16,7 @@
#include <BOPAlgo_BuilderSolid.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Section.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_DataMapOfShapeShape.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
@@ -79,23 +80,13 @@ void BOPAlgo_Section::CheckData()
{
Standard_Integer aNbArgs;
//
myErrorStatus=0;
//
aNbArgs=myArguments.Extent();
if (!aNbArgs) {
myErrorStatus=100; // invalid number of Arguments
AddError (new BOPAlgo_AlertTooFewArguments);
return;
}
//
if (!myPaveFiller) {
myErrorStatus=101;
return;
}
//
myErrorStatus=myPaveFiller->ErrorStatus();
if (myErrorStatus) {
return;
}
CheckFiller();
}
//=======================================================================
//function : PerformInternal1
@@ -104,59 +95,53 @@ void BOPAlgo_Section::CheckData()
void BOPAlgo_Section::PerformInternal1
(const BOPAlgo_PaveFiller& theFiller)
{
myErrorStatus=0;
myWarningStatus=0;
//
myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
myDS=myPaveFiller->PDS();
myContext=myPaveFiller->Context();
//
// 1. CheckData
CheckData();
if (myErrorStatus && !myWarningStatus) {
if (HasErrors()) {
return;
}
//
// 2. Prepare
Prepare();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
if(myWarningStatus == 2) {
return;
}
// 3. Fill Images
// 3.1 Vertices
FillImagesVertices();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_VERTEX);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 3.2 Edges
FillImagesEdges();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
BuildResult(TopAbs_EDGE);
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 4. Section
BuildSection();
//
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 5.History
PrepareHistory();
//
if (myErrorStatus) {
if (HasErrors()) {
return;
}
// 6. Post-treatment
@@ -181,7 +166,7 @@ void BOPAlgo_Section::BuildSection()
BOPCol_MapIteratorOfMapOfInteger aItMI;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
//
myErrorStatus=0;
GetReport()->Clear();
//
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC1);
//
@@ -413,4 +398,3 @@ const TopTools_ListOfShape& BOPAlgo_Section::Generated
//
return myHistShapes;
}

View File

@@ -40,10 +40,9 @@ public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT BOPAlgo_Section();
Standard_EXPORT virtual ~BOPAlgo_Section();
Standard_EXPORT virtual ~BOPAlgo_Section();
//! Empty constructor
//!
@@ -57,32 +56,16 @@ Standard_EXPORT virtual ~BOPAlgo_Section();
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& theS) Standard_OVERRIDE;
protected:
Standard_EXPORT virtual void CheckData() Standard_OVERRIDE;
//! Performs calculations using prepared Filler
//! object <thePF>
Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF) Standard_OVERRIDE;
private:
};
#endif // _BOPAlgo_Section_HeaderFile

View File

@@ -150,10 +150,10 @@ const BOPCol_ListOfShape& BOPAlgo_ShellSplitter::Shells()const
//=======================================================================
void BOPAlgo_ShellSplitter::Perform()
{
myErrorStatus=0;
GetReport()->Clear();
//
MakeConnexityBlocks();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//
@@ -178,8 +178,6 @@ void BOPAlgo_ShellSplitter::MakeConnexityBlocks()
BOPCol_MapOfShape aMES(100, myAllocator);
BOPCol_ListIteratorOfListOfShape aIt;
//
myErrorStatus=0;
//
myLCB.Clear();
//
const BOPCol_ListOfShape& aLSE=myStartShapes;
@@ -696,7 +694,6 @@ void BOPAlgo_ShellSplitter::MakeShells()
BOPCol_ListIteratorOfListOfShape aIt;
BOPAlgo_VectorOfCBK aVCBK;
//
myErrorStatus=0;
myShells.Clear();
//
aItCB.Initialize(myLCB);

View File

@@ -59,13 +59,10 @@ Standard_EXPORT virtual ~BOPAlgo_ShellSplitter();
Standard_EXPORT static void SplitBlock (BOPTools_ConnexityBlock& theCB);
protected:
Standard_EXPORT void MakeConnexityBlocks();
Standard_EXPORT void MakeShells();
@@ -73,19 +70,8 @@ protected:
BOPCol_ListOfShape myShells;
BOPTools_ListOfConnexityBlock myLCB;
private:
};
#endif // _BOPAlgo_ShellSplitter_HeaderFile

View File

@@ -15,6 +15,7 @@
#include <BOPAlgo_Splitter.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
//=======================================================================
//function :
@@ -85,24 +86,14 @@ void BOPAlgo_Splitter::SetTools(const BOPCol_ListOfShape& theShapes)
//=======================================================================
void BOPAlgo_Splitter::CheckData()
{
myErrorStatus = 0;
if (myArguments.IsEmpty() ||
(myArguments.Extent() + myTools.Extent()) < 2) {
// too few arguments to process
myErrorStatus = 100;
AddError (new BOPAlgo_AlertTooFewArguments);
return;
}
//
// Check the PaveFiller
if (!myPaveFiller) {
myErrorStatus = 101;
return;
}
//
if (myPaveFiller->ErrorStatus()) {
// PaveFiller has failed
myErrorStatus = 102;
}
CheckFiller();
}
//=======================================================================
@@ -111,7 +102,7 @@ void BOPAlgo_Splitter::CheckData()
//=======================================================================
void BOPAlgo_Splitter::Perform()
{
myErrorStatus = 0;
GetReport()->Clear();
//
if (myEntryPoint == 1) {
if (myPaveFiller) {

View File

@@ -77,6 +77,7 @@ public:
//! Performs the operation
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
protected:
//! Checks the input data

View File

@@ -346,7 +346,7 @@ Standard_Integer BOPAlgo_Tools::EdgesToWires(const TopoDS_Shape& theEdges,
BOPAlgo_Builder aGF;
aGF.SetArguments(aLE);
aGF.Perform();
if (aGF.ErrorStatus()) {
if (aGF.HasErrors()) {
// unable to share the edges
iErr = 2;
return iErr;
@@ -666,7 +666,7 @@ Standard_Boolean BOPAlgo_Tools::WiresToFaces(const TopoDS_Shape& theWires,
aBF.SetShapes(aLE);
aBF.SetFace(aFF);
aBF.Perform();
if (aBF.ErrorStatus()) {
if (aBF.HasErrors()) {
continue;
}
//

View File

@@ -16,6 +16,7 @@
#include <BOPAlgo_WireEdgeSet.hxx>
#include <BOPAlgo_WireSplitter.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
#include <BOPCol_ListOfShape.hxx>
@@ -100,9 +101,8 @@ const Handle(IntTools_Context)& BOPAlgo_WireSplitter::Context()
//=======================================================================
void BOPAlgo_WireSplitter::CheckData()
{
myErrorStatus=0;
if (!myWES) {
myErrorStatus=10;
AddError (new BOPAlgo_AlertNullInputShapes);
return;
}
}
@@ -112,10 +112,10 @@ void BOPAlgo_WireSplitter::CheckData()
//=======================================================================
void BOPAlgo_WireSplitter::Perform()
{
myErrorStatus=0;
GetReport()->Clear();
//
CheckData();
if (myErrorStatus) {
if (HasErrors()) {
return;
}
//

View File

@@ -31,6 +31,11 @@ class TopoDS_Wire;
class TopoDS_Face;
//! The class is to build loops from the given set of edges.
//!
//! It returns the following Error statuses
//! - *BOPAlgo_AlertNullInputShapes* - in case there no input edges to build the loops.
//!
class BOPAlgo_WireSplitter : public BOPAlgo_Algo
{
public:
@@ -73,8 +78,6 @@ protected:
BOPTools_ListOfConnexityBlock myLCB;
Handle(IntTools_Context) myContext;
private:
};
#include <BOPAlgo_WireSplitter.lxx>

View File

@@ -30,6 +30,8 @@ BOPAlgo_MakerVolume.cxx
BOPAlgo_MakerVolume.hxx
BOPAlgo_MakerVolume.lxx
BOPAlgo_Operation.hxx
BOPAlgo_Options.cxx
BOPAlgo_Options.hxx
BOPAlgo_PArgumentAnalyzer.hxx
BOPAlgo_PaveFiller.cxx
BOPAlgo_PaveFiller.hxx
@@ -43,6 +45,7 @@ BOPAlgo_PaveFiller_7.cxx
BOPAlgo_PaveFiller_8.cxx
BOPAlgo_PaveFiller_9.cxx
BOPAlgo_PaveFiller_10.cxx
BOPAlgo_PaveFiller_11.cxx
BOPAlgo_PBOP.hxx
BOPAlgo_PBuilder.hxx
BOPAlgo_PPaveFiller.hxx
@@ -67,4 +70,7 @@ BOPAlgo_CellsBuilder.cxx
BOPAlgo_CellsBuilder.hxx
BOPAlgo_GlueEnum.hxx
BOPAlgo_Splitter.hxx
BOPAlgo_Splitter.cxx
BOPAlgo_Splitter.cxx
BOPAlgo_Alerts.hxx
BOPAlgo.msg
BOPAlgo_BOPAlgo_msg.pxx