1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0025477: Boolean Operations with additional tolerance - Fuzzy Boolean operations

Implementation of Fuzzy Boolean operations. Such operations allow to perform Boolean operations on the shapes
with near-coincidence between the entities of these shapes, i.e. between shapes in which some entities from one shape
are intended to be coincide with some entities from the other, but the coincidence is not precise.

API for Boolean operations has been improved to have a possibility to add new options.

Modified entities:
1. New option of setting additional tolerance have been added to the following classes:
class BOPAlgo_ArgumentAnalyzer
class BOPAlgo_BOP
class BOPAlgo_Builder
class BOPAlgo_MakerVolume
class BOPAlgo_PaveFiller
class BOPDS_DS
class BRepAlgoAPI_BooleanOperation
class BRepAlgoAPI_Check
class BRepAlgoAPI_Common
class BRepAlgoAPI_Cut
class BRepAlgoAPI_Fuse
class BRepAlgoAPI_Section

2. Following draw commands have been modified to support new functionality:
BOP commands:
bop b1 b2 [tol]
bcommon r b1 b2 [tol]
bcut r b1 b2 [tol]
bfuse r b1 b2 [tol]
bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]
mkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]
bfillds [-s -t] [tol]

Check commands:
bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol]
bopargcheck [-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] [-tol tol]

3. Two new classes have been added to API to provide the root interface for algorithms
class BRepAlgoAPI_Algo
class BRepAlgoAPI_BuilderAlgo

Fix to eliminate the warning.

Test-cases for issue #25477
This commit is contained in:
emv
2014-11-28 12:23:58 +03:00
committed by bugmaster
parent 49e1a5c7e9
commit b1d15f53b3
41 changed files with 2273 additions and 1084 deletions

View File

@@ -14,103 +14,33 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- modified by Peter KURNEV Tue Mar 5 14:01:51 2002
package BRepAlgoAPI
---Purpose: The BRepAlgoAPI package provides a full range of
-- services to perform Boolean Operations on arguments (shapes
-- that are defined in the BRep data structures). The
-- implemented new algorithm is intended to replace the Old
-- Boolean Operations algorithm in the BRepAlgoAPI package.
-- The New algorithm is free of a large number of weak spots
-- and limitations characteristics of the Old algorithm.
-- It is more powerful and flexible.
-- It can process arguments the Old algorithm was not adapted for.
-- The new algorithm is based on a new approach to operations
-- with interfered shapes. The advantages of the new algorithm
-- include an ability to treat arguments that have shared
-- entities. It can properly process two solids with shared
-- faces (in terms of TopoDS_Shape::IsSame()), two
-- faces that have shared edges and so on. Now the New Boolean
-- Operation algorithm can treat a wide range of shapes while the
-- Old one fails on them.
-- A generalization of treatment of same-domain faces
-- was included into the New algorithm. Two faces that share
-- the same domain are processed according to the common rule
-- even if the underlying surfaces are of different types. This
-- allows to execute Boolean Operations properly for the same
-- domain faces. It also concerns solids and shells that have the
-- same domain faces. It is quite frequent when two faces share
-- the same domain. And the New algorithm successfully copes
-- with it in contrast to the Old one.
-- Generalization oftreatment of degenerated edges
-- gives a possibility to process them properly. Although there
-- are still some difficulties with processing faces in areas close
-- to degenerated edges.
-- Now the processing of arguments having internal sub-shapes gives
-- a correct result. Internal sub-shape means a sub-shape of a
-- shape with the orientation TopAbs_INTERNAL and is located
-- inside the shape boundaries. The New algorithm processes faces
-- with internal edges properly. The new API of the Boolean
-- Operations (in addition to the old API) allows to reuse the
-- already computed interference between arguments in different
-- types of Boolean Operations. It is possible to use once computed
-- interference in FUSE, CUT and COMMON operations on given
-- arguments. So there is no need to re-compute the interference
-- between the arguments. It allows to reduce time for more than one
-- operation on given arguments.
-- The shape type of a Boolean Operation result and types of the arguments:
-- - For arguments with the same shape type (e.g. SOLID /
-- SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of this type;
-- - For arguments with different shape types (e.g.
-- SHELL / SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of the type that is the same as
-- that of the low type of the argument. Example: For
-- SHELL/SOLID the result is a COMPOUND of SHELLs.
-- - For arguments with different shape types some of
-- Boolean Operations can not be done using the default
-- implementation, because of a non-manifold type of the
-- result. Example: the FUSE operation for SHELL and SOLID
-- can not be done, but the CUT operation can be done, where
-- SHELL is the object and SOLID is the tool.
-- It is possible to perform Boolean Operations on arguments
-- of the COMPOUND shape type. In this case each compound must not
-- be heterogeneous, i.e. it must contain equidimensional shapes
-- (EDGEs or/and WIREs, FACEs or/and SHELLs, SOLIDs). SOLIDs
-- inside the COMPOUND must not contact (intersect or touch)
-- each other. The same condition is true for SHELLs or FACEs,
-- WIREs or EDGEs.
-- It does not support Boolean Operations for COMPSOLID type of shape.
uses
TopTools,
TopoDS,
TopTools,
TopoDS,
gp,
Geom,
Geom2d,
BOPAlgo,
Geom2d,
Message,
BOPCol,
BOPAlgo,
BOPDS,
BRepBuilderAPI
BRepBuilderAPI
is
deferred class BooleanOperation;
class Fuse;
class Common;
class Cut;
class Section;
deferred class BooleanOperation;
class Fuse;
class Common;
class Cut;
class Section;
class Check;
---Purpose: Check shapes on validity for boolean
--- operation.
---Purpose: Check shapes on validity for boolean
--- operation.
deferred class Algo;
deferred class BuilderAlgo;
DumpOper( theFilePath : CString from Standard;
theShape1 : Shape from TopoDS;
theShape2 : Shape from TopoDS;
@@ -122,3 +52,70 @@ is
end BRepAlgoAPI;
---Purpose: The BRepAlgoAPI package provides a full range of
-- services to perform Boolean Operations on arguments (shapes
-- that are defined in the BRep data structures). The
-- implemented new algorithm is intended to replace the Old
-- Boolean Operations algorithm in the BRepAlgoAPI package.
-- The New algorithm is free of a large number of weak spots
-- and limitations characteristics of the Old algorithm.
-- It is more powerful and flexible.
-- It can process arguments the Old algorithm was not adapted for.
-- The new algorithm is based on a new approach to operations
-- with interfered shapes. The advantages of the new algorithm
-- include an ability to treat arguments that have shared
-- entities. It can properly process two solids with shared
-- faces (in terms of TopoDS_Shape::IsSame()), two
-- faces that have shared edges and so on. Now the New Boolean
-- Operation algorithm can treat a wide range of shapes while the
-- Old one fails on them.
-- A generalization of treatment of same-domain faces
-- was included into the New algorithm. Two faces that share
-- the same domain are processed according to the common rule
-- even if the underlying surfaces are of different types. This
-- allows to execute Boolean Operations properly for the same
-- domain faces. It also concerns solids and shells that have the
-- same domain faces. It is quite frequent when two faces share
-- the same domain. And the New algorithm successfully copes
-- with it in contrast to the Old one.
-- Generalization oftreatment of degenerated edges
-- gives a possibility to process them properly. Although there
-- are still some difficulties with processing faces in areas close
-- to degenerated edges.
-- Now the processing of arguments having internal sub-shapes gives
-- a correct result. Internal sub-shape means a sub-shape of a
-- shape with the orientation TopAbs_INTERNAL and is located
-- inside the shape boundaries. The New algorithm processes faces
-- with internal edges properly. The new API of the Boolean
-- Operations (in addition to the old API) allows to reuse the
-- already computed interference between arguments in different
-- types of Boolean Operations. It is possible to use once computed
-- interference in FUSE, CUT and COMMON operations on given
-- arguments. So there is no need to re-compute the interference
-- between the arguments. It allows to reduce time for more than one
-- operation on given arguments.
-- The shape type of a Boolean Operation result and types of the arguments:
-- - For arguments with the same shape type (e.g. SOLID /
-- SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of this type;
-- - For arguments with different shape types (e.g.
-- SHELL / SOLID) the type of the resulting shape will be a
-- COMPOUND, containing shapes of the type that is the same as
-- that of the low type of the argument. Example: For
-- SHELL/SOLID the result is a COMPOUND of SHELLs.
-- - For arguments with different shape types some of
-- Boolean Operations can not be done using the default
-- implementation, because of a non-manifold type of the
-- result. Example: the FUSE operation for SHELL and SOLID
-- can not be done, but the CUT operation can be done, where
-- SHELL is the object and SOLID is the tool.
-- It is possible to perform Boolean Operations on arguments
-- of the COMPOUND shape type. In this case each compound must not
-- be heterogeneous, i.e. it must contain equidimensional shapes
-- (EDGEs or/and WIREs, FACEs or/and SHELLs, SOLIDs). SOLIDs
-- inside the COMPOUND must not contact (intersect or touch)
-- each other. The same condition is true for SHELLs or FACEs,
-- WIREs or EDGEs.
-- It does not support Boolean Operations for COMPSOLID type of shape.

View File

@@ -0,0 +1,75 @@
-- Created by: Peter KURNEV
-- Copyright (c) 2014 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.
deferred class Algo from BRepAlgoAPI
inherits MakeShape from BRepBuilderAPI
---Purpose: provides the root interface for algorithms
uses
BaseAllocator from BOPCol,
ProgressIndicator from Message,
Shape from TopoDS
--raises
is
Initialize
returns Algo from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Algo();"
Initialize (theAllocator: BaseAllocator from BOPCol)
returns Algo from BRepAlgoAPI;
ErrorStatus (me)
returns Integer from Standard;
WarningStatus (me)
returns Integer from Standard;
Allocator(me)
returns BaseAllocator from BOPCol;
---C++: return const &
SetRunParallel(me:out;
theFlag:Boolean from Standard);
---Purpose: 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
--
RunParallel(me)
returns Boolean from Standard;
---Purpose: Returns the flag of parallel processing
SetProgressIndicator(me:out;
theObj: ProgressIndicator from Message);
---Purpose: Set the Progress Indicator object.
UserBreak(me)
is protected;
---Purpose: Breaks the execution if the break signal
-- is indicated by myProgressIndicator.
Shape(me)
returns Shape from TopoDS
is redefined;
---C++: return const &
fields
myAllocator : BaseAllocator from BOPCol is protected;
myErrorStatus : Integer from Standard is protected;
myWarningStatus : Integer from Standard is protected;
myRunParallel : Boolean from Standard is protected;
myProgressIndicator : ProgressIndicator from Message is protected;
end Algo;

View File

@@ -0,0 +1,126 @@
// Created by: Peter KURNEV
// Copyright (c) 2014 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 <BRepAlgoAPI_Algo.ixx>
#include <Standard_NotImplemented.hxx>
#include <NCollection_BaseAllocator.hxx>
//=======================================================================
// function:
// purpose:
//=======================================================================
BRepAlgoAPI_Algo::BRepAlgoAPI_Algo()
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myErrorStatus(1),
myWarningStatus(0),
myRunParallel(Standard_False)
{}
//=======================================================================
// function:
// purpose:
//=======================================================================
BRepAlgoAPI_Algo::BRepAlgoAPI_Algo
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myErrorStatus(1),
myWarningStatus(0),
myRunParallel(Standard_False)
{}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
BRepAlgoAPI_Algo::~BRepAlgoAPI_Algo()
{
}
//=======================================================================
//function : Allocator
//purpose :
//=======================================================================
const Handle(NCollection_BaseAllocator)& BRepAlgoAPI_Algo::Allocator()const
{
return myAllocator;
}
//=======================================================================
// function: ErrorStatus
// purpose:
//=======================================================================
Standard_Integer BRepAlgoAPI_Algo::ErrorStatus()const
{
return myErrorStatus;
}
//=======================================================================
// function: WarningStatus
// purpose:
//=======================================================================
Standard_Integer BRepAlgoAPI_Algo::WarningStatus()const
{
return myWarningStatus;
}
//=======================================================================
//function : SetRunParallel
//purpose :
//=======================================================================
void BRepAlgoAPI_Algo::SetRunParallel(const Standard_Boolean theFlag)
{
myRunParallel=theFlag;
}
//=======================================================================
//function : RunParallel
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Algo::RunParallel()const
{
return myRunParallel;
}
//=======================================================================
//function : SetProgressIndicator
//purpose :
//=======================================================================
void BRepAlgoAPI_Algo::SetProgressIndicator
(const Handle(Message_ProgressIndicator)& theObj)
{
if (!theObj.IsNull()) {
myProgressIndicator=theObj;
}
}
//=======================================================================
//function : UserBreak
//purpose :
//=======================================================================
void BRepAlgoAPI_Algo::UserBreak() const
{
if (myProgressIndicator.IsNull()) {
return;
}
if (myProgressIndicator->UserBreak()) {
Standard_NotImplemented::Raise("");
}
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_Algo::Shape() const
{
return myShape;
}
// myErrorStatus
//
// 1 - object is just initialized

View File

@@ -14,12 +14,8 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- modified by Peter KURNEV Tue Mar 5 14:01:51 2002
-- modified by Eugeny MALTCHIKOV Wed Jul 04 11:13:01 2012
deferred class BooleanOperation from BRepAlgoAPI
inherits MakeShape from BRepBuilderAPI
inherits BuilderAlgo from BRepAlgoAPI
---Purpose: The abstract class BooleanOperation is the root
-- class of Boolean Operations (see Overview).
@@ -33,30 +29,49 @@ deferred class BooleanOperation from BRepAlgoAPI
uses
Shape from TopoDS,
Shape from TopoDS,
DataMapOfShapeShape from TopTools,
ListOfShape from TopTools,
Operation from BOPAlgo,
Builder from BOPAlgo,
PBuilder from BOPAlgo,
PaveFiller from BOPAlgo,
PPaveFiller from BOPAlgo,
DataMapOfIntegerListOfShape from TopTools,
DataMapOfIntegerShape from TopTools,
DataMapOfShapeShape from TopTools
Operation from BOPAlgo,
PaveFiller from BOPAlgo
is
is
Initialize
returns BooleanOperation from BRepAlgoAPI;
Initialize (S1 :Shape from TopoDS;
S2 :Shape from TopoDS;
anOperation:Operation from BOPAlgo);
S2 :Shape from TopoDS;
anOperation:Operation from BOPAlgo);
---Purpose: Prepares the operations for S1 and S2.
Initialize (S1 :Shape from TopoDS;
S2 :Shape from TopoDS;
aDSF :PaveFiller from BOPAlgo;
anOperation:Operation from BOPAlgo);
S2 :Shape from TopoDS;
aPF :PaveFiller from BOPAlgo;
anOperation:Operation from BOPAlgo);
---Purpose: Prepares the operations for S1 and S2.
SetShape1(me:out;
S:Shape from TopoDS);
SetShape2(me:out;
S:Shape from TopoDS);
Shape1(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the first shape involved in this Boolean operation.
---C++: return const &
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation();"
Shape2(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the second shape involved in this Boolean operation.
---C++: return const &
SetOperation (me:out;
anOp: Operation from BOPAlgo);
---Purpose: Sets the type of Boolean operation to perform
@@ -65,59 +80,35 @@ is
--- BOPAlgo_FUSE
--- BOPAlgo_CUT
--- BOPAlgo_CUT21
---
Build (me:out)
is redefined virtual;
---Purpose: Provides the algorithm of Boolean Operations
-- - Filling interference Data Structure (if it is necessary)
-- - Building the result of the operation.
Shape1(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the first shape involved in this Boolean operation.
---C++: return const &
Shape2(me)
returns Shape from TopoDS
is static;
---Purpose: Returns the second shape involved in this Boolean operation.
---C++: return const &
---
Operation (me)
returns Operation from BOPAlgo;
---Purpose: Returns the type of Boolean Operation that has been performed.
Build (me:out)
is redefined virtual;
---Purpose: Provides the algorithm of Boolean Operations
-- - Filling interference Data Structure (if it is necessary)
-- - Building the result of the operation.
BuilderCanWork(me)
returns Boolean from Standard;
FuseEdges(me)
returns Boolean from Standard;
---Purpose: Returns the flag of edge refining
returns Boolean from Standard;
---Purpose: Returns the flag of edge refining
RefineEdges(me:out);
---Purpose: Fuse C1 edges
PrepareFiller(me:out)
returns Boolean from Standard
is protected;
---Category: Querying
BuilderCanWork(me)
returns Boolean from Standard;
ErrorStatus(me)
returns Integer from Standard;
---Purpose: Returns the error status of operation.
--- 0 - Ok
--- 1 - The Object is created but Nothing is Done
--- 2 - Null source shapes is not allowed
--- 3 - Check types of the arguments
--- 4 - Can not allocate memory for the DSFiller
--- 5 - The Builder can not work with such types of arguments
--- 6 - Unknown operation is not allowed
--- 7 - Can not allocate memory for the Builder
-- > 100 - See the Builder's ErrorStatus
SectionEdges (me: in out)
returns ListOfShape from TopTools;
--- Purpose: Returns a list of section edges.
-- The edges represent the result of intersection between arguments of
-- Boolean Operation. They are computed during operation execution.
---C++: return const &
Modified (me: in out;
aS : Shape from TopoDS)
returns ListOfShape from TopTools
@@ -157,39 +148,34 @@ is
is virtual;
---Purpose: Returns true if there is at least one deleted shape.
--- For use in BRepNaming.
Destroy (me: in out);
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation(){Destroy();}"
SectionEdges (me: in out)
returns ListOfShape from TopTools;
--- Purpose: Returns a list of section edges.
-- The edges represent the result of intersection between arguments of
-- Boolean Operation. They are computed during operation execution.
---C++: return const &
--
-- protected
--
PrepareFiller(me:out)
returns Boolean from Standard
is protected;
RefinedList (me: in out;
theL : ListOfShape from TopTools)
returns ListOfShape from TopTools
is private;
is protected;
---Purpose: Returns the list of shapes generated from the shape <S>.
--- For use in BRepNaming.
---C++: return const &
fields
myS1 : Shape from TopoDS is protected;
myS2 : Shape from TopoDS is protected;
myBuilderCanWork : Boolean from Standard is protected;
myOperation : Operation from BOPAlgo is protected;
myErrorStatus : Integer from Standard is protected;
myDSFiller : PPaveFiller from BOPAlgo is protected;
myBuilder : PBuilder from BOPAlgo is protected;
myEntryType : Integer from Standard;
myS1 : Shape from TopoDS is protected;
myS2 : Shape from TopoDS is protected;
myOperation: Operation from BOPAlgo is protected;
--
myEntryType: Integer from Standard is protected;
myBuilderCanWork : Boolean from Standard is protected;
-- for edge refiner
myFuseEdges : Boolean from Standard ;
myModifFaces : DataMapOfShapeShape from TopTools;
myEdgeMap : DataMapOfShapeShape from TopTools;
myFuseEdges : Boolean from Standard ;
myModifFaces : DataMapOfShapeShape from TopTools;
myEdgeMap : DataMapOfShapeShape from TopTools;
end BooleanOperation;

View File

@@ -16,21 +16,42 @@
#include <BRepAlgoAPI_BooleanOperation.ixx>
#include <BRepAlgoAPI.hxx>
#include <BRepAlgoAPI_Check.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <TopExp.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
#include <TopTools_DataMapOfIntegerShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <BRepAlgoAPI_Check.hxx>
#include <BRepAlgoAPI.hxx>
#include <BRepLib_FuseEdges.hxx>
#include <BOPDS_PDS.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPDS_Interf.hxx>
#include <BOPDS_Curve.hxx>
#include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_BOP.hxx>
#include <BOPAlgo_Section.hxx>
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation()
:
BRepAlgoAPI_BuilderAlgo(),
myOperation(BOPAlgo_UNKNOWN),
myEntryType(1),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
}
//=======================================================================
//function : BRepAlgoAPI_BooleanOperation
//purpose :
@@ -40,14 +61,12 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
const TopoDS_Shape& aS2,
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(),
myS1(aS1),
myS2(aS2),
myBuilderCanWork(Standard_False),
myOperation(anOp),
myErrorStatus(1),
myDSFiller(NULL),
myBuilder(NULL),
myEntryType(1),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
}
@@ -55,40 +74,36 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
//function : BRepAlgoAPI_BooleanOperation
//purpose :
//=======================================================================
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aDSFiller,
const BOPAlgo_Operation anOp)
BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aPF,
const BOPAlgo_Operation anOp)
:
BRepAlgoAPI_BuilderAlgo(),
myS1(aS1),
myS2(aS2),
myBuilderCanWork(Standard_False),
myOperation(anOp),
myErrorStatus(1),
myDSFiller(NULL),
myBuilder(NULL),
myEntryType(0),
myBuilderCanWork(Standard_False),
myFuseEdges(Standard_False)
{
if ((Standard_Address) &aDSFiller!=NULL) {
myDSFiller=(BOPAlgo_PaveFiller*)&aDSFiller;
}
myDSFiller=(BOPAlgo_PaveFiller*)&aPF;
}
//=======================================================================
//function : Destroy
//function : ~
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::Destroy()
BRepAlgoAPI_BooleanOperation::~BRepAlgoAPI_BooleanOperation()
{
if (myBuilder!=NULL) {
if (myBuilder) {
delete myBuilder;
myBuilder=NULL;
}
if (myDSFiller!=NULL && myEntryType) {
if (myDSFiller && myEntryType) {
delete myDSFiller;
myDSFiller=NULL;
}
//
myModifFaces.Clear();
myEdgeMap.Clear();
@@ -97,7 +112,8 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
//function : SetOperation
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetOperation (const BOPAlgo_Operation anOp)
void BRepAlgoAPI_BooleanOperation::SetOperation
(const BOPAlgo_Operation anOp)
{
myOperation=anOp;
}
@@ -105,38 +121,42 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
//function : Operation
//purpose :
//=======================================================================
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
BOPAlgo_Operation BRepAlgoAPI_BooleanOperation::Operation ()const
{
return myOperation;
}
//=======================================================================
//function : FuseEdges
//function : SetShape1
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
void BRepAlgoAPI_BooleanOperation::SetShape1(const TopoDS_Shape& aS)
{
return myFuseEdges;
}
myS1=aS;
}
//=======================================================================
//function : SetShape2
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::SetShape2(const TopoDS_Shape& aS)
{
myS2=aS;
}
//=======================================================================
//function : Shape1
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape1() const
{
return myS1;
}
//=======================================================================
//function : Shape2
//purpose :
//=======================================================================
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
const TopoDS_Shape& BRepAlgoAPI_BooleanOperation::Shape2() const
{
return myS2;
}
//=======================================================================
//function : BuilderCanWork
//purpose :
@@ -146,54 +166,18 @@ BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
return myBuilderCanWork;
}
//=======================================================================
//function : ErrorStatus
//function : FuseEdges
//purpose :
//=======================================================================
Standard_Integer BRepAlgoAPI_BooleanOperation::ErrorStatus()const
Standard_Boolean BRepAlgoAPI_BooleanOperation::FuseEdges ()const
{
return myErrorStatus;
return myFuseEdges;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_Shape& aS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
else {
myGenerated = myBuilder->Modified(aS);
if(myFuseEdges) {
TopTools_ListOfShape theLS;
theLS.Assign(myGenerated);
//
RefinedList(theLS);
}
return myGenerated;
}
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::IsDeleted(const TopoDS_Shape& aS)
{
Standard_Boolean bDeleted = Standard_True;
if (myBuilder != NULL) {
bDeleted=myBuilder->IsDeleted(aS);
}
return bDeleted;
}
//=======================================================================
//function : PrepareFiller
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
Standard_Boolean BRepAlgoAPI_BooleanOperation::PrepareFiller()
{
Standard_Boolean bIsNewFiller=Standard_False;
myErrorStatus=1;
@@ -223,6 +207,9 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
aLS.Append(myS2);
//
myDSFiller->SetArguments(aLS);
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetFuzzyValue(myFuzzyValue);
}
return bIsNewFiller;
@@ -231,7 +218,7 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
//function : Build
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::Build()
void BRepAlgoAPI_BooleanOperation::Build()
{
Standard_Boolean bIsNewFiller;
Standard_Integer iErr;
@@ -288,6 +275,8 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
pBOP->SetOperation(myOperation);
}
//
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->PerformWithFiller(*myDSFiller);
iErr = myBuilder->ErrorStatus();
if (!iErr) {
@@ -316,12 +305,99 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
}
}
//
//=======================================================================
//function : RefineEdges
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
{
if(myFuseEdges) return; //Edges have been refined yet
BRepLib_FuseEdges FE(myShape);
FE.SetConcatBSpl(Standard_True);
// avoid fusing old edges
TopTools_IndexedMapOfShape mapOldEdges;
TopExp::MapShapes (myS1, TopAbs_EDGE, mapOldEdges);
TopExp::MapShapes (myS2, TopAbs_EDGE, mapOldEdges);
FE.AvoidEdges (mapOldEdges);
// Get List of edges that have been fused
myFuseEdges = Standard_False;
myModifFaces.Clear();
myEdgeMap.Clear();
TopTools_DataMapOfIntegerListOfShape aFusedEdges;
FE.Edges(aFusedEdges);
Standard_Integer nle = aFusedEdges.Extent();
if (nle != 0) {
FE.Perform();
myShape = FE.Shape();
TopTools_DataMapOfIntegerShape aResultEdges;
FE.ResultEdges(aResultEdges);
FE.Faces(myModifFaces);
myFuseEdges = Standard_True;
Standard_Integer i;
for(i = 1; i <= nle; ++i) {
const TopoDS_Shape& aNewE = aResultEdges(i);
const TopTools_ListOfShape& aListOfOldEdges = aFusedEdges(i);
TopTools_ListIteratorOfListOfShape anIter(aListOfOldEdges);
for(; anIter.More(); anIter.Next()) {
myEdgeMap.Bind(anIter.Value(), aNewE);
}
}
}
}
//=======================================================================
//function : RefinedList
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::RefinedList
(const TopTools_ListOfShape& theL)
{
myGenerated.Clear();
TopTools_MapOfShape aMap;
TopTools_ListIteratorOfListOfShape anIter(theL);
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& anS = anIter.Value();
if(anS.ShapeType() == TopAbs_EDGE) {
if(myEdgeMap.IsBound(anS)) {
const TopoDS_Shape& aNewEdge = myEdgeMap.Find(anS);
if(aMap.Add(aNewEdge)) {
myGenerated.Append(aNewEdge);
}
}
else {
myGenerated.Append(anS);
}
}
else if (anS.ShapeType() == TopAbs_FACE) {
if(myModifFaces.IsBound(anS)) {
myGenerated.Append(myModifFaces.Find(anS));
}
else {
myGenerated.Append(anS);
}
}
else {
myGenerated.Append(anS);
}
}
return myGenerated;
}
//=======================================================================
//function : SectionEdges
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
{
if (myBuilder==NULL) {
myGenerated.Clear();
@@ -364,12 +440,12 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::SectionEdges()
//
return myGenerated;
}
// ================================================================================================
// function: Generated
// purpose:
// ================================================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated(const TopoDS_Shape& S)
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated
(const TopoDS_Shape& S)
{
if (myBuilder==NULL) {
myGenerated.Clear();
@@ -384,10 +460,46 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Generated(const TopoDS
return myBuilder->Generated(S);
}
// ================================================================================================
// function: HasModified
// purpose:
// ================================================================================================
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified
(const TopoDS_Shape& aS)
{
if (myBuilder==NULL) {
myGenerated.Clear();
return myGenerated;
}
else {
myGenerated = myBuilder->Modified(aS);
if(myFuseEdges) {
TopTools_ListOfShape theLS;
theLS.Assign(myGenerated);
//
RefinedList(theLS);
}
return myGenerated;
}
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::IsDeleted
(const TopoDS_Shape& aS)
{
Standard_Boolean bDeleted = Standard_True;
if (myBuilder != NULL) {
bDeleted=myBuilder->IsDeleted(aS);
}
return bDeleted;
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasModified() const
{
if (myBuilder==NULL) {
@@ -395,11 +507,10 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasModified() const
}
return myBuilder->HasModified();
}
// ================================================================================================
// function: HasGenerated
// purpose:
// ================================================================================================
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasGenerated() const
{
if (myBuilder==NULL) {
@@ -407,11 +518,10 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasGenerated() const
}
return myBuilder->HasGenerated();
}
// ================================================================================================
// function: HasDeleted
// purpose:
// ================================================================================================
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
{
if (myBuilder==NULL) {
@@ -419,93 +529,3 @@ Standard_Boolean BRepAlgoAPI_BooleanOperation::HasDeleted() const
}
return myBuilder->HasDeleted();
}
//=======================================================================
//function : RefineEdges
//purpose :
//=======================================================================
void BRepAlgoAPI_BooleanOperation::RefineEdges ()
{
if(myFuseEdges) return; //Edges have been refined yet
BRepLib_FuseEdges FE(myShape);
FE.SetConcatBSpl(Standard_True);
// avoid fusing old edges
TopTools_IndexedMapOfShape mapOldEdges;
TopExp::MapShapes (myS1, TopAbs_EDGE, mapOldEdges);
TopExp::MapShapes (myS2, TopAbs_EDGE, mapOldEdges);
FE.AvoidEdges (mapOldEdges);
// Get List of edges that have been fused
myFuseEdges = Standard_False;
myModifFaces.Clear();
myEdgeMap.Clear();
TopTools_DataMapOfIntegerListOfShape aFusedEdges;
FE.Edges(aFusedEdges);
Standard_Integer nle = aFusedEdges.Extent();
if (nle != 0) {
FE.Perform();
myShape = FE.Shape();
TopTools_DataMapOfIntegerShape aResultEdges;
FE.ResultEdges(aResultEdges);
FE.Faces(myModifFaces);
myFuseEdges = Standard_True;
Standard_Integer i;
for(i = 1; i <= nle; ++i) {
const TopoDS_Shape& aNewE = aResultEdges(i);
const TopTools_ListOfShape& aListOfOldEdges = aFusedEdges(i);
TopTools_ListIteratorOfListOfShape anIter(aListOfOldEdges);
for(; anIter.More(); anIter.Next()) {
myEdgeMap.Bind(anIter.Value(), aNewE);
}
}
}
}
//=======================================================================
//function : RefinedList
//purpose :
//=======================================================================
const TopTools_ListOfShape&
BRepAlgoAPI_BooleanOperation::RefinedList(const TopTools_ListOfShape& theL)
{
myGenerated.Clear();
TopTools_MapOfShape aMap;
TopTools_ListIteratorOfListOfShape anIter(theL);
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& anS = anIter.Value();
if(anS.ShapeType() == TopAbs_EDGE) {
if(myEdgeMap.IsBound(anS)) {
const TopoDS_Shape& aNewEdge = myEdgeMap.Find(anS);
if(aMap.Add(aNewEdge)) {
myGenerated.Append(aNewEdge);
}
}
else {
myGenerated.Append(anS);
}
}
else if (anS.ShapeType() == TopAbs_FACE) {
if(myModifFaces.IsBound(anS)) {
myGenerated.Append(myModifFaces.Find(anS));
}
else {
myGenerated.Append(anS);
}
}
else {
myGenerated.Append(anS);
}
}
return myGenerated;
}

View File

@@ -0,0 +1,47 @@
-- Created by: Peter KURNEV
-- Copyright (c) 2014 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.
deferred class BuilderAlgo from BRepAlgoAPI
inherits Algo from BRepAlgoAPI
---Purpose: provides the root interface for algorithms
uses
BaseAllocator from BOPCol,
PPaveFiller from BOPAlgo,
PBuilder from BOPAlgo
--raises
is
Initialize
returns BuilderAlgo from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BuilderAlgo();"
Initialize (theAllocator: BaseAllocator from BOPCol)
returns BuilderAlgo from BRepAlgoAPI;
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---Purpose: Returns the additional tolerance
fields
myDSFiller : PPaveFiller from BOPAlgo is protected;
myBuilder : PBuilder from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
end BuilderAlgo;

View File

@@ -0,0 +1,67 @@
// Created by: Peter KURNEV
// Copyright (c) 2014 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 <BRepAlgoAPI_BuilderAlgo.ixx>
#include <NCollection_BaseAllocator.hxx>
//=======================================================================
// function:
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo()
:
BRepAlgoAPI_Algo(),
myDSFiller(NULL),
myBuilder(NULL),
myFuzzyValue(0.)
{}
//=======================================================================
// function:
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::BRepAlgoAPI_BuilderAlgo
(const Handle(NCollection_BaseAllocator)& theAllocator)
:
BRepAlgoAPI_Algo(theAllocator),
myDSFiller(NULL),
myBuilder(NULL),
myFuzzyValue(0.)
{}
//=======================================================================
// function: ~
// purpose:
//=======================================================================
BRepAlgoAPI_BuilderAlgo::~BRepAlgoAPI_BuilderAlgo()
{
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BRepAlgoAPI_BuilderAlgo::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BRepAlgoAPI_BuilderAlgo::FuzzyValue() const
{
return myFuzzyValue;
}

View File

@@ -13,7 +13,8 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Check from BRepAlgoAPI
class Check from BRepAlgoAPI
inherits Algo from BRepAlgoAPI
---Purpose:
-- The class Check provides a diagnostic tool for checking
-- single shape or couple of shapes.
@@ -115,11 +116,20 @@ is
returns ListOfCheckResult from BOPAlgo;
---C++: return const&
---Purpose: Returns faulty shapes.
SetFuzzyValue(me:out;
theFuzz : Real from Standard);
---Purpose: Sets the additional tolerance
FuzzyValue(me)
returns Real from Standard;
---Purpose: Returns the additional tolerance
fields
myS1, myS2 : Shape from TopoDS is protected;
myAnalyzer : PArgumentAnalyzer from BOPAlgo is protected;
myResult : ListOfCheckResult from BOPAlgo is protected;
myS1, myS2 : Shape from TopoDS is protected;
myAnalyzer : PArgumentAnalyzer from BOPAlgo is protected;
myResult : ListOfCheckResult from BOPAlgo is protected;
myFuzzyValue : Real from Standard is protected;
end BooleanOperation;

View File

@@ -21,8 +21,11 @@
//function : BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::BRepAlgoAPI_Check()
: myAnalyzer(NULL)
BRepAlgoAPI_Check::BRepAlgoAPI_Check()
:
BRepAlgoAPI_Algo(),
myAnalyzer(NULL),
myFuzzyValue(0.)
{
}
@@ -30,9 +33,11 @@
//function : BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
: BRepAlgoAPI_Algo(),
myFuzzyValue(0.)
{
Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI);
//
@@ -43,11 +48,13 @@
//function : BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
BRepAlgoAPI_Check::BRepAlgoAPI_Check(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
: BRepAlgoAPI_Algo(),
myFuzzyValue(0.)
{
Init(theS1, theS2, theOp, bTestSE, bTestSI);
//
@@ -58,7 +65,7 @@
//function : ~BRepAlgoAPI_Check
//purpose :
//=======================================================================
BRepAlgoAPI_Check::~BRepAlgoAPI_Check()
BRepAlgoAPI_Check::~BRepAlgoAPI_Check()
{
if(myAnalyzer){
delete myAnalyzer;
@@ -67,13 +74,32 @@
myResult.Clear();
}
//=======================================================================
//function : SetFuzzyValue
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::SetFuzzyValue(const Standard_Real theFuzz)
{
if (theFuzz > 0.) {
myFuzzyValue = theFuzz;
}
}
//=======================================================================
//function : FuzzyValue
//purpose :
//=======================================================================
Standard_Real BRepAlgoAPI_Check::FuzzyValue() const
{
return myFuzzyValue;
}
//=======================================================================
//function : SetData
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI);
}
@@ -82,25 +108,23 @@
//function : SetData
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
void BRepAlgoAPI_Check::SetData(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
Init(theS1, theS2, theOp, bTestSE, bTestSI);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::Init(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
void BRepAlgoAPI_Check::Init(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const BOPAlgo_Operation theOp,
const Standard_Boolean bTestSE,
const Standard_Boolean bTestSI)
{
myResult.Clear();
myS1 = theS1;
@@ -114,13 +138,17 @@
myAnalyzer->ArgumentTypeMode() = Standard_True;
myAnalyzer->SmallEdgeMode() = bTestSE;
myAnalyzer->SelfInterMode() = bTestSI;
//
myAnalyzer->SetRunParallel(myRunParallel);
myAnalyzer->SetProgressIndicator(myProgressIndicator);
myAnalyzer->SetFuzzyValue(myFuzzyValue);
}
//=======================================================================
//function : Result
//purpose :
//=======================================================================
const BOPAlgo_ListOfCheckResult& BRepAlgoAPI_Check::Result()
const BOPAlgo_ListOfCheckResult& BRepAlgoAPI_Check::Result()
{
return myResult;
}
@@ -129,7 +157,7 @@
//function : IsValid
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Check::IsValid()
Standard_Boolean BRepAlgoAPI_Check::IsValid()
{
return myResult.IsEmpty();
}
@@ -138,7 +166,7 @@
//function : Perform
//purpose :
//=======================================================================
void BRepAlgoAPI_Check::Perform()
void BRepAlgoAPI_Check::Perform()
{
Standard_Boolean isS1, isS2;
//incompatibility of shape types, small edges and self-interference
@@ -175,5 +203,3 @@
myResult.Append(aRes);
}
}

View File

@@ -14,26 +14,34 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Common from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
class Common from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Common provides a
-- Boolean common operation on a pair of arguments (Boolean Intersection).
-- The class Common provides a framework for:
-- - Defining the construction of a common shape;
-- - Implementing the building algorithm
-- - Consulting the result.
---Purpose: The class Common provides a
-- Boolean common operation on a pair of arguments (Boolean Intersection).
-- The class Common provides a framework for:
-- - Defining the construction of a common shape;
-- - Implementing the building algorithm
-- - Consulting the result.
uses
Shape from TopoDS,
PaveFiller from BOPAlgo
is
is
Create
returns Common from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Common();"
--- Purpose: Empty constructor
Create (S1,S2 : Shape from TopoDS)
returns Common from BRepAlgoAPI;
---Purpose: Constructs a common part for shapes aS1 and aS2 .
returns Common from BRepAlgoAPI;
---Purpose: Constructs a common part for shapes aS1 and aS2 .
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo)
returns Common from BRepAlgoAPI;
aDSF:PaveFiller from BOPAlgo)
returns Common from BRepAlgoAPI;
--- Purpose: Constructs a common part for shapes aS1 and aS2 using aDSFiller
end Common;
--- Purpose: Constructs a common part for shapes aS1 and aS2 using aDSFiller

View File

@@ -18,6 +18,23 @@
#include <BRepAlgoAPI_BooleanOperation.hxx>
//=======================================================================
//function : BRepAlgoAPI_Common
//purpose :
//=======================================================================
BRepAlgoAPI_Common::BRepAlgoAPI_Common()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_COMMON;
}
//=======================================================================
//function : ~BRepAlgoAPI_Common
//purpose :
//=======================================================================
BRepAlgoAPI_Common::~BRepAlgoAPI_Common()
{
}
//=======================================================================
//function : BRepAlgoAPI_Common
//purpose :

View File

@@ -14,31 +14,39 @@
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Cut from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Cut provides a Boolean
-- cut operation on a pair of arguments (Boolean Subtraction).
-- The class Cut provides a framework for:
-- - Defining the construction of a cut shape
-- - Implementing the building algorithm
-- - Consulting the result
class Cut from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Cut provides a Boolean
-- cut operation on a pair of arguments (Boolean Subtraction).
-- The class Cut provides a framework for:
-- - Defining the construction of a cut shape
-- - Implementing the building algorithm
-- - Consulting the result
uses
Shape from TopoDS,
PaveFiller from BOPAlgo
is
is
Create
returns Cut from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Cut();"
--- Purpose: Empty constructor
Create (S1,S2 : Shape from TopoDS)
returns Cut from BRepAlgoAPI;
---Purpose: Shape aS2 cuts shape aS1. The
-- resulting shape is a new shape produced by the cut operation.
returns Cut from BRepAlgoAPI;
---Purpose: Shape aS2 cuts shape aS1. The
-- resulting shape is a new shape produced by the cut operation.
Create (S1,S2 : Shape from TopoDS;
aDSF : PaveFiller from BOPAlgo;
bFWD : Boolean from Standard=Standard_True)
returns Cut from BRepAlgoAPI;
--- Purpose: Constructs a new shape cut from
-- shape aS1 by shape aS2 using aDSFiller (see
-- BRepAlgoAPI_BooleanOperation Constructor).
aDSF : PaveFiller from BOPAlgo;
bFWD : Boolean from Standard=Standard_True)
returns Cut from BRepAlgoAPI;
--- Purpose: Constructs a new shape cut from
-- shape aS1 by shape aS2 using aDSFiller (see
-- BRepAlgoAPI_BooleanOperation Constructor).
end Cut;

View File

@@ -22,9 +22,28 @@
//function : BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_CUT)
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_CUT;
}
//=======================================================================
//function : ~BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::~BRepAlgoAPI_Cut()
{
}
//=======================================================================
//function : BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
:
BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_CUT)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;
@@ -34,11 +53,12 @@
//function : BRepAlgoAPI_Cut
//purpose :
//=======================================================================
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean bFWD)
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean bFWD)
:
BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, (bFWD) ? BOPAlgo_CUT : BOPAlgo_CUT21)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;

View File

@@ -16,26 +16,31 @@
class Fuse from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
---Purpose: The class Fuse provides a
-- Boolean fusion operation on a pair of arguments (Boolean Union).
-- The class Fuse provides a framework for:
-- - Defining the construction of a fused shape;
-- - Implementing the building algorithm
-- - Consulting the result.
---Purpose: The class Fuse provides a
-- Boolean fusion operation on a pair of arguments (Boolean Union).
-- The class Fuse provides a framework for:
-- - Defining the construction of a fused shape;
-- - Implementing the building algorithm
-- - Consulting the result.
uses
Shape from TopoDS,
PaveFiller from BOPAlgo
is
is
Create
returns Fuse from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Fuse();"
--- Purpose: Empty constructor
Create (S1,S2 : Shape from TopoDS)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a fuse of shapes aS1 and aS2.
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a fuse of shapes aS1 and aS2.
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller.
aDSF:PaveFiller from BOPAlgo)
returns Fuse from BRepAlgoAPI;
---Purpose: Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller.
end Fuse;

View File

@@ -22,9 +22,28 @@
//function : BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
: BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_FUSE)
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse()
:
BRepAlgoAPI_BooleanOperation()
{
myOperation=BOPAlgo_FUSE;
}
//=======================================================================
//function : ~BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::~BRepAlgoAPI_Fuse()
{
}
//=======================================================================
//function : BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2)
:
BRepAlgoAPI_BooleanOperation(S1, S2, BOPAlgo_FUSE)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;
@@ -35,10 +54,11 @@
//function : BRepAlgoAPI_Fuse
//purpose :
//=======================================================================
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF)
: BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_FUSE)
BRepAlgoAPI_Fuse::BRepAlgoAPI_Fuse(const TopoDS_Shape& S1,
const TopoDS_Shape& S2,
const BOPAlgo_PaveFiller& aDSF)
:
BRepAlgoAPI_BooleanOperation(S1, S2, aDSF, BOPAlgo_FUSE)
{
BRepAlgoAPI_BooleanOperation* pBO=
(BRepAlgoAPI_BooleanOperation*) (void*) this;

View File

@@ -16,31 +16,32 @@
-- modified by Michael KLOKOV Wed Mar 6 15:01:25 2002
class Section from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
class Section from BRepAlgoAPI
inherits BooleanOperation from BRepAlgoAPI
---Purpose: Computes the intersection of two shapes or geometries.
-- Geometries can be surfaces of planes.
-- Geometries are converted to faces
-- When a geometry has been converted to
-- topology the created shape can be found using
-- the methods Shape1 and Shape2 inherited from the class BooleanOperation.
-- The result (Shape() method) is a compound containing
-- edges built on intersection curves.
-- By default, the section is performed immediatly in
-- class constructors, with default values :
-- - geometries built are NOT approximated.
-- - PCurves are NOT computed on both parts.
-- Example : giving two shapes S1,S2 accessing faces,
-- let compute the section edges R on S1,S2,
-- performing approximation on new curves,
-- performing PCurve on part 1 but not on part 2 :
-- Standard_Boolean PerformNow = Standard_False;
-- BRepBoolAPI_Section S(S1,S2,PerformNow);
-- S.ComputePCurveOn1(Standard_True);
-- S.Approximation(Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
-- On Null Shapes of geometries, NotDone() is called.
---Purpose: Computes the intersection of two shapes or geometries.
-- Geometries can be surfaces of planes.
-- Geometries are converted to faces
-- When a geometry has been converted to
-- topology the created shape can be found using
-- the methods Shape1 and Shape2 inherited from the class BooleanOperation.
-- The result (Shape() method) is a compound containing
-- edges built on intersection curves.
-- By default, the section is performed immediatly in
-- class constructors, with default values :
-- - geometries built are NOT approximated.
-- - PCurves are NOT computed on both parts.
-- Example : giving two shapes S1,S2 accessing faces,
-- let compute the section edges R on S1,S2,
-- performing approximation on new curves,
-- performing PCurve on part 1 but not on part 2 :
-- Standard_Boolean PerformNow = Standard_False;
-- BRepBoolAPI_Section S(S1,S2,PerformNow);
-- S.ComputePCurveOn1(Standard_True);
-- S.Approximation(Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
-- On Null Shapes of geometries, NotDone() is called.
uses
Pln from gp,
@@ -51,262 +52,289 @@ uses
ListOfShape from TopTools
is
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Section(){}"
Create
returns Section from BRepAlgoAPI;
---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_Section();"
--- Purpose: Empty constructor
Create (S1,S2 : Shape from TopoDS;
aDSF:PaveFiller from BOPAlgo;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
Create(Sh1,Sh2 : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Create(Sh : Shape from TopoDS; Pl : Pln from gp;
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
Create(Sh : Shape from TopoDS;
Pl : Pln from gp;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Create(Sh : Shape from TopoDS; Sf : Surface from Geom;
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
Create(Sh : Shape from TopoDS;
Sf : Surface from Geom;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Create(Sf : Surface from Geom; Sh : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
---Purpose: see upper
---Level: Public
returns Section from BRepAlgoAPI;
Create(Sf1 : Surface from Geom; Sf2 : Surface from Geom;
PerformNow : Boolean = Standard_True)
---Purpose: This and the above classes construct a framework for
-- computing the section lines of:
-- - two shapes Sh1 and Sh2, or
-- - shape Sh and plane Pl, or
-- - shape Sh and surface Sf, or
-- - surface Sf and shape Sh, or
-- - two surfaces Sf1 and Sf2,
-- and builds a result if PerformNow equals true, its
-- default value. If PerformNow equals false, the intersection
-- will be computed later by the function Build.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not
-- chained or grouped in wires. If no intersection edge exists, the
-- result is an empty compound object.
-- Note that other objects than TopoDS_Shape shapes involved in
-- these syntaxes are converted into faces or shells before
-- performing the computation of the intersection. A shape
-- resulting from this conversion can be retrieved with the
-- function Shape1 or Shape2.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for each elementary
-- edge of the result. To attach such parametric curves to the
-- constructed edges you may use a constructor with the PerformNow
-- flag equal to false; then you use:
-- - the function ComputePCurveOn1 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the first shape,
-- - the function ComputePCurveOn2 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the second shape, in the end,
-- - the function Build to construct the result.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge
-- of the result is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve
-- defined in the Geom package; for example, the intersection
-- of a cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If you prefer to have an attached 3D geometry which is a
-- BSpline approximation of the computed set of points on
-- computed elementary intersection edges whose underlying geometry
-- is not analytic, you may use a constructor with the PerformNow
-- flag equal to false. Then you use:
-- - the function Approximation to ask for this
-- computation option, and
-- - the function Build to construct the result.
-- - Note that as a result, approximations will only be
-- computed on edges built on new intersection lines.
-- - Example
-- You may also combine these computation options. In the following example:
-- - each elementary edge of the computed intersection,
-- built on a new intersection line, which does not
-- correspond to an analytic Geom curve, will be approximated by
-- a BSpline curve whose degree is not greater than 8.
-- - each elementary edge built on a new intersection line, will have:
-- - a pcurve in the parametric space of the intersected face of shape S1,
-- - no pcurve in the parametric space of the intersected face of shape S2.
-- // TopoDS_Shape S1 = ... , S2 = ... ;
-- Standard_Boolean PerformNow = Standard_False;
-- BRepAlgoAPI_Section S ( S1, S2, PerformNow );
-- S.ComputePCurveOn1 (Standard_True);
-- S.Approximation (Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
returns Section from BRepAlgoAPI;
Init1(me : out;S1 : Shape from TopoDS);
---Purpose: initialize first part
---Level: Public
Create(Sf : Surface from Geom;
Sh : Shape from TopoDS;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: see upper
---Level: Public
Init1(me : out;Pl : Pln from gp);
---Purpose: initialize first part
---Level: Public
Create(Sf1 : Surface from Geom;
Sf2 : Surface from Geom;
PerformNow : Boolean = Standard_True)
returns Section from BRepAlgoAPI;
---Purpose: This and the above classes construct a framework for
-- computing the section lines of:
-- - two shapes Sh1 and Sh2, or
-- - shape Sh and plane Pl, or
-- - shape Sh and surface Sf, or
-- - surface Sf and shape Sh, or
-- - two surfaces Sf1 and Sf2,
-- and builds a result if PerformNow equals true, its
-- default value. If PerformNow equals false, the intersection
-- will be computed later by the function Build.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not
-- chained or grouped in wires. If no intersection edge exists, the
-- result is an empty compound object.
-- Note that other objects than TopoDS_Shape shapes involved in
-- these syntaxes are converted into faces or shells before
-- performing the computation of the intersection. A shape
-- resulting from this conversion can be retrieved with the
-- function Shape1 or Shape2.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for each elementary
-- edge of the result. To attach such parametric curves to the
-- constructed edges you may use a constructor with the PerformNow
-- flag equal to false; then you use:
-- - the function ComputePCurveOn1 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the first shape,
-- - the function ComputePCurveOn2 to ask for
-- the additional computation of a pcurve in the parametric
-- space of the second shape, in the end,
-- - the function Build to construct the result.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge
-- of the result is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve
-- defined in the Geom package; for example, the intersection
-- of a cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If you prefer to have an attached 3D geometry which is a
-- BSpline approximation of the computed set of points on
-- computed elementary intersection edges whose underlying geometry
-- is not analytic, you may use a constructor with the PerformNow
-- flag equal to false. Then you use:
-- - the function Approximation to ask for this
-- computation option, and
-- - the function Build to construct the result.
-- - Note that as a result, approximations will only be
-- computed on edges built on new intersection lines.
-- - Example
-- You may also combine these computation options. In the following example:
-- - each elementary edge of the computed intersection,
-- built on a new intersection line, which does not
-- correspond to an analytic Geom curve, will be approximated by
-- a BSpline curve whose degree is not greater than 8.
-- - each elementary edge built on a new intersection line, will have:
-- - a pcurve in the parametric space of the intersected face of shape S1,
-- - no pcurve in the parametric space of the intersected face of shape S2.
-- // TopoDS_Shape S1 = ... , S2 = ... ;
-- Standard_Boolean PerformNow = Standard_False;
-- BRepAlgoAPI_Section S ( S1, S2, PerformNow );
-- S.ComputePCurveOn1 (Standard_True);
-- S.Approximation (Standard_True);
-- S.Build();
-- TopoDS_Shape R = S.Shape();
Init1(me : out;Sf : Surface from Geom);
---Purpose: initialize first part
---Level: Public
Init2(me : out;S2 : Shape from TopoDS);
---Purpose: initialize second part
---Level: Public
Init2(me : out;Pl : Pln from gp);
---Purpose: initialize second part
---Level: Public
Init2(me : out;Sf : Surface from Geom);
---Purpose: Reinitializes the first and the
-- second parts on which this algorithm is going to perform
-- the intersection computation. This is done with either: the
-- surface Sf, the plane Pl or the shape Sh.
-- You use the function Build to construct the result.
Approximation(me : out;B : Boolean);
---Level: Public
---Purpose: Defines an option for computation
-- of further intersections. This computation will be performed by
-- the function Build in this framework.
-- By default, the underlying 3D geometry attached to each
-- elementary edge of the result of a computed intersection is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1. If Approx equals
-- true, when further computations are performed in this framework
-- with the function Build, these edges will have an attached 3D
-- geometry which is a BSpline approximation of the computed
-- set of points.
-- Note that as a result, approximations will be computed
-- on edges built only on new intersection lines.
ComputePCurveOn1(me : out;B : Boolean);
---Level: Public
---Purpose:
-- Indicates if the Pcurve must be (or not) performed on first part.
ComputePCurveOn2(me : out;B : Boolean);
---Level: Public
---Purpose: Define options for the computation of further
-- intersections, which will be performed by the function Build
-- in this framework.
-- By default, no parametric 2D curve (pcurve) is defined for the
-- elementary edges of the result. If ComputePCurve1 equals true,
-- further computations performed in this framework with the function
-- Build will attach an additional pcurve in the parametric space of
-- the first shape to the constructed edges.
-- If ComputePCurve2 equals true, the additional pcurve will be
-- attached to the constructed edges in the parametric space of the
-- second shape.
-- These two functions may be used together.
Init1(me : out;
S1 : Shape from TopoDS);
---Purpose: initialize first part
---Level: Public
Build(me : in out)
---Purpose: Performs the computation of
-- section lines between two parts defined at the time of
-- construction of this framework or reinitialized with the Init1 and
-- Init2 functions.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not chained
-- or grouped into wires.
-- If no intersection edge exists, the result is an empty compound object.
-- The shapes involved in the construction of section lines can
-- be retrieved with the function Shape1 or Shape2. Note that other
-- objects than TopoDS_Shape shapes given as arguments at the
-- construction time of this framework, or to the Init1 or
-- Init2 function, are converted into faces or shells before
-- performing the computation of the intersection.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for the elementary
-- edges of the result. To attach parametric curves like this to
-- the constructed edges you have to use:
-- - the function
-- ComputePCurveOn1 to ask for the additional computation of a
-- pcurve in the parametric space of the first shape,
-- - the function
-- ComputePCurveOn2 to ask for the additional computation of a
-- pcurve in the parametric space of the second shape.
-- This must be done before calling this function.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge of the result is:
-- - analytic (where possible) provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example, the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle; or
-- - elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If, on computed elementary intersection edges whose
-- underlying geometry is not analytic, you prefer to have an
-- attached 3D geometry which is a Bspline approximation of the
-- computed set of points, you have to use the function Approximation
-- to ask for this computation option before calling this function.
-- You may also have combined these computation options: look at the
-- example given above to illustrate the use of the constructors.
is redefined static;
Init1(me : out;
Pl : Pln from gp);
---Purpose: initialize first part
---Level: Public
Init1(me : out;
Sf : Surface from Geom);
---Purpose: initialize first part
---Level: Public
Init2(me : out;
S2 : Shape from TopoDS);
---Purpose: initialize second part
---Level: Public
Init2(me : out;
Pl : Pln from gp);
---Purpose: initialize second part
---Level: Public
Init2(me : out;
Sf : Surface from Geom);
---Purpose: Reinitializes the first and the
-- second parts on which this algorithm is going to perform
-- the intersection computation. This is done with either: the
-- surface Sf, the plane Pl or the shape Sh.
-- You use the function Build to construct the result.
Approximation(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose: Defines an option for computation
-- of further intersections. This computation will be performed by
-- the function Build in this framework.
-- By default, the underlying 3D geometry attached to each
-- elementary edge of the result of a computed intersection is:
-- - analytic where possible, provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle;
-- - or elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1. If Approx equals
-- true, when further computations are performed in this framework
-- with the function Build, these edges will have an attached 3D
-- geometry which is a BSpline approximation of the computed
-- set of points.
-- Note that as a result, approximations will be computed
-- on edges built only on new intersection lines.
ComputePCurveOn1(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose:
-- Indicates if the Pcurve must be (or not) performed on first part.
HasAncestorFaceOn1(me; E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean;
---Level: Public
---Purpose:
-- get the face of the first part giving section edge <E>.
-- Returns True on the 3 following conditions :
-- 1/ <E> is an edge returned by the Shape() method.
-- 2/ First part of section performed is a shape.
-- 3/ <E> is built on a intersection curve (i.e <E>
-- is not the result of common edges)
-- When False, F remains untouched.
ComputePCurveOn2(me : out;
B : Boolean from Standard);
---Level: Public
---Purpose: Define options for the computation of further
-- intersections, which will be performed by the function Build
-- in this framework.
-- By default, no parametric 2D curve (pcurve) is defined for the
-- elementary edges of the result. If ComputePCurve1 equals true,
-- further computations performed in this framework with the function
-- Build will attach an additional pcurve in the parametric space of
-- the first shape to the constructed edges.
-- If ComputePCurve2 equals true, the additional pcurve will be
-- attached to the constructed edges in the parametric space of the
-- second shape.
-- These two functions may be used together.
Build(me : in out)
is redefined;
---Purpose: Performs the computation of
-- section lines between two parts defined at the time of
-- construction of this framework or reinitialized with the Init1 and
-- Init2 functions.
-- The constructed shape will be returned by the function Shape.
-- This is a compound object composed of edges. These
-- intersection edges may be built:
-- - on new intersection lines, or
-- - on coincident portions of edges in the two intersected shapes.
-- These intersection edges are independent: they are not chained
-- or grouped into wires.
-- If no intersection edge exists, the result is an empty compound object.
-- The shapes involved in the construction of section lines can
-- be retrieved with the function Shape1 or Shape2. Note that other
-- objects than TopoDS_Shape shapes given as arguments at the
-- construction time of this framework, or to the Init1 or
-- Init2 function, are converted into faces or shells before
-- performing the computation of the intersection.
-- Parametric 2D curves on intersection edges
-- No parametric 2D curve (pcurve) is defined for the elementary
-- edges of the result. To attach parametric curves like this to
-- the constructed edges you have to use:
-- - the function
-- ComputePCurveOn1 to ask for the additional computation of a
-- pcurve in the parametric space of the first shape,
-- - the function
-- ComputePCurveOn2 to ask for the additional computation of a
-- pcurve in the parametric space of the second shape.
-- This must be done before calling this function.
-- Approximation of intersection edges
-- The underlying 3D geometry attached to each elementary edge of the result is:
-- - analytic (where possible) provided the corresponding
-- geometry corresponds to a type of analytic curve defined in
-- the Geom package; for example, the intersection of a
-- cylindrical shape with a plane gives an ellipse or a circle; or
-- - elsewhere, given as a succession of points grouped
-- together in a BSpline curve of degree 1.
-- If, on computed elementary intersection edges whose
-- underlying geometry is not analytic, you prefer to have an
-- attached 3D geometry which is a Bspline approximation of the
-- computed set of points, you have to use the function Approximation
-- to ask for this computation option before calling this function.
-- You may also have combined these computation options: look at the
-- example given above to illustrate the use of the constructors.
HasAncestorFaceOn2(me; E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean;
---Purpose: Identifies the ancestor faces of
-- the intersection edge E resulting from the last
-- computation performed in this framework, that is, the faces of
-- the two original shapes on which the edge E lies:
-- - HasAncestorFaceOn1 gives the ancestor face in the first shape, and
-- - HasAncestorFaceOn2 gives the ancestor face in the second shape.
-- These functions return true if an ancestor face F is found, or false if not.
-- An ancestor face is identifiable for the edge E if the following
-- conditions are satisfied:
-- - the first part on which this algorithm performed its
-- last computation is a shape, that is, it was not given as
-- a surface or a plane at the time of construction of this
-- algorithm or at a later time by the Init1 function,
-- - E is one of the elementary edges built by the
-- last computation of this section algorithm.
-- To use these functions properly, you have to test the returned
-- Boolean value before using the ancestor face: F is significant
-- only if the returned Boolean value equals true.
HasAncestorFaceOn1(me;
E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean from Standard;
---Level: Public
---Purpose:
-- get the face of the first part giving section edge <E>.
-- Returns True on the 3 following conditions :
-- 1/ <E> is an edge returned by the Shape() method.
-- 2/ First part of section performed is a shape.
-- 3/ <E> is built on a intersection curve (i.e <E>
-- is not the result of common edges)
-- When False, F remains untouched.
InitParameters(me: out)
---Level: Private
is private;
HasAncestorFaceOn2(me;
E : Shape from TopoDS;
F : out Shape from TopoDS)
returns Boolean from Standard;
---Purpose: Identifies the ancestor faces of
-- the intersection edge E resulting from the last
-- computation performed in this framework, that is, the faces of
-- the two original shapes on which the edge E lies:
-- - HasAncestorFaceOn1 gives the ancestor face in the first shape, and
-- - HasAncestorFaceOn2 gives the ancestor face in the second shape.
-- These functions return true if an ancestor face F is found, or false if not.
-- An ancestor face is identifiable for the edge E if the following
-- conditions are satisfied:
-- - the first part on which this algorithm performed its
-- last computation is a shape, that is, it was not given as
-- a surface or a plane at the time of construction of this
-- algorithm or at a later time by the Init1 function,
-- - E is one of the elementary edges built by the
-- last computation of this section algorithm.
-- To use these functions properly, you have to test the returned
-- Boolean value before using the ancestor face: F is significant
-- only if the returned Boolean value equals true.
InitParameters(me: out)
is private;
---Level: Private
fields
myshapeisnull : Boolean from Standard;

View File

@@ -36,18 +36,46 @@
#include <BOPAlgo_BOP.hxx>
#include <BOPDS_DS.hxx>
static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
//
static
TopoDS_Shape MakeShape(const Handle(Geom_Surface)& );
static
Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller&,
const TopoDS_Shape&,
TopoDS_Shape&,
TopoDS_Shape&);
//=======================================================================
//function : BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section()
:
BRepAlgoAPI_BooleanOperation()
{
GeomAbs_Shape c = S->Continuity();
if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S, Precision::Confusion());
else return BRepBuilderAPI_MakeShell(S);
myOperation=BOPAlgo_SECTION;
InitParameters();
}
//=======================================================================
//function : ~BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::~BRepAlgoAPI_Section()
{
}
//=======================================================================
//function : InitParameters
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::InitParameters()
{
myparameterschanged = Standard_False;
myshapeisnull = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
}
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2);
//=======================================================================
//function : Constructor
//purpose :
@@ -55,31 +83,35 @@ static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh1,
const TopoDS_Shape& Sh2,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
:
BRepAlgoAPI_BooleanOperation(Sh1, Sh2, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
//=======================================================================
//function : BRepAlgoAPI_Section
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2,
const BOPAlgo_PaveFiller& aDSF,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(aS1, aS2, aDSF, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
@@ -87,85 +119,87 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& aS1,
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)), BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const TopoDS_Shape& Sh,
const gp_Pln& Pl,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(new Geom_Plane(Pl)),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const TopoDS_Shape& Sh,
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const TopoDS_Shape& Sh,
const Handle(Geom_Surface)& Sf,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(Sh, MakeShape(Sf), BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(Sh.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf,
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const Handle(Geom_Surface)& Sf,
const TopoDS_Shape& Sh,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(MakeShape(Sf), Sh, BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || Sh.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
if (PerformNow) {
Build();
}
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,
const Handle(Geom_Surface)& Sf2,
const Standard_Boolean PerformNow)
: BRepAlgoAPI_BooleanOperation(MakeShape(Sf1), MakeShape(Sf2), BOPAlgo_SECTION)
BRepAlgoAPI_Section::BRepAlgoAPI_Section
(const Handle(Geom_Surface)& Sf1,
const Handle(Geom_Surface)& Sf2,
const Standard_Boolean PerformNow)
:
BRepAlgoAPI_BooleanOperation(MakeShape(Sf1),
MakeShape(Sf2),
BOPAlgo_SECTION)
{
InitParameters();
myparameterschanged = Standard_True;
if(myS1.IsNull() || myS2.IsNull()) {
// StdFail_NotDone::Raise("BRepAlgoAPI_Section : Shape NULL");
myshapeisnull = Standard_True;
}
@@ -173,7 +207,6 @@ BRepAlgoAPI_Section::BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1,
Build();
}
}
//=======================================================================
//function : Init1
//purpose :
@@ -201,7 +234,6 @@ void BRepAlgoAPI_Section::Init1(const TopoDS_Shape& S1)
if(myparameterschanged)
NotDone();
}
//=======================================================================
//function : Init1
//purpose :
@@ -210,7 +242,6 @@ void BRepAlgoAPI_Section::Init1(const gp_Pln& Pl)
{
Init1(MakeShape(new Geom_Plane(Pl)));
}
//=======================================================================
//function : Init1
//purpose :
@@ -219,7 +250,6 @@ void BRepAlgoAPI_Section::Init1(const Handle(Geom_Surface)& Sf)
{
Init1(MakeShape(Sf));
}
//=======================================================================
//function : Init2
//purpose :
@@ -248,7 +278,6 @@ void BRepAlgoAPI_Section::Init2(const TopoDS_Shape& S2)
NotDone();
}
}
//=======================================================================
//function : Init2
//purpose :
@@ -257,7 +286,6 @@ void BRepAlgoAPI_Section::Init2(const gp_Pln& Pl)
{
Init2(MakeShape(new Geom_Plane(Pl)));
}
//=======================================================================
//function : Init2
//purpose :
@@ -266,7 +294,6 @@ void BRepAlgoAPI_Section::Init2(const Handle(Geom_Surface)& Sf)
{
Init2(MakeShape(Sf));
}
//=======================================================================
//function : Approximation
//purpose :
@@ -278,7 +305,6 @@ void BRepAlgoAPI_Section::Approximation(const Standard_Boolean B)
myparameterschanged = Standard_True;
}
}
//=======================================================================
//function : ComputePCurveOn1
//purpose :
@@ -290,7 +316,6 @@ void BRepAlgoAPI_Section::ComputePCurveOn1(const Standard_Boolean B)
myparameterschanged = Standard_True;
}
}
//=======================================================================
//function : ComputePCurveOn2
//purpose :
@@ -302,7 +327,6 @@ void BRepAlgoAPI_Section::ComputePCurveOn2(const Standard_Boolean B)
myparameterschanged = Standard_True;
}
}
//=======================================================================
//function : Build
//purpose :
@@ -325,7 +349,9 @@ void BRepAlgoAPI_Section::Build()
}
//
if (bIsNewFiller) {
BOPAlgo_SectionAttribute theSecAttr(myApprox, myComputePCurve1, myComputePCurve2);
BOPAlgo_SectionAttribute theSecAttr(myApprox,
myComputePCurve1,
myComputePCurve2);
myDSFiller->SetSectionAttribute(theSecAttr);
myDSFiller->Perform();
}
@@ -335,12 +361,13 @@ void BRepAlgoAPI_Section::Build()
myparameterschanged = Standard_False;
}
}
//=======================================================================
//function : HasAncestorFaceOn1
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1(const TopoDS_Shape& E, TopoDS_Shape& F) const
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
@@ -359,12 +386,13 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn1(const TopoDS_Shape& E,
F = F1;
return aResult;
}
//=======================================================================
//function : HasAncestorFaceOn2
//purpose :
//=======================================================================
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2(const TopoDS_Shape& E,TopoDS_Shape& F) const
Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2
(const TopoDS_Shape& E,
TopoDS_Shape& F) const
{
Standard_Boolean aResult = Standard_False;
if(E.IsNull()) {
@@ -385,27 +413,15 @@ Standard_Boolean BRepAlgoAPI_Section::HasAncestorFaceOn2(const TopoDS_Shape& E,T
}
//=======================================================================
//function : InitParameters
//function : HasAncestorFaces
//purpose :
//=======================================================================
void BRepAlgoAPI_Section::InitParameters()
Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape&F2)
{
myparameterschanged = Standard_False;
myshapeisnull = Standard_False;
myApprox = Standard_False;
myComputePCurve1 = Standard_False;
myComputePCurve2 = Standard_False;
}
// ------------------------------------------------------------------------
// static function : HasAncestorFaces
// purpose :
// ------------------------------------------------------------------------
static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
const TopoDS_Shape& E,
TopoDS_Shape& F1,
TopoDS_Shape& F2) {
Standard_Integer aNb, i, j, nE, nF1, nF2, aNbCurves;
//
const BOPDS_PDS& pDS = theDSFiller->PDS();
@@ -442,3 +458,15 @@ static Standard_Boolean HasAncestorFaces(const BOPAlgo_PPaveFiller& theDSFiller,
}
return Standard_False;
}
//=======================================================================
//function : MakeShape
//purpose :
//=======================================================================
TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S)
{
GeomAbs_Shape c = S->Continuity();
if (c >= GeomAbs_C2) {
return BRepBuilderAPI_MakeFace(S, Precision::Confusion());
}
return BRepBuilderAPI_MakeShell(S);
}