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

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

5
src/QANewModTopOpe/FILES Executable file
View File

@@ -0,0 +1,5 @@
QANewModTopOpe_Glue_util.cxx
QANewModTopOpe_Glue_vertex.cxx
QANewModTopOpe_Glue_shell.cxx
QANewModTopOpe_Glue_wire.cxx
QANewModTopOpe_Glue_SDFaces.cxx

View File

@@ -0,0 +1,112 @@
-- File: QANewModTopOpe.cdl
-- Created: Thu May 3 10:37:16 2001
-- Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
-- Copyright: SAMTECH S.A. 2001
-- sccsid[] = "@(#) QANewModTopOpe.cdl 4.0-2, 07/01/03@(#)";
-- Lastly modified by :
-- +---------------------------------------------------------------------------+
-- ! ifv ! Creation ! 3-05-2001! 3.0-00-4!
-- ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
-- +---------------------------------------------------------------------------+
package QANewModTopOpe
---Purpose: QANewModTopOpe package provides classes for limitation, gluing
-- and removing "floating" shapes.
uses
BRepAlgoAPI,
TopoDS,
TopTools,
TopAbs,
BRepTools,
gp,
BOPTools
is
enumeration ModeOfLimitation is Forward,
Reversed,
BothParts;
pointer CutPtr to Cut from BRepAlgoAPI;
pointer CommonPtr to Common from BRepAlgoAPI;
class Tools;
---Purpose: to provide several tools for porting to OCC 5.0 (mkk)
class Limitation;
---Purpose: to provide cutting object by face or shell.
class Intersection;
---Purpose: to provide intersection of two topological objects.
class Glue; --- inherits BooleanOperation from BRepAlgoAPI
---Purpose: to provide topological sewing of two topological objects.
class ReShaper;
---Purpose: to remove "floating" objects from compound.
-- "floating" objects are wires, edges, vertices that do not belong
-- solids, shells or faces.
IsValid(TheS : Shape from TopoDS; GeomControls : Boolean from Standard = Standard_True)
returns Boolean from Standard;
---Purpose: to check if TheS is valid or not.
-- in difference with BRepCheck_Analizer, this method allows
-- some kind of non-manifold shapes
IsManifold(TheS : Shape from TopoDS) returns Boolean from Standard;
---Purpose: to check if TheS is manifol or not.
-- manifold shape is valid SOLID, SHELL, WIRE, EDGE, VERTEX without internal
-- subshapes - faces, wires, edges and vertices that have INTERNAL orientation
-- For SHELL there are additional conditions: orientations of faces must
-- corresponds each other, each edge must be shared not more then two faces.
-- COMPSOLID is non manifold by default.
-- COMPOUND conciders to be manifold if:
-- 1) all shapes in compound are manifold (see above mentioned definitions)
-- 2) all shapes are fully disconnected - there are any shapes in compound that
-- share common subshapes.
IsCompoundManifold(TheS : Compound from TopoDS) returns Boolean from Standard;
---Purpose: to check if TheS is manifol or not.
-- compound conciders to be manifold if:
-- 1) all shapes in compound are manifold (see comments for method IsManifold)
-- 2) all shapes are fully disconnected - there are any shapes in compound that
-- share common subshapes.
TypeOfShape(TheS : Shape from TopoDS) returns ShapeEnum from TopAbs;
---Purpose: to define if COMPOUND is homogeneous
-- (consists of shapes of the same type) and return this shape type.
-- If COMPOUND is mixed, method returns TopAbs_COMPOUND.
-- If TheS is single shape (not COMPOUND), method returns its type.
-- If COMPOUND contains nested compounds, it concideres to be homogeneous
-- if all compounds consist of shapes of the same type.
IsConnected(TheS : Shape from TopoDS) returns Boolean from Standard;
---Purpose: to check if all subshapes in TheS, when TheS is COMPOUND, COMPSOLID, SHELL or WIRE,
-- are linked through common faces, edges or vertices.
-- SOLID, FACE, EDGE, VERTEX concider to be connected by default.
end QANewModTopOpe;
-- @@SDM: begin
-- Copyright SAMTECH ..........................................Version 3.0-00
-- Lastly modified by : skv Date : 6-05-2003
-- File history synopsis (creation,modification,correction)
-- +---------------------------------------------------------------------------+
-- ! Developer ! Comments ! Date ! Version !
-- +-----------!-----------------------------------------!----------!----------+
-- ! ifv ! Creation ! 3-05-2001! 3.0-00-4!
-- ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
-- ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
-- +---------------------------------------------------------------------------+
--
-- @@SDM: end

View File

@@ -0,0 +1,679 @@
// File: QANewModTopOpe.cxx
// Created: Mon Jan 28 14:24:19 2002
// Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2002
const static char sccsid[] = "%Z% $RCSfile: QANewModTopOpe.cxx,v $ 4.0-%L%, $Date: 2005-12-16 18:19:13 $%Z%";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! pat ! Optimise IsConnected() ! 04/16/03! 4.0-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe.ixx>
#include <TopAbs.hxx>
#include <TopoDS_Iterator.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopExp.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <math_Matrix.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepTools_Substitution.hxx>
#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
#include <BRepCheck_Result.hxx>
#include <BRepCheck.hxx>
#include <BRepCheck_Shell.hxx>
#include <BRepCheck_Wire.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
static Standard_Boolean NoInternalVertices(const TopoDS_Shape& TheS);
static Standard_Boolean CorrectOrientation(const TopoDS_Shell& TheS);
static TopoDS_Shape RemoveIntExtEdges(const TopoDS_Shape& TheS)
{
TopoDS_Shape aCopy = TheS;
BRepTools_Substitution aSubst;
TopTools_ListOfShape anEmptyList;
TopAbs_Orientation anOr;
TopExp_Explorer anExp(aCopy, TopAbs_EDGE);
for(; anExp.More(); anExp.Next()) {
anOr = anExp.Current().Orientation();
if(anOr == TopAbs_INTERNAL || anOr == TopAbs_EXTERNAL) {
if(!aSubst.IsCopied(anExp.Current())) {
aSubst.Substitute(anExp.Current(), anEmptyList);
}
}
}
aSubst.Build(aCopy);
if(aSubst.IsCopied(aCopy)) {
aCopy = aSubst.Copy(aCopy).First();
}
return aCopy;
}
Standard_Boolean QANewModTopOpe::IsValid(const TopoDS_Shape& TheS, const Standard_Boolean GeomControls)
{
TopExp_Explorer anExp, anExp1;
TopoDS_Shape aCopy;
anExp.Init(TheS, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aCopy = RemoveIntExtEdges(anExp.Current());
BRepCheck_Analyzer anAnlz(aCopy, GeomControls);
if(anAnlz.IsValid()) continue;
else return Standard_False;
}
anExp.Init(TheS, TopAbs_SHELL, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aCopy = RemoveIntExtEdges(anExp.Current());
Handle(BRepCheck_Shell) aChkSh = new BRepCheck_Shell(TopoDS::Shell(aCopy));
aChkSh->Minimum();
aChkSh->Closed(Standard_True);
aChkSh->Orientation(Standard_True);
BRepCheck_ListIteratorOfListOfStatus anItl(aChkSh->Status());
for (;anItl.More(); anItl.Next()) {
if((anItl.Value() == BRepCheck_NoError) ||
(anItl.Value() == BRepCheck_InvalidMultiConnexity) ||
(anItl.Value() == BRepCheck_NotClosed) ||
(anItl.Value() == BRepCheck_BadOrientationOfSubshape)) continue;
return Standard_False;
}
anExp1.Init(anExp.Current(), TopAbs_FACE);
for(; anExp1.More(); anExp1.Next()) {
if(IsValid(anExp1.Current())) continue;
else return Standard_False;
}
}
anExp.Init(TheS, TopAbs_FACE, TopAbs_SHELL);
for(; anExp.More(); anExp.Next()) {
aCopy = RemoveIntExtEdges(anExp.Current());
BRepCheck_Analyzer anAnlz(aCopy, GeomControls);
if(anAnlz.IsValid()) continue;
else return Standard_False;
}
anExp.Init(TheS, TopAbs_WIRE, TopAbs_FACE);
for(; anExp.More(); anExp.Next()) {
BRepCheck_Analyzer anAnlz(anExp.Current(), GeomControls);
Handle(BRepCheck_Result) aChkWr = anAnlz.Result(anExp.Current());
BRepCheck_ListIteratorOfListOfStatus anItl(aChkWr->Status());
for (;anItl.More(); anItl.Next()) {
if(anItl.Value() == BRepCheck_NoError ||
anItl.Value() == BRepCheck_BadOrientationOfSubshape) continue;
return Standard_False;
}
}
anExp.Init(TheS, TopAbs_EDGE, TopAbs_WIRE);
for(; anExp.More(); anExp.Next()) {
BRepCheck_Analyzer anAnlz(anExp.Current(), GeomControls);
if(anAnlz.IsValid()) continue;
else return Standard_False;
}
return Standard_True;
}
Standard_Boolean QANewModTopOpe::IsManifold(const TopoDS_Shape& TheS)
{
Standard_Boolean aRes = Standard_False;
if(TheS.IsNull()) return aRes;
TopAbs_ShapeEnum aType = TheS.ShapeType();
switch (aType) {
case TopAbs_COMPOUND :
{
TopoDS_Iterator anIter(TheS);
if(!anIter.More()) return aRes;
const TopoDS_Shape& aS = anIter.Value();
anIter.Next();
if(anIter.More()) aRes = IsCompoundManifold(TopoDS::Compound(TheS));
else aRes = IsManifold(aS);
}
break;
case TopAbs_COMPSOLID :
aRes = Standard_False;
break;
case TopAbs_SOLID :
{
aRes = NoInternalVertices(TheS);
}
break;
case TopAbs_SHELL :
{
aRes = NoInternalVertices(TheS);
if(aRes) aRes = CorrectOrientation(TopoDS::Shell(TheS));
}
break;
case TopAbs_FACE :
{
aRes = NoInternalVertices(TheS);
}
break;
case TopAbs_WIRE :
{
aRes = NoInternalVertices(TheS);
}
break;
case TopAbs_EDGE :
aRes = NoInternalVertices(TheS);
break;
case TopAbs_VERTEX :
aRes = Standard_True;
break;
case TopAbs_SHAPE :
default :
;
}
return aRes;
}
static Standard_Boolean NoInternalVertices(const TopoDS_Shape& TheS)
{
TopAbs_Orientation anOrnt;
TopExp_Explorer anExp(TheS, TopAbs_VERTEX);
for(; anExp.More(); anExp.Next()) {
anOrnt = anExp.Current().Orientation();
if(anOrnt == TopAbs_FORWARD) continue;
if(anOrnt == TopAbs_REVERSED) continue;
return Standard_False;
}
return Standard_True;
}
static Standard_Boolean CorrectOrientation(const TopoDS_Shell& TheS)
{
TopoDS_Iterator anIter(TheS);
if(!anIter.More()) return Standard_False; //Empty shell;
anIter.Next();
if(!anIter.More()) return Standard_True; // only one face
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFace;
TopExp::MapShapesAndAncestors(TheS, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFace);
Standard_Integer i, nbEdgs = aMapEdgeFace.Extent();
TopExp_Explorer anExp;
TopAbs_Orientation anOrnt;
for(i = 1; i <= nbEdgs; i++) {
const TopTools_ListOfShape& aL = aMapEdgeFace(i);
if(aL.Extent() > 2) return Standard_False;
if(aL.Extent() == 1) continue;
const TopoDS_Shape& anE = aMapEdgeFace.FindKey(i);
anExp.Init(aL.First(), TopAbs_EDGE);
for(; anExp.More(); anExp.Next()) {
if(anE.IsSame(anExp.Current())) {
anOrnt = anExp.Current().Orientation();
break;
}
}
anExp.Init(aL.Last(), TopAbs_EDGE);
for(; anExp.More(); anExp.Next()) {
if(anE.IsSame(anExp.Current())) {
if(anOrnt == anExp.Current().Orientation()) return Standard_False;
break;
}
}
}
return Standard_True;
}
Standard_Boolean QANewModTopOpe::IsCompoundManifold(const TopoDS_Compound& TheS)
{
Standard_Boolean aRes = Standard_True;
TopExp_Explorer anExp;
anExp.Init(TheS, TopAbs_COMPSOLID);
if(anExp.More()) {
aRes = Standard_False;
return aRes;
}
TopTools_ListOfShape aList;
TopExp_Explorer anExp1;
TopTools_DataMapOfShapeInteger aMap;
Standard_Integer n = 0, connect;
anExp.Init(TheS, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aRes = IsManifold(anExp.Current());
if(!aRes) return aRes;
++n;
anExp1.Init(anExp.Current(), TopAbs_FACE);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
anExp1.Init(anExp.Current(), TopAbs_EDGE);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
anExp1.Init(anExp.Current(), TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
}
anExp.Init(TheS, TopAbs_SHELL, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aRes = IsManifold(anExp.Current());
if(!aRes) return aRes;
++n;
anExp1.Init(anExp.Current(), TopAbs_FACE);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
anExp1.Init(anExp.Current(), TopAbs_EDGE);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
anExp1.Init(anExp.Current(), TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
}
anExp.Init(TheS, TopAbs_FACE, TopAbs_SHELL);
for(; anExp.More(); anExp.Next()) {
aRes = IsManifold(anExp.Current());
if(!aRes) return aRes;
++n;
anExp1.Init(anExp.Current(), TopAbs_EDGE);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
anExp1.Init(anExp.Current(), TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
}
anExp.Init(TheS, TopAbs_WIRE, TopAbs_FACE);
for(; anExp.More(); anExp.Next()) {
aRes = IsManifold(anExp.Current());
if(!aRes) return aRes;
++n;
anExp1.Init(anExp.Current(), TopAbs_EDGE);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
anExp1.Init(anExp.Current(), TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
}
anExp.Init(TheS, TopAbs_EDGE, TopAbs_WIRE);
for(; anExp.More(); anExp.Next()) {
aRes = IsManifold(anExp.Current());
if(!aRes) return aRes;
++n;
anExp1.Init(anExp.Current(), TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) {
if(aMap.IsBound(anExp1.Current())) {
connect = aMap(anExp1.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp1.Current(), n);
}
}
}
anExp.Init(TheS, TopAbs_VERTEX, TopAbs_EDGE);
for(; anExp.More(); anExp.Next()) {
++n;
if(aMap.IsBound(anExp.Current())) {
connect = aMap(anExp.Current());
if(n != connect) {
aRes = Standard_False;
return aRes;
}
}
else {
aMap.Bind(anExp.Current(), n);
}
}
return aRes;
}
TopAbs_ShapeEnum QANewModTopOpe::TypeOfShape(const TopoDS_Shape& TheS)
{
if(TheS.ShapeType() != TopAbs_COMPOUND) return TheS.ShapeType();
TopAbs_ShapeEnum aType = TopAbs_COMPOUND;
TopoDS_Iterator anIter(TheS);
if(!anIter.More()) return aType;
aType = TypeOfShape(anIter.Value());
if(aType == TopAbs_COMPOUND) return aType;
anIter.Next();
for(; anIter.More(); anIter.Next()) {
if(TypeOfShape(anIter.Value()) != aType) return TopAbs_COMPOUND;
}
return aType;
}
Standard_Boolean QANewModTopOpe::IsConnected(const TopoDS_Shape& TheS)
{
cout << "QANewModTopOpe::IsConnected BEGIN" << endl;
Standard_Boolean aRes = Standard_True;
if(TheS.IsNull()) return aRes;
TopAbs_ShapeEnum aType = TheS.ShapeType();
if(aType != TopAbs_COMPOUND) return aRes;
TopTools_ListOfShape aCompList;
TopTools_DataMapOfShapeInteger aMap;
TopTools_MapOfShape aSMap;
TopoDS_Iterator anTDIter;
TopExp_Explorer anExp;
anTDIter.Initialize(TheS);
for(; anTDIter.More(); anTDIter.Next()) {
if(anTDIter.Value().ShapeType() == TopAbs_COMPOUND) aCompList.Append(anTDIter.Value());
else aSMap.Add(anTDIter.Value());
}
TopTools_ListIteratorOfListOfShape anIter(aCompList);
for(;anIter.More(); anIter.Next()) {
anTDIter.Initialize(anIter.Value());
for(; anTDIter.More(); anTDIter.Next()) {
if(anTDIter.Value().ShapeType() == TopAbs_COMPOUND) aCompList.Append(anTDIter.Value());
else aSMap.Add(anTDIter.Value());
}
}
//cout << "QANewModTopOpe::IsConnected(2)" << endl;
Standard_Integer nbs = aSMap.Extent();
if(nbs <= 1) return aRes;
// math_Matrix aMat(1, nbs, 1, nbs, 0.0);
int *aMat = new int[nbs*nbs];
Standard_Integer aMax=nbs*nbs;
for(Standard_Integer kk=0;kk<aMax;kk++) aMat[kk]=0;
TopTools_MapIteratorOfMapOfShape anMIter(aSMap);
Standard_Integer n = 1;
Standard_Integer connect;
const TopoDS_Shape& aFirstShape = anMIter.Key();
// aMat(n,n) = 1.;
aMat[0] = 1;
anExp.Init(aFirstShape, TopAbs_VERTEX);
for(; anExp.More(); anExp.Next()) {
aMap.Bind(anExp.Current(), n);
}
anMIter.Next();
for(; anMIter.More(); anMIter.Next()) {
++n;
aMat[(n-1)*nbs+n-1] = 1;
// aMat(n,n) = 1.;
const TopoDS_Shape& aShape = anMIter.Key();
anExp.Init(aShape, TopAbs_VERTEX);
for(; anExp.More(); anExp.Next()) {
if(aMap.IsBound(anExp.Current())) {
connect = aMap(anExp.Current());
//aMat(n, connect) = 1.;
//aMat(connect, n) = 1.;
aMat[(n-1)*nbs+connect-1] = 1;
aMat[(connect-1)*nbs+n-1] = 1;
}
else {
aMap.Bind(anExp.Current(), n);
}
}
}
//cout << "QANewModTopOpe::IsConnected(3)Lnbs=" <<nbs<< endl;
Standard_Integer k,i,ncount=0;
Standard_Real p;
Standard_Boolean aNotChanged;
// math_Vector aRow(1, nbs), aCol(1, nbs);
// aRow = aMat.Row(1);
for(k = 1; k <= nbs; k++) {
aRes = Standard_True;
aNotChanged = Standard_True;
for(n = 1; n <= nbs; n++) {
// if(aMat(1, n) < 1.) {
if(aMat[n-1] == 0) {
// aRow = aMat.Row(1);
//aCol = aMat.Col(n);
p=0.;
for(i=1;i<=nbs;i++) {
//ncount++;
// if(aMat(1,i) > 0. && aMat(i,n)> 0.) {
if(aMat[i-1] == 1 && aMat[(i-1)*nbs+n-1] == 1) {
p=1.;
break;
}
// p+=aMat(1,i)*aMat(i,n);
}
//p = aRow*aCol;
if(p > 0.0) {
// aMat(1, n) = 1.0;
// aMat(n, 1) = 1.0;
aMat[n-1] = 1;
aMat[(n-1)*nbs+1-1] = 1;
aNotChanged = Standard_False;
}
aRes = Standard_False;
}
}
if(aNotChanged) break;
if(aRes) break;
}
delete aMat;
// cout << "QANewModTopOpe::IsConnected END: aRes="<<aRes << ";ncount="<<ncount<<endl;
cout << "QANewModTopOpe::IsConnected END: aRes="<<aRes <<endl;
return aRes;
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : pat Date : 04/16/03
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! ifv ! Creation !28-01-2002! 3.0-00-1!
// ! ivan ! print de trace ! 01/21/03! 4.0-1!
// ! pat ! Optimise IsConnected() ! 04/16/03! 4.0-2!
// +---------------------------------------------------------------------------+
// @@SDM: end

View File

@@ -0,0 +1,223 @@
-- File: QANewModTopOpe_Glue.cdl
-- Created: Fri May 3 18:01:59 2001
-- Author: Michael SAZONOV <msv@nnov.matra-dtv.fr>
-- Copyright: SAMTECH S.A. 2001
-- sccsid[] = "@(#) QANewModTopOpe_Glue.cdl 4.0-2, 07/01/03@(#)";
-- Lastly modified by :
-- +---------------------------------------------------------------------------+
-- ! msv ! Creation ! 3-05-2001! 3.0-00-2!
-- ! skv ! Add gluing Solid-Solid operation ! 5-05-2001! 3.0-00-2!
-- ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
-- +---------------------------------------------------------------------------+
class Glue from QANewModTopOpe inherits BooleanOperation from BRepAlgoAPI
---Purpose: Perform the gluing topological operation.
uses
Boolean from Standard,
Pnt from gp,
Shape from TopoDS,
Vertex from TopoDS,
Edge from TopoDS,
Face from TopoDS,
ListOfShape from TopTools,
State from TopAbs,
Substitution from BRepTools,
MapOfShape from TopTools,
DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfShape from TopTools,
IndexedDataMapOfShapeListOfShape from TopTools
is
Create (theS1,theS2 : Shape from TopoDS;
theAllowCutting: Boolean from Standard = Standard_False;
thePerformNow: Boolean from Standard = Standard_True)
returns Glue from QANewModTopOpe;
---Purpose: Defines 2 operands.
-- If one of operands is Solid and another is Shell and Shell
-- goes inside Solid, the <allowCutting> determines what to do:
-- if True, Shell is cut by Solid during the operation;
-- if False, Null shape is returned, IsDone() returns False.
-- If <thePerformNow> is False then does not compute immediately.
---Level: Public
Build (me: in out)
is redefined static;
---Purpose: Computation; is usefull when Create was called with thePerformNow
-- being False
---Level: Public
Generated (me: in out; theS : Shape from TopoDS)
returns ListOfShape from TopTools is redefined static;
---Purpose: Returns the list of shapes generated from the
-- shape <theS>.
---C++: return const &
---Level: Public
Modified (me: in out; theS : Shape from TopoDS)
returns ListOfShape from TopTools is redefined static;
---Purpose: Returns the list of shapes modified from the shape
-- <theS>.
---C++: return const &
---Level: Public
IsDeleted (me: in out; theS : Shape from TopoDS)
returns Boolean from Standard is redefined static;
---Purpose: Returns True if the shape <theS> existed in one of operands
-- and is absent in the result.
---Level: Public
HasGenerated (me)
returns Boolean from Standard
is redefined;
---Purpose: Returns True if there is at leat one generated shape
---Level: Public
HasModified (me)
returns Boolean from Standard
is redefined;
---Purpose: Returns True if there is at leat one modified shape
---Level: Public
HasDeleted (me)
returns Boolean from Standard
is redefined;
---Purpose: Returns True if there is at leat one deleted shape
---Level: Public
------------------
-- Private methods
------------------
PerformShellWire (me: in out) is private;
---Purpose: Performs gluing Shell-Wire
---Level: Private
PerformVertex (me: in out) is private;
---Purpose: Performs gluing Solid-Vertex and Shell-Vertex
---Level: Private
PerformShell (me: in out) is private;
---Purpose: Performs gluing Solid-Shell and Shell-Shell
---Level: Private
PerformWires (me: in out) is private;
---Purpose: Performs gluing Wire-Wire
---Level: Private
SubstitudeSDFaces(me: in out;
theFirstSDFace : Shape from TopoDS;
theSecondSDFace : Shape from TopoDS;
theNewSolid1 : in out Shape from TopoDS;
theNewSolid2 : in out Shape from TopoDS;
theMapOfChangedFaces: in out DataMapOfShapeListOfShape from TopTools)
---Purpose: This function performs gluing operation of same domain
-- faces theFirstSDFace and theSecondSDFace on shapes
-- theNewSolid1 and theNewSolid2 and returns them.
-- theMapOfChangedFaces contains changed faces as keys and
-- lists of their splits as items.
---Level: Private
returns Boolean from Standard
is private;
PerformSDFaces (me: in out) is private;
---Purpose: Performs gluing between same domain faces of object and tool
---Level: Private
CutFace (me: in out; theFace: Face from TopoDS;
theListSE: ListOfShape from TopTools)
returns Boolean from Standard is private;
---Purpose: For the case Solid-Shell, <aFace> is from Shell.
-- Splits <theFace> onto faces by section edges <theListSE> and
-- add <theFace> for substitution by list of faces which are "out"
-- of Solid
---Level: Private
ClassifyFace (me: in; theFace: Face from TopoDS;
theListSE: ListOfShape from TopTools)
returns State from TopAbs is private;
---Purpose: For the case Solid-Shell, <theFace> is a split of Shell's face.
-- Returns the state of <theFace> relatively Solid.
---Level: Private
SectionInsideFace (me: in out; theFace: Face from TopoDS;
theListSE: ListOfShape from TopTools;
theShapeNum: Integer from Standard;
theGenEdges: MapOfShape from TopTools)
is private;
---Purpose: Inserts "internal" elements (wires, edges, vertices) computed
-- from a list of section edges <theListSE> into <theFace>.
---Level: Private
------------------
-- Utilities
------------------
ProjPointOnEdge (myclass; thePnt: Pnt from gp; theEdge: Edge from TopoDS;
thePar, theDist: out Real from Standard)
returns Boolean from Standard;
InsertVertexInEdge (myclass; theEdge: Edge from TopoDS;
theVer: Vertex from TopoDS;
thePar: Real from Standard;
theNewEdge: out Edge from TopoDS);
SplitEdgeByVertex (myclass; theEdge: Edge from TopoDS;
theVer: Vertex from TopoDS;
thePar: Real from Standard;
theListE: out ListOfShape from TopTools);
CompareVertices (myclass; theV1, theV2: Vertex from TopoDS;
theDist: out Real from Standard)
returns Boolean from Standard;
FindWireOrUpdateMap (myclass; theWire: Shape from TopoDS;
theMapELW: in out IndexedDataMapOfShapeListOfShape from TopTools)
returns Shape from TopoDS is private;
---C++: return const &
fields
myCompleted: Boolean from Standard;
myAllowCutting: Boolean from Standard;
mySubst : Substitution from BRepTools;
-- Map: section edge => list of all faces-ancestors from corresponding shape
myMapSEdgeFaces1: DataMapOfShapeListOfShape from TopTools;
myMapSEdgeFaces2: DataMapOfShapeListOfShape from TopTools;
-- Map: section edge => face crossed by this edge (i.e., edge lies
-- inside the face, not on boundary)
myMapSEdgeCrossFace1: DataMapOfShapeShape from TopTools;
myMapSEdgeCrossFace2: DataMapOfShapeShape from TopTools;
-- Map: internal edge => list of internal wires containing this edge;
-- it is to share wires
myMapEdgeWires: IndexedDataMapOfShapeListOfShape from TopTools;
myEdgesToLeave: MapOfShape from TopTools;
myMapModif: DataMapOfShapeListOfShape from TopTools;
myMapGener: DataMapOfShapeListOfShape from TopTools;
end Glue;
-- @@SDM: begin
-- Copyright SAMTECH ..........................................Version 3.0-00
-- Lastly modified by : skv Date : 6-05-2003
-- File history synopsis (creation,modification,correction)
-- +---------------------------------------------------------------------------+
-- ! Developer ! Comments ! Date ! Version !
-- +-----------!-----------------------------------------!----------!----------+
-- ! msv ! Creation ! 3-05-2001! 3.0-00-2!
-- ! skv ! Add gluing Solid-Solid operation ! 5-05-2001! 3.0-00-2!
-- ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
-- ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
-- +---------------------------------------------------------------------------+
--
-- @@SDM: end

View File

@@ -0,0 +1,575 @@
// File: QANewModTopOpe_Glue.cxx
// Created: Fri Dec 8 17:28:08 2000
// Author: Michael SAZONOV <msv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2001
const static char sccsid[] = "@(#) QANewModTopOpe_Glue.cxx 4.0-2, 07/01/03@(#)";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! msv ! Creation ! 3-05-2001! 3.0-00-3!
// ! skv ! Add gluing Solid-Solid operation ! 5-05-2001! 3.0-00-3!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe_Glue.ixx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
static TopoDS_Shape RemoveCompounds(const TopoDS_Shape& TheS)
{
if(TheS.IsNull()) return TheS;
TopAbs_ShapeEnum aType = TheS.ShapeType();
if(aType != TopAbs_COMPOUND) return TheS;
TopTools_MapOfShape aMap;
TopoDS_Shape aResult;
BRep_Builder aBld;
aBld.MakeCompound(TopoDS::Compound(aResult));
Standard_Integer n = 0;
TopExp_Explorer anExp;
anExp.Init(TheS, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
n++;
if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current());
}
anExp.Init(TheS, TopAbs_SOLID, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
n++;
if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current());
}
anExp.Init(TheS, TopAbs_SHELL, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
n++;
if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current());
}
anExp.Init(TheS, TopAbs_FACE, TopAbs_SHELL);
for(; anExp.More(); anExp.Next()) {
n++;
if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current());
}
anExp.Init(TheS, TopAbs_WIRE, TopAbs_FACE);
for(; anExp.More(); anExp.Next()) {
n++;
if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current());
}
anExp.Init(TheS, TopAbs_EDGE, TopAbs_WIRE);
for(; anExp.More(); anExp.Next()) {
n++;
if(aMap.Add(anExp.Current())) aBld.Add(aResult, anExp.Current());
}
if(n == 1) {
TopoDS_Iterator anIter(aResult);
aResult = anIter.Value();
}
if(n == 0) aResult.Nullify();
return aResult;
}
//=======================================================================
//function : QANewModTopOpe_Glue
//purpose :
//=======================================================================
QANewModTopOpe_Glue::QANewModTopOpe_Glue(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2,
const Standard_Boolean theAllowCutting,
const Standard_Boolean thePerformNow)
: BRepAlgoAPI_BooleanOperation (theS1,theS2, BOP_FUSE),
myAllowCutting (theAllowCutting),
myCompleted (Standard_False)
{
NotDone();
myGenerated.Clear();
myMapModif.Clear();
myMapGener.Clear();
if (thePerformNow)
Build();
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void QANewModTopOpe_Glue::Build()
{
if (myCompleted) return;
TopAbs_ShapeEnum aType1, aType2;
aType1 = myS1.ShapeType();
aType2 = myS2.ShapeType();
TopoDS_Shape aCopyS1 = myS1;
TopoDS_Shape aCopyS2 = myS2;
TopoDS_Shape aResult;
if(aType2 == TopAbs_VERTEX) {
PerformVertex();
myCompleted = Standard_True;
return;
} else if (aType1 == TopAbs_VERTEX) {
myS2 = aCopyS1;
myS1 = aCopyS2;
PerformVertex();
myCompleted = Standard_True;
myS1 = aCopyS1;
myS2 = aCopyS2;
return;
}
Standard_Boolean aContains1 = Standard_False;
Standard_Boolean aContains2 = Standard_False;
TopExp_Explorer anExp(myS1, TopAbs_FACE);
aContains1 = anExp.More();
anExp.Init(myS2, TopAbs_FACE);
aContains2 = anExp.More();
if(aContains1 && aContains2) {
if(myS1.ShapeType() == TopAbs_FACE) {
BRep_Builder aBld;
TopoDS_Shape aCmp;
aBld.MakeCompound(TopoDS::Compound(aCmp));
aBld.Add(aCmp, myS1);
myS1 = aCmp;
}
if(myS2.ShapeType() == TopAbs_FACE) {
BRep_Builder aBld;
TopoDS_Shape aCmp;
aBld.MakeCompound(TopoDS::Compound(aCmp));
aBld.Add(aCmp, myS2);
myS2 = aCmp;
}
mySubst.Clear();
PerformSDFaces();
if(!myShape.IsNull()) {
TopoDS_Iterator anIter(myShape);
if(anIter.More()) {
myS1 = anIter.Value();
anIter.Next();
myS2 = anIter.Value();
}
aResult = myShape;
myShape.Nullify();
}
mySubst.Clear();
PerformShell();
if(!myShape.IsNull()) {
TopoDS_Iterator anIter(myShape);
if(anIter.More()) {
myS1 = anIter.Value();
anIter.Next();
myS2 = anIter.Value();
}
aResult = myShape;
myShape.Nullify();
}
}
if(aContains1 || aContains2) {
BRep_Builder aBld;
TopoDS_Shape aS1, aS2;
TopoDS_Shape aCpS1 = myS1, aCpS2 = myS2;
aBld.MakeCompound(TopoDS::Compound(aS1));
aBld.MakeCompound(TopoDS::Compound(aS2));
anExp.Init(myS1, TopAbs_WIRE, TopAbs_FACE);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS1, TopAbs_EDGE, TopAbs_WIRE);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS2, TopAbs_WIRE, TopAbs_FACE);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS2, anExp.Current());
}
anExp.Init(myS2, TopAbs_EDGE, TopAbs_WIRE);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS2, anExp.Current());
}
TopoDS_Iterator anIt1(aS1);
TopoDS_Iterator anIt2(aS2);
Standard_Boolean aShellWire = Standard_False;
if(anIt1.More() && anIt2.More()) {
aShellWire = Standard_True;
myS1 = aS1;
myS2 = aS2;
mySubst.Clear();
PerformWires();
myS1 = aCpS1;
myS2 = aCpS2;
if(!myShape.IsNull()) {
aS2 = myShape;
aS1.Nullify();
aBld.MakeCompound(TopoDS::Compound(aS1));
}
else {
for(; anIt1.More(); anIt1.Next()) aBld.Add(aS2, anIt1.Value());
aS1.Nullify();
aBld.MakeCompound(TopoDS::Compound(aS1));
}
}
else if(anIt1.More()) {
aShellWire = Standard_True;
aS2 = aS1;
aS1.Nullify();
aBld.MakeCompound(TopoDS::Compound(aS1));
}
else if(anIt2.More()) {
aShellWire = Standard_True;
}
if(aShellWire) {
if(aContains1) {
anExp.Init(myS1, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS1, TopAbs_SOLID, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS1, TopAbs_SHELL, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS1, TopAbs_FACE, TopAbs_SHELL);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
}
if(aContains2) {
anExp.Init(myS2, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS2, TopAbs_SOLID, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS2, TopAbs_SHELL, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
anExp.Init(myS2, TopAbs_FACE, TopAbs_SHELL);
for(; anExp.More(); anExp.Next()) {
aBld.Add(aS1, anExp.Current());
}
}
myS1 = aS1;
myS2 = aS2;
mySubst.Clear();
PerformShellWire();
if(!myShape.IsNull()) {
aResult = myShape;
}
}
}
if(!aContains1 && !aContains2) {
mySubst.Clear();
PerformWires();
if(!myShape.IsNull()) {
aResult = myShape;
}
}
myS1 = aCopyS1;
myS2 = aCopyS2;
myShape = RemoveCompounds(aResult);
if(myShape.IsNull()) NotDone();
myCompleted = Standard_True;
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape&
QANewModTopOpe_Glue::Generated (const TopoDS_Shape& theS)
{
if (IsDone() && (myMapGener.IsBound(theS) || myMapModif.IsBound(theS))) {
TopTools_ListIteratorOfListOfShape anItl;
if(myMapGener.IsBound(theS)) anItl.Initialize(myMapGener(theS));
TopTools_ListIteratorOfListOfShape anItl1;
myGenerated.Clear();
Standard_Boolean aNonEmpty = Standard_False;
TopTools_ListOfShape aL1, aL;
for(; anItl.More(); anItl.Next()) aL.Append(anItl.Value());
TopTools_MapOfShape aMapModif;
anItl.Initialize(Modified(theS));
for(; anItl.More(); anItl.Next()) aMapModif.Add(anItl.Value());
myGenerated.Clear();
anItl.Initialize(myMapModif(theS));
for(; anItl.More(); anItl.Next()) {
if(!aMapModif.Contains(anItl.Value())) {
aL.Append(anItl.Value());
}
}
do
{
aNonEmpty = Standard_False;
anItl.Initialize(aL);
for(; anItl.More(); anItl.Next()) {
if(myMapGener.IsBound(anItl.Value())) {
aNonEmpty = Standard_True;
anItl1.Initialize(myMapGener(anItl.Value()));
for(; anItl1.More(); anItl1.Next()) {
if(!anItl.Value().IsSame(anItl1.Value())) aL1.Append(anItl1.Value());
}
}
else {
if(myMapModif.IsBound(anItl.Value())) {
aNonEmpty = Standard_True;
anItl1.Initialize(myMapModif(anItl.Value()));
for(; anItl1.More(); anItl1.Next()) {
if(!anItl.Value().IsSame(anItl1.Value())) aL1.Append(anItl1.Value());
}
}
else {
if(!aMapModif.Contains(anItl.Value())) myGenerated.Append(anItl.Value());
}
}
}
if(!aL1.IsEmpty()) {
aL.Clear();
aL.Append(aL1);
aL1.Clear();
}
else aNonEmpty = Standard_False;
}
while (aNonEmpty);
return myGenerated;
}
myGenerated.Clear();
return myGenerated;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape&
QANewModTopOpe_Glue::Modified (const TopoDS_Shape& theS)
{
if (IsDone() && myMapModif.IsBound(theS)) {
TopTools_ListIteratorOfListOfShape anItl(myMapModif(theS));
TopTools_ListIteratorOfListOfShape anItl1;
myGenerated.Clear();
Standard_Boolean aNonEmpty = Standard_False;
TopTools_ListOfShape aL1, aL;
for(; anItl.More(); anItl.Next()) aL.Append(anItl.Value());
myGenerated.Clear();
do
{
aNonEmpty = Standard_False;
anItl.Initialize(aL);
for(; anItl.More(); anItl.Next()) {
if(myMapModif.IsBound(anItl.Value())) {
aNonEmpty = Standard_True;
anItl1.Initialize(myMapModif(anItl.Value()));
for(; anItl1.More(); anItl1.Next()) {
if(!anItl.Value().IsSame(anItl1.Value())) aL1.Append(anItl1.Value());
}
}
else {
myGenerated.Append(anItl.Value());
}
}
if(!aL1.IsEmpty()) {
aL.Clear();
aL.Append(aL1);
aL1.Clear();
}
else aNonEmpty = Standard_False;
}
while (aNonEmpty);
return myGenerated;
}
myGenerated.Clear();
return myGenerated;
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean
QANewModTopOpe_Glue::IsDeleted (const TopoDS_Shape& theS)
{
if (IsDone() && myMapModif.IsBound(theS)) {
const TopTools_ListOfShape &aList = myMapModif.Find(theS);
if (aList.IsEmpty())
return Standard_True;
TopTools_ListIteratorOfListOfShape anIter(aList);
for (; anIter.More(); anIter.Next()) {
const TopoDS_Shape &aSplit = anIter.Value();
if (!IsDeleted(aSplit))
return Standard_False;
}
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean
QANewModTopOpe_Glue::HasGenerated () const
{
if (IsDone() && myMapGener.Extent() > 0)
return Standard_True;
return Standard_False;
}
//=======================================================================
//function : HasModified
//purpose :
//=======================================================================
Standard_Boolean
QANewModTopOpe_Glue::HasModified () const
{
if (IsDone() && myMapModif.Extent() > 0) {
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape anIter(myMapModif);
for(; anIter.More(); anIter.Next()) {
if(anIter.Value().Extent() > 0) return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean
QANewModTopOpe_Glue::HasDeleted () const
{
if (IsDone() && myMapModif.Extent() > 0) {
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape anIter(myMapModif);
for(; anIter.More(); anIter.Next()) {
if(anIter.Value().Extent() == 0) return Standard_True;
}
}
return Standard_False;
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : skv Date : 6-05-2003
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! msv ! Creation ! 3-05-2001! 3.0-00-3!
// ! skv ! Add gluing Solid-Solid operation ! 5-05-2001! 3.0-00-3!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
// +---------------------------------------------------------------------------+
//
// @@SDM: end

View File

@@ -0,0 +1,620 @@
// File: QANewModTopOpe_Glue_solid.cxx
// Created: Sat May 5 09:55:59 2001
// Author: Sergey KHROMOV <skv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2001
const static char sccsid[] = "@(#) QANewModTopOpe_Glue_SDFaces.cxx 4.2-3, 01/07/04@(#)";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! pat ! fix for 4086 ! 01/07/04! 4.2-3!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe_Glue.ixx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopExp.hxx>
#include <QANewModTopOpe_Tools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomProjLib.hxx>
#include <Precision.hxx>
#include <BRepAdaptor_Surface.hxx>
static Standard_Boolean isAnalitic(const TopoDS_Shape &theShape)
{
if (theShape.ShapeType() != TopAbs_FACE)
return Standard_False;
TopoDS_Face aFace = TopoDS::Face(theShape);
BRepAdaptor_Surface aSurf(aFace);
Standard_Boolean isAna = Standard_False;
switch (aSurf.GetType()) {
case GeomAbs_Plane :
case GeomAbs_Cylinder :
case GeomAbs_Cone :
case GeomAbs_Sphere :
case GeomAbs_Torus :
isAna = Standard_True;
break;
default:
isAna = Standard_False;
}
return isAna;
}
static void DoPCurveOnF(const TopoDS_Edge &theEdge, const TopoDS_Face &theFace)
{
BRep_Builder aBuilder;
TopLoc_Location aCLoc;
TopLoc_Location aSLoc;
Standard_Real aF;
Standard_Real aL;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aCLoc, aF, aL);
Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, aF, aL);
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace, aSLoc);
TopLoc_Location aCTLoc = aSLoc.Inverted().Multiplied(aCLoc);
aTrCurve->Transform(aCTLoc.Transformation());
Handle(Geom2d_Curve) aCurve2d = GeomProjLib::Curve2d (aTrCurve, aSurface);
aBuilder.UpdateEdge(theEdge, aCurve2d, aSurface,
aSLoc, Precision::Confusion());
}
static TopoDS_Face GetAdjacentFace
(const TopoDS_Shape &theEdge,
const TopoDS_Shape &theFace,
const TopTools_IndexedDataMapOfShapeListOfShape &theAncMap)
{
TopoDS_Face aFace;
if (theAncMap.Contains(theEdge)) {
const TopTools_ListOfShape &aLOfFaces =
theAncMap.FindFromKey(theEdge);
TopTools_ListIteratorOfListOfShape anIter(aLOfFaces);
for (; anIter.More(); anIter.Next()) {
const TopoDS_Shape &aLocalFace = anIter.Value();
if (!theFace.IsSame(aLocalFace)) {
aFace = TopoDS::Face(aLocalFace);
break;
}
}
}
return aFace;
}
//=======================================================================
//function : SubstitudeSDFaces
//purpose :
//=======================================================================
Standard_Boolean QANewModTopOpe_Glue::SubstitudeSDFaces
(const TopoDS_Shape &theFirstSDFace,
const TopoDS_Shape &theSecondSDFace,
TopoDS_Shape &theNewSolid1,
TopoDS_Shape &theNewSolid2,
TopTools_DataMapOfShapeListOfShape &theMapOfChangedFaces)
{
// If the first face is already splited, we use its splits
// to recursively call this function.
if (theMapOfChangedFaces.IsBound(theFirstSDFace)) {
const TopTools_ListOfShape &aLocalList =
theMapOfChangedFaces(theFirstSDFace);
TopTools_ListIteratorOfListOfShape anIter(aLocalList);
for (;anIter.More(); anIter.Next()) {
const TopoDS_Shape &aNewShape = anIter.Value();
if (!SubstitudeSDFaces(aNewShape, theSecondSDFace,
theNewSolid1, theNewSolid2,
theMapOfChangedFaces))
return Standard_False;
}
return Standard_True;
}
// If the second face is already splited, we use its splits
// to recursively call this function.
if (theMapOfChangedFaces.IsBound(theSecondSDFace)) {
const TopTools_ListOfShape &aLocalList =
theMapOfChangedFaces(theSecondSDFace);
TopTools_ListIteratorOfListOfShape anIter(aLocalList);
for (;anIter.More(); anIter.Next()) {
const TopoDS_Shape &aNewShape = anIter.Value();
if (!SubstitudeSDFaces(theFirstSDFace, aNewShape,
theNewSolid1, theNewSolid2,
theMapOfChangedFaces))
return Standard_False;
}
return Standard_True;
}
// If neither the first face nor the second one were
// splited before, we begin calculation:
TopTools_IndexedDataMapOfShapeListOfShape aHistory;
Standard_Boolean isCommonFound;
if (!QANewModTopOpe_Tools::BoolOpe(theFirstSDFace.Oriented(TopAbs_FORWARD),
theSecondSDFace.Oriented(TopAbs_FORWARD),
isCommonFound, aHistory))
return Standard_False;
if (!isCommonFound)
return Standard_True;
TopTools_IndexedDataMapOfShapeListOfShape anAncMap1;
TopTools_IndexedDataMapOfShapeListOfShape anAncMap2;
TopExp::MapShapesAndAncestors(theNewSolid1, TopAbs_EDGE,
TopAbs_FACE, anAncMap1);
TopExp::MapShapesAndAncestors(theNewSolid2, TopAbs_EDGE,
TopAbs_FACE, anAncMap2);
// Creation of a compound of old solids.
// The substitution operation will be built with this
// compound.
BRep_Builder aBuilder;
TopoDS_Compound aCompound;
aBuilder.MakeCompound(aCompound);
aBuilder.Add(aCompound, theNewSolid1);
aBuilder.Add(aCompound, theNewSolid2);
// Substitution of updated sub-shapes of the first solid.
BRepTools_Substitution aSubstTool;
Standard_Integer aNbModifShape = aHistory.Extent();
Standard_Integer i;
for (i = 1; i <= aNbModifShape; i++) {
TopTools_ListOfShape aModifShapes;
const TopoDS_Shape &anAncestor = aHistory.FindKey(i);
TopTools_ListIteratorOfListOfShape anIter(aHistory.FindFromIndex(i));
if (anAncestor.IsSame(theSecondSDFace)) {
for (; anIter.More(); anIter.Next())
aModifShapes.Append(anIter.Value());
} else {
for (; anIter.More(); anIter.Next())
aModifShapes.Append(anIter.Value().Oriented(TopAbs_FORWARD));
}
if (anAncestor.ShapeType() == TopAbs_EDGE) {
// Check if the edges from common contain pcurves on both shapes.
// If they do not, create them.
TopoDS_Edge anAncEdge = TopoDS::Edge(anAncestor);
if (anAncMap1.Contains(anAncestor)) {
TopoDS_Face aFace = GetAdjacentFace(anAncestor, theFirstSDFace,
anAncMap1);
if(!aFace.IsNull()) {//added to fix 4086
Standard_Real aFirst;
Standard_Real aLast;
anIter.Initialize(aHistory.FindFromIndex(i));
for (; anIter.More(); anIter.Next()) {
TopoDS_Edge aSplit = TopoDS::Edge(anIter.Value());
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface
(aSplit, aFace, aFirst, aLast);
if (aPCurve.IsNull())
DoPCurveOnF(aSplit, aFace);
}
}
}
if (anAncMap2.Contains(anAncestor)) {
TopoDS_Face aFace = GetAdjacentFace(anAncestor, theSecondSDFace,
anAncMap2);
if(!aFace.IsNull()) {//added to fix 4086
Standard_Real aFirst;
Standard_Real aLast;
anIter.Initialize(aHistory.FindFromIndex(i));
for (; anIter.More(); anIter.Next()) {
TopoDS_Edge aSplit = TopoDS::Edge(anIter.Value());
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface
(aSplit, aFace, aFirst, aLast);
if (aPCurve.IsNull())
DoPCurveOnF(aSplit, aFace);
}
}
}
}
//--------------------------------------------------------------
if (!myMapModif.IsBound(anAncestor))
myMapModif.Bind(anAncestor, aModifShapes);
//--------------------------------------------------------------
aSubstTool.Substitute(anAncestor, aModifShapes);
}
aSubstTool.Build(aCompound);
// Update the map theMapOfChangedFaces and
// obtain a new solid from the first one.
if (aSubstTool.IsCopied(theNewSolid1)) {
// Add changed faces of the first solid to theMapOfChangedFaces:
TopExp_Explorer anExp(theNewSolid1, TopAbs_FACE);
for (; anExp.More(); anExp.Next()) {
// For each face from solid
const TopoDS_Shape &aFace = anExp.Current();
if (aSubstTool.IsCopied(aFace)) {
const TopTools_ListOfShape &aList = aSubstTool.Copy(aFace);
TopTools_ListOfShape aNewList;
if (!theMapOfChangedFaces.IsBound(aFace))
theMapOfChangedFaces.Bind(aFace, aNewList);
TopTools_ListIteratorOfListOfShape anIter(aList);
for (; anIter.More(); anIter.Next()) {
TopoDS_Shape aLocalFace = anIter.Value();
if (aSubstTool.IsCopied(aLocalFace))
aLocalFace = aSubstTool.Copy(aLocalFace).First();
theMapOfChangedFaces(aFace).Append(aLocalFace);
}
}
}
// Obtain a new solid.
theNewSolid1 = aSubstTool.Copy(theNewSolid1).First();
}
// Update the map theMapOfChangedFaces and
// obtain a new solid from the second one.
if (aSubstTool.IsCopied(theNewSolid2)) {
// Add changed faces of the second solid to theMapOfChangedFaces:
TopExp_Explorer anExp(theNewSolid2, TopAbs_FACE);
for (; anExp.More(); anExp.Next()) {
// For each face from solid
const TopoDS_Shape &aFace = anExp.Current();
if (aSubstTool.IsCopied(aFace)) {
const TopTools_ListOfShape &aList = aSubstTool.Copy(aFace);
TopTools_ListOfShape aNewList;
if (!theMapOfChangedFaces.IsBound(aFace))
theMapOfChangedFaces.Bind(aFace, aNewList);
TopTools_ListIteratorOfListOfShape anIter(aList);
for (; anIter.More(); anIter.Next()) {
TopoDS_Shape aLocalFace = anIter.Value();
if (aSubstTool.IsCopied(aLocalFace))
aLocalFace = aSubstTool.Copy(aLocalFace).First();
theMapOfChangedFaces(aFace).Append(aLocalFace);
}
}
}
// Obtain a new solid.
theNewSolid2 = aSubstTool.Copy(theNewSolid2).First();
}
return Standard_True;
}
//=======================================================================
//function : PerformSolidSolid
//purpose :
//=======================================================================
void
QANewModTopOpe_Glue::PerformSDFaces()
{
TopExp_Explorer anExp;
TopoDS_Shape aS1, aS2;
Standard_Boolean aWire1 = Standard_False, aWire2 = Standard_False;
anExp.Init(myS1, TopAbs_WIRE, TopAbs_FACE);
if(anExp.More()) {
aS1 = myS1;
aWire1 = Standard_True;
}
else {
anExp.Init(myS1, TopAbs_EDGE, TopAbs_WIRE);
if(anExp.More()) {
aS1 = myS1;
aWire1 = Standard_True;
}
}
anExp.Init(myS2, TopAbs_WIRE, TopAbs_FACE);
if(anExp.More()) {
aS2 = myS2;
aWire2 = Standard_True;
}
else {
anExp.Init(myS2, TopAbs_EDGE, TopAbs_WIRE);
if(anExp.More()) {
aS2 = myS2;
aWire2 = Standard_True;
}
}
if(aWire1) {
BRep_Builder aBld;
myS1.Nullify();
aBld.MakeCompound(TopoDS::Compound(myS1));
anExp.Init(aS1, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS1, anExp.Current());
}
anExp.Init(aS1, TopAbs_SOLID, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS1, anExp.Current());
}
anExp.Init(aS1, TopAbs_SHELL, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS1, anExp.Current());
}
anExp.Init(aS1, TopAbs_FACE, TopAbs_SHELL);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS1, anExp.Current());
}
}
if(aWire2) {
BRep_Builder aBld;
myS2.Nullify();
aBld.MakeCompound(TopoDS::Compound(myS2));
anExp.Init(aS2, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS2, anExp.Current());
}
anExp.Init(aS2, TopAbs_SOLID, TopAbs_COMPSOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS2, anExp.Current());
}
anExp.Init(aS2, TopAbs_SHELL, TopAbs_SOLID);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS2, anExp.Current());
}
anExp.Init(aS2, TopAbs_FACE, TopAbs_SHELL);
for(; anExp.More(); anExp.Next()) {
aBld.Add(myS2, anExp.Current());
}
}
BRepAlgoAPI_BooleanOperation::Build();
if (!BuilderCanWork())
return;
if(aWire1) myS1 = aS1;
if(aWire2) myS2 = aS2;
myShape.Nullify();
TopoDS_Shape aNewShape1 = myS1;
TopoDS_Shape aNewShape2 = myS2;
TopTools_DataMapOfShapeListOfShape theMapOfChangedFaces;
Standard_Boolean aHasSDF = Standard_False;
anExp.Init(myS1, TopAbs_FACE);
for (; anExp.More(); anExp.Next()) {
TopoDS_Shape aFirstFace = anExp.Current();
if (!isAnalitic(aFirstFace))
continue;
if (QANewModTopOpe_Tools::HasSameDomain(myDSFiller, aFirstFace)) {
if(!aHasSDF) aHasSDF = Standard_True;
TopTools_ListOfShape aLOfSDFace;
TopTools_ListIteratorOfListOfShape anIter;
QANewModTopOpe_Tools::SameDomain(myDSFiller, aFirstFace, aLOfSDFace);
anIter.Initialize(aLOfSDFace);
for(; anIter.More(); anIter.Next()) {
TopoDS_Shape aSecondFace = anIter.Value();
if (!isAnalitic(aSecondFace))
continue;
if (!SubstitudeSDFaces(aFirstFace, aSecondFace,
aNewShape1, aNewShape2,
theMapOfChangedFaces))
return;
}
}
}
if(myS1.IsSame(aNewShape1) && myS2.IsSame(aNewShape2)) return;
if(aHasSDF) {
BRep_Builder aBuilder;
// aBuilder.MakeCompSolid(TopoDS::CompSolid(myShape));
aBuilder.MakeCompound(TopoDS::Compound(myShape));
aBuilder.Add(myShape, aNewShape1);
aBuilder.Add(myShape, aNewShape2);
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape anIter(theMapOfChangedFaces);
for(; anIter.More(); anIter.Next()) {
myMapModif.Bind(anIter.Key(), anIter.Value());
}
//--------------- creation myMapGener for common faces
TopExp_Explorer anExp1, anExp2;
TopTools_MapOfShape aM;
anExp1.Init(aNewShape1, TopAbs_FACE);
for(; anExp1.More(); anExp1.Next()) {
const TopoDS_Shape& aF1 = anExp1.Current();
anExp2.Init(aNewShape2, TopAbs_FACE);
for(; anExp2.More(); anExp2.Next()) {
const TopoDS_Shape& aF2 = anExp2.Current();
if(aF1.IsSame(aF2)) {
aM.Add(aF1);
}
}
}
anIter.Initialize(myMapModif);
TopTools_ListIteratorOfListOfShape anI1;
TopTools_MapIteratorOfMapOfShape anI2;
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& aS = anIter.Key();
if(aS.ShapeType() == TopAbs_FACE) {
anI1.Initialize(anIter.Value());
for(; anI1.More(); anI1.Next()) {
const TopoDS_Shape& aSS1 = anI1.Value();
anI2.Initialize(aM);
for(; anI2.More(); anI2.Next()) {
const TopoDS_Shape& aSS2 = anI2.Key();
if(aSS1.IsSame(aSS2)) {
if(!myMapGener.IsBound(aS)) {
// for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aS, TopTools_ListOfShape());
TopTools_ListOfShape aListOfShape1;
myMapGener.Bind(aS, aListOfShape1);
}
myMapGener(aS).Append(aSS1);
myMapModif(aS).Remove(anI1);
}
}
if(!anI1.More()) break;
}
}
// if(anIter.Value().Extent() == 0) myMapModif.UnBind(aS);
}
//--------------- creation myMapGener for common edges
aM.Clear();
anExp1.Init(aNewShape1, TopAbs_EDGE);
for(; anExp1.More(); anExp1.Next()) {
const TopoDS_Shape& anE1 = anExp1.Current();
if(aM.Contains(anE1)) continue;
anExp2.Init(aNewShape2, TopAbs_EDGE);
for(; anExp2.More(); anExp2.Next()) {
const TopoDS_Shape& anE2 = anExp2.Current();
if(aM.Contains(anE2)) continue;
if(anE1.IsSame(anE2)) {
aM.Add(anE1);
}
}
}
anIter.Initialize(myMapModif);
TopTools_MapOfShape aComVerMap;
TopTools_MapOfShape aLocVerMap;
anExp1.Init(myS1, TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) aComVerMap.Add(anExp1.Current());
anExp1.Init(myS2, TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) aComVerMap.Add(anExp1.Current());
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& aS = anIter.Key();
if(aS.ShapeType() == TopAbs_EDGE) {
aLocVerMap.Clear();
anI1.Initialize(anIter.Value());
for(; anI1.More(); anI1.Next()) {
const TopoDS_Shape& aSS1 = anI1.Value();
anI2.Initialize(aM);
for(; anI2.More(); anI2.Next()) {
const TopoDS_Shape& aSS2 = anI2.Key();
if(aSS1.IsSame(aSS2)) {
if(!aS.IsSame(aSS1)) {
if(!myMapGener.IsBound(aS)) {
// for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aS, TopTools_ListOfShape());
TopTools_ListOfShape aListOfShape2;
myMapGener.Bind(aS, aListOfShape2);
}
myMapGener(aS).Append(aSS1);
TopoDS_Vertex aV1, aV2;
TopExp::Vertices(TopoDS::Edge(aSS1), aV1, aV2);
if(!aComVerMap.Contains(aV1)) {
if(aLocVerMap.Add(aV1)) {
myMapGener(aS).Append(aV1);
}
}
if(!aComVerMap.Contains(aV2)) {
if(aLocVerMap.Add(aV2)) {
myMapGener(aS).Append(aV2);
}
}
myMapModif(aS).Remove(anI1);
}
else {
myMapModif.UnBind(aS);
}
}
}
if(!anI1.More()) break;
}
}
// if(anIter.Value().Extent() == 0) myMapModif.UnBind(aS);
}
// Deleted vertices
anExp1.Init(myShape, TopAbs_VERTEX);
for(; anExp1.More(); anExp1.Next()) {
const TopoDS_Shape& aV = anExp1.Current();
aComVerMap.Remove(aV);
}
anI2.Initialize(aComVerMap);
for(; anI2.More(); anI2.Next()) {
// for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(anI2.Key(), TopTools_ListOfShape());
TopTools_ListOfShape aListOfShape3;
myMapModif.Bind(anI2.Key(), aListOfShape3);
}
Done();
}
return;
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : pat Date : 01/07/04
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! skv ! Creation ! 5-05-2001! 3.0-00-3!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
// ! pat ! fix for 4086 ! 01/07/04! 4.2-3!
// +---------------------------------------------------------------------------+
//
// @@SDM: end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,189 @@
// File: QANewModTopOpe_Glue_util.cxx
// Created: Tue Jan 16 10:00:03 2001
// Author: Michael SAZONOV <msv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2001
const static char sccsid[] = "@(#) QANewModTopOpe_Glue_util.cxx 4.0-1, 04/28/03@(#)";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! msv ! Creation !16-01-2001! 3.0-00-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe_Glue.ixx>
#include <Geom_Curve.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
//=======================================================================
//function : ProjPointOnEdge
//purpose :
//=======================================================================
Standard_Boolean
QANewModTopOpe_Glue::ProjPointOnEdge (const gp_Pnt& thePnt, const TopoDS_Edge& theEdge,
Standard_Real& thePar, Standard_Real& theDist)
{
Standard_Real aParF, aParL;
Handle(Geom_Curve) aCurv = BRep_Tool::Curve(theEdge, aParF, aParL);
GeomAPI_ProjectPointOnCurve aProjector(thePnt, aCurv, aParF, aParL);
if (aProjector.NbPoints() == 0)
return Standard_False;
thePar = aProjector.LowerDistanceParameter();
theDist = aProjector.LowerDistance();
return Standard_True;
}
//=======================================================================
//function : InsertVertexInEdge
//purpose :
//=======================================================================
void
QANewModTopOpe_Glue::InsertVertexInEdge (const TopoDS_Edge& theEdge,
const TopoDS_Vertex& theVer,
const Standard_Real thePar,
TopoDS_Edge& theNewEdge)
{
BRep_Builder aBld;
// construct new edge
TopoDS_Shape aDummy = theEdge.EmptyCopied().Oriented(TopAbs_FORWARD);
theNewEdge = TopoDS::Edge (aDummy);
Standard_Real aParF, aParL;
BRep_Tool::Range (theEdge, aParF, aParL);
aBld.Range (theNewEdge, aParF, aParL);
// add old vertices
TopoDS_Iterator aIterE (theEdge, Standard_False);
for (; aIterE.More(); aIterE.Next())
aBld.Add (theNewEdge, aIterE.Value());
// add new internal vertex
aBld.Add (theNewEdge, theVer.Oriented(TopAbs_INTERNAL));
Standard_Real aTol = Max (BRep_Tool::Tolerance(theVer),
BRep_Tool::Tolerance(theEdge));
aBld.UpdateVertex (theVer, thePar, theNewEdge, aTol);
theNewEdge.Orientation (theEdge.Orientation());
}
//=======================================================================
//function : SplitEdgeByVertex
//purpose :
//=======================================================================
void
QANewModTopOpe_Glue::SplitEdgeByVertex (const TopoDS_Edge& theEdge,
const TopoDS_Vertex& theVer,
const Standard_Real thePar,
TopTools_ListOfShape& theListE)
{
BRep_Builder aBld;
// construct 2 new edges
TopoDS_Shape aDummy1 = theEdge.EmptyCopied().Oriented(TopAbs_FORWARD);
TopoDS_Shape aDummy2 = theEdge.EmptyCopied().Oriented(TopAbs_FORWARD);
TopoDS_Edge aNewE1 = TopoDS::Edge (aDummy1);
TopoDS_Edge aNewE2 = TopoDS::Edge (aDummy2);
Standard_Real aParF, aParL;
BRep_Tool::Range (theEdge, aParF, aParL);
aBld.Range (aNewE1, aParF, thePar);
aBld.Range (aNewE2, thePar, aParL);
// add old vertices
TopoDS_Iterator aIterE (theEdge, Standard_False);
for (; aIterE.More(); aIterE.Next()) {
const TopoDS_Vertex& aVer = TopoDS::Vertex (aIterE.Value());
Standard_Real aParV = BRep_Tool::Parameter (aVer, theEdge);
if (aParV < thePar) aBld.Add (aNewE1, aVer);
else aBld.Add (aNewE2, aVer);
}
// add new vertex
aBld.Add (aNewE1, theVer.Oriented(TopAbs_REVERSED));
aBld.Add (aNewE2, theVer.Oriented(TopAbs_FORWARD));
Standard_Real aTol = Max (BRep_Tool::Tolerance(theVer),
BRep_Tool::Tolerance(theEdge));
aBld.UpdateVertex (theVer, thePar, aNewE1, aTol);
aBld.UpdateVertex (theVer, thePar, aNewE2, aTol);
theListE.Append (aNewE1.Oriented(theEdge.Orientation()));
theListE.Append (aNewE2.Oriented(theEdge.Orientation()));
}
//=======================================================================
//function : CompareVertices
//purpose :
//=======================================================================
Standard_Boolean
QANewModTopOpe_Glue::CompareVertices (const TopoDS_Vertex& theV1, const TopoDS_Vertex& theV2,
Standard_Real& theDist)
{
theDist = BRep_Tool::Pnt(theV1).Distance(BRep_Tool::Pnt(theV2));
if (theDist <= BRep_Tool::Tolerance(theV1) ||
theDist <= BRep_Tool::Tolerance(theV2))
return Standard_True;
return Standard_False;
}
//=======================================================================
//function : FindWireOrUpdateMap
//purpose :
//=======================================================================
const TopoDS_Shape&
QANewModTopOpe_Glue::FindWireOrUpdateMap (const TopoDS_Shape& theWire,
TopTools_IndexedDataMapOfShapeListOfShape& theMapELW)
{
TopoDS_Iterator aIterW (theWire);
// const TopoDS_Shape& aRefEdge = aIterW.Value();
TopoDS_Shape aRefEdge = aIterW.Value();
if (theMapELW.Contains (aRefEdge)) {
// map edges of theWire
Standard_Integer nbEdges = 0;
TopTools_MapOfShape aMapE;
for (; aIterW.More(); aIterW.Next()) {
aMapE.Add (aIterW.Value());
nbEdges++;
}
// find in the list a wire with the same set of edges
const TopTools_ListOfShape& aListW = theMapELW.FindFromKey (aRefEdge);
TopTools_ListIteratorOfListOfShape aIterLW (aListW);
for (; aIterLW.More(); aIterLW.Next()) {
const TopoDS_Shape& aWire = aIterLW.Value();
Standard_Integer nbE = 0;
for (aIterW.Initialize (aWire); aIterW.More(); aIterW.Next()) {
nbE++;
if (nbE > nbEdges || !aMapE.Contains(aIterW.Value())) break;
}
if (nbE == nbEdges && !aIterW.More())
return aWire; // found
}
}
// remember the edges of this wire in the map for further reference
for (aIterW.Initialize (theWire); aIterW.More(); aIterW.Next()) {
const TopoDS_Shape& aEdge = aIterW.Value();
if (!theMapELW.Contains (aEdge)) {
// for Mandrake-10 - mkv,02.06.06 - theMapELW.Add (aEdge, TopTools_ListOfShape());
TopTools_ListOfShape aListOfShape;
theMapELW.Add (aEdge, aListOfShape);
}
theMapELW.ChangeFromKey(aEdge).Append (theWire);
}
return theWire;
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : msv Date : 16-01-2001
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! msv ! Creation !16-01-2001! 3.0-00-2!
// +---------------------------------------------------------------------------+
// @@SDM: end

View File

@@ -0,0 +1,215 @@
// File: QANewModTopOpe_Glue_vertex.cxx
// Created: Tue Jan 16 10:00:32 2001
// Author: Michael SAZONOV <msv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2001
const static char sccsid[] = "@(#) QANewModTopOpe_Glue_vertex.cxx 4.0-2, 07/25/03@(#)";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! martin ! add glue : vertex+solid ! 07/25/03! 4.0-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe_Glue.ixx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <TopExp_Explorer.hxx>
//=======================================================================
//function : PerformVertex
//purpose :
//=======================================================================
void
QANewModTopOpe_Glue::PerformVertex()
{
BRepExtrema_DistShapeShape aExtrema (myS1, myS2);
if (!aExtrema.IsDone()) return;
if (aExtrema.InnerSolution()) {
if (myS2.ShapeType() != TopAbs_VERTEX) return;
TopoDS_Vertex aV = TopoDS::Vertex(myS2);
BRep_Builder aBld;
aBld.Add(myS1,aV.Oriented(TopAbs_INTERNAL));
TopTools_ListOfShape aList;
aList.Append (aV);
myMapGener.Bind(myS1, aList);
myShape = myS1;
myShape.Orientation(myS1.Orientation());
Done();
}
else {
Standard_Integer nbSol = aExtrema.NbSolution(), i;
Standard_Real aDist = aExtrema.Value();
TopoDS_Shape aDummy = myS2.Oriented(TopAbs_FORWARD);
TopoDS_Vertex aVer2 = TopoDS::Vertex (aDummy);
Standard_Real aTol2 = BRep_Tool::Tolerance(aVer2);
TopTools_MapOfShape aMapPassed;
aMapPassed.Add (myS2);
TopTools_IndexedDataMapOfShapeListOfShape aMapAnc;
TopExp::MapShapesAndAncestors (myS1, TopAbs_VERTEX, TopAbs_EDGE, aMapAnc);
TopExp::MapShapesAndAncestors (myS1, TopAbs_VERTEX, TopAbs_FACE, aMapAnc);
TopExp::MapShapesAndAncestors (myS1, TopAbs_EDGE, TopAbs_FACE, aMapAnc);
BRep_Builder aBld;
// pass 1: process contacted vertices
for (i=1; i <= nbSol; i++) {
TopoDS_Shape aShape = aExtrema.SupportOnShape1(i);
if (aShape.ShapeType() != TopAbs_VERTEX ||
aMapPassed.Contains(aShape)) continue;
const TopoDS_Vertex& aVer = TopoDS::Vertex (aShape);
if(aVer.IsSame(aVer2)) continue;
Standard_Real aTol1 = BRep_Tool::Tolerance(aVer);
if (aDist > aTol1 && aDist > aTol2) continue;
aTol2 = Max (aTol2, aTol1 + aDist);
aBld.UpdateVertex (aVer2, aTol2);
// substitute aVer2 instead of aVer
TopTools_ListOfShape aList;
aList.Append (aVer2);
mySubst.Substitute (aVer, aList);
aMapPassed.Add(aVer);
TopTools_ListIteratorOfListOfShape aIter(aMapAnc.FindFromKey(aVer));
for (; aIter.More(); aIter.Next()) {
aMapPassed.Add(aIter.Value());
}
myMapModif.Bind(aVer, aList);
}
// pass 2: process contacted edges
for (i=1; i <= nbSol; i++) {
TopoDS_Shape aShape = aExtrema.SupportOnShape1(i);
if (aShape.ShapeType() != TopAbs_EDGE ||
aMapPassed.Contains(aShape)) continue;
const TopoDS_Edge& aEdge = TopoDS::Edge (aShape);
Standard_Real aTol1 = BRep_Tool::Tolerance(aEdge);
if (aDist > aTol1 && aDist > aTol2) continue;
Standard_Real aPar;
aExtrema.ParOnEdgeS1(i, aPar);
// construct new edge
TopoDS_Edge aNewEdge;
InsertVertexInEdge (aEdge, aVer2, aPar, aNewEdge);
// substitute edge
TopTools_ListOfShape aList;
aList.Append (aNewEdge.Oriented(TopAbs_FORWARD));
mySubst.Substitute (aEdge, aList);
aMapPassed.Add(aEdge);
TopTools_ListIteratorOfListOfShape aIter(aMapAnc.FindFromKey(aEdge));
for (; aIter.More(); aIter.Next()) {
aMapPassed.Add(aIter.Value());
}
// for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aEdge, TopTools_ListOfShape());
TopTools_ListOfShape aList1;
myMapModif.Bind(aEdge, aList1);
myMapModif(aEdge).Append (aNewEdge);
// for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aEdge, TopTools_ListOfShape());
TopTools_ListOfShape aList2;
myMapGener.Bind(aEdge, aList2);
myMapGener(aEdge).Append (aVer2);
}
// pass 3: process contacted faces
for (i=1; i <= nbSol; i++) {
TopoDS_Shape aShape = aExtrema.SupportOnShape1(i);
if (aShape.ShapeType() != TopAbs_FACE ||
aMapPassed.Contains(aShape)) continue;
const TopoDS_Face& aFace = TopoDS::Face (aShape);
Standard_Real aTol1 = BRep_Tool::Tolerance(aFace);
if (aDist > aTol1 && aDist > aTol2) continue;
Standard_Real aParU, aParV;
aExtrema.ParOnFaceS1(i, aParU, aParV);
// construct new face
TopoDS_Face aNewFace = aFace;
aNewFace.EmptyCopy();
aNewFace.Orientation (TopAbs_FORWARD);
aBld.NaturalRestriction (aNewFace, BRep_Tool::NaturalRestriction(aFace));
// add old subshapes
TopoDS_Iterator aIterF (aFace, Standard_False);
for (; aIterF.More(); aIterF.Next()) {
aBld.Add (aNewFace, aIterF.Value());
}
// add new internal vertex
aTol2 = Max (aTol2, aTol1);
aBld.Add (aNewFace, aVer2.Oriented(TopAbs_INTERNAL));
aBld.UpdateVertex (aVer2, aParU, aParV, aNewFace, aTol2);
// substitute face
TopTools_ListOfShape aList;
aList.Append (aNewFace);
mySubst.Substitute (aFace, aList);
aMapPassed.Add(aFace);
// for Mandrake-10 - mkv,02.06.06 - myMapModif.Bind(aFace, TopTools_ListOfShape());
TopTools_ListOfShape aList3;
myMapModif.Bind(aFace, aList3);
myMapModif(aFace).Append (aNewFace);
// for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(aFace, TopTools_ListOfShape());
TopTools_ListOfShape aList4;
myMapGener.Bind(aFace, aList4);
myMapGener(aFace).Append (aVer2);
}
mySubst.Build(myS1);
TopExp_Explorer aExp (myS1, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aFace = aExp.Current();
if(myMapModif.IsBound(aFace)) continue;
if (mySubst.IsCopied(aFace)) {
if (!mySubst.Copy(aFace).IsEmpty()) {
myMapModif.Bind(aFace,mySubst.Copy(aFace));
}
}
}
aExp.Init(myS1, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& anEdge = aExp.Current();
if(myMapModif.IsBound(anEdge)) continue;
if (mySubst.IsCopied(anEdge)) {
if (!mySubst.Copy(anEdge).IsEmpty()) {
myMapModif.Bind(anEdge,mySubst.Copy(anEdge));
}
}
}
if (mySubst.IsCopied(myS1)) {
myShape = mySubst.Copy(myS1).First();
myShape.Orientation(myS1.Orientation());
Done();
}
}
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : martinbe Date : 07/25/03
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! msv ! Creation !16-01-2001! 3.0-00-2!
// ! martin ! add glue : vertex+solid ! 07/25/03! 4.0-2!
// +---------------------------------------------------------------------------+
// @@SDM: end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
-- File: QANewModTopOpe_Intersection.cdl
-- Created: Mon Dec 25 10:43:35 2000
-- Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
-- Copyright: SAMTECH S.A. 2000
-- sccsid[] = "@(#) QANewModTopOpe_Intersection.cdl 4.0-2, 07/01/03@(#)";
-- Lastly modified by :
-- +---------------------------------------------------------------------------+
-- ! ifv ! Creation !25-12-2000! 3.0-00-2!
-- ! mkk ! History correction !19-05-2003! 3.0-00-2!
-- +---------------------------------------------------------------------------+
class Intersection from QANewModTopOpe inherits BooleanOperation from BRepAlgoAPI
---Purpose: provides intersection of two shapes;
uses
Shape from TopoDS,
DataMapOfShapeListOfShape from TopTools,
ListOfShape from TopTools
is
Create(theObject1, theObject2 : Shape from TopoDS )
---Purpose:
returns Intersection from QANewModTopOpe;
Generated (me: in out; theS : Shape from TopoDS)
---Purpose: Returns the list of shapes generated from the shape <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined;
HasGenerated (me)
returns Boolean from Standard
is redefined;
---Purpose: Returns true if there is at least one generated shape.
--- For use in BRepNaming.
IsDeleted (me: in out;
aS : Shape from TopoDS)
returns Boolean
is redefined;
HasDeleted (me)
returns Boolean from Standard
is redefined;
---Purpose: Returns true if there is at least one deleted shape.
--- For use in BRepNaming.
fields
myMapGener: DataMapOfShapeListOfShape from TopTools;
end Intersection;
-- @@SDM: begin
-- Copyright SAMTECH ..........................................Version 3.0-00
-- Lastly modified by : mkk Date : 19-05-2003
-- File history synopsis (creation,modification,correction)
-- +---------------------------------------------------------------------------+
-- ! Developer ! Comments ! Date ! Version !
-- +-----------!-----------------------------------------!----------!----------+
-- ! ifv ! Creation !25-12-2000! 3.0-00-2!
-- ! mkk ! History correction !19-05-2003! 3.0-00-2!
-- ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
-- +---------------------------------------------------------------------------+
--
-- @@SDM: end

View File

@@ -0,0 +1,383 @@
// File: QANewModTopOpe_Intersection.cxx
// Created: Mon Dec 25 11:14:00 2000
// Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2000
const static char sccsid[] = "@(#) QANewModTopOpe_Intersection.cxx 4.0-2, 07/01/03@(#)";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! ifv ! Creation !25-12-2000! 3.0-00-2!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// ! mkk ! History correction !19-05-2003! 3.0-00-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe_Intersection.ixx>
#include <TopoDS.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepExtrema_SupportType.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopoDS_Vertex.hxx>
#include <gp_Pnt.hxx>
#include <BRepAlgo_EdgeConnector.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Iterator.hxx>
#include <BRepTools.hxx>
#include <BOPTools_SSIntersectionAttribute.hxx>
#include <BOPTools_DSFiller.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS_Edge.hxx>
#include <QANewModTopOpe_Tools.hxx>
static Standard_Boolean NoFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
{
TopExp_Explorer Ex;
Ex.Init(S1,TopAbs_FACE);
Standard_Boolean f1 = Ex.More();
Ex.Init(S2,TopAbs_FACE);
Standard_Boolean f2 = Ex.More();
return !f1&&!f2;
}
QANewModTopOpe_Intersection::QANewModTopOpe_Intersection( const TopoDS_Shape& theObject1,
const TopoDS_Shape& theObject2 )
: BRepAlgoAPI_BooleanOperation( theObject1, theObject2, BOP_SECTION)
{
myMapGener.Clear();
if(NoFaces(myS1, myS2)) {
BRep_Builder BB;
BB.MakeCompound(TopoDS::Compound(myShape));
BRepExtrema_DistShapeShape DSS(myS1, myS2);
if(DSS.IsDone() && DSS.NbSolution() > 0) {
Standard_Integer nbs = DSS.NbSolution();
Standard_Real mindist = DSS.Value();
Standard_Real maxtol = 0., tol;
TopExp_Explorer ExV;
for(ExV.Init(myS1,TopAbs_VERTEX); ExV.More(); ExV.Next()) {
TopoDS_Vertex Vertex=TopoDS::Vertex(ExV.Current());
tol=BRep_Tool::Tolerance(Vertex);
if(tol > maxtol) maxtol = tol;
}
for(ExV.Init(myS2,TopAbs_VERTEX); ExV.More(); ExV.Next()) {
TopoDS_Vertex Vertex=TopoDS::Vertex(ExV.Current());
tol=BRep_Tool::Tolerance(Vertex);
if(tol > maxtol) maxtol = tol;
}
if(mindist <= maxtol) {
tol = maxtol*maxtol;
Standard_Integer i;
for(i = 1; i <= nbs; i++) {
gp_Pnt p1 = DSS.PointOnShape1(i);
gp_Pnt p2 = DSS.PointOnShape2(i);
if(p1.SquareDistance(p2) > tol) continue;
BRepExtrema_SupportType aSupTyp = DSS. SupportTypeShape1(i);
if(aSupTyp == BRepExtrema_IsVertex) {
BB.Add(myShape, DSS.SupportOnShape1(i));
}
else {
aSupTyp = DSS. SupportTypeShape2(i);
if(aSupTyp == BRepExtrema_IsVertex) {
BB.Add(myShape, DSS.SupportOnShape2(i));
}
else {
gp_Pnt p(.5*(p1.XYZ()+p2.XYZ()));
BRepBuilderAPI_MakeVertex mkV(p);
BB.Add(myShape, mkV.Vertex());
if (!myMapGener.IsBound(DSS. SupportOnShape1(i))) {
// for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(DSS.SupportOnShape1(i), TopTools_ListOfShape());
TopTools_ListOfShape aListOfShape1;
myMapGener.Bind(DSS.SupportOnShape1(i), aListOfShape1);
}
myMapGener(DSS.SupportOnShape1(i)).Append(mkV.Vertex());
if (!myMapGener.IsBound(DSS.SupportOnShape2(i))) {
// for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(DSS.SupportOnShape2(i), TopTools_ListOfShape());
TopTools_ListOfShape aListOfShape2;
myMapGener.Bind(DSS.SupportOnShape2(i), aListOfShape2);
}
myMapGener(DSS.SupportOnShape2(i)).Append(mkV.Vertex());
}
}
}
}
}
Done();
return;
}
Standard_Boolean bIsNewFiller = PrepareFiller();
//
if (myErrorStatus!=1) {
// there were errors during the preparation
return;
}
//
if (bIsNewFiller) {
//Prepare the DS
BOPTools_SSIntersectionAttribute aSectionAttribute(Standard_True,
Standard_False, Standard_False);
myDSFiller->Perform(aSectionAttribute);
}
Build();
Standard_Boolean bcw = BuilderCanWork();
if ( ! bcw ) return;
BRep_Builder BB;
BB.MakeCompound(TopoDS::Compound(myShape));
TopTools_ListIteratorOfListOfShape itloe(SectionEdges());
if(itloe.More()) {
for(; itloe.More(); itloe.Next()) BB.Add(myShape,itloe.Value());
// try to make wire from set of edges
TopTools_ListOfShape LOEdge;
TopTools_ListOfShape LOSEdge;
Standard_Integer nbe = 0;
TopoDS_Shape aux;
TopExp_Explorer Ex;
BB.MakeCompound(TopoDS::Compound(aux));
for(Ex.Init(myShape,TopAbs_EDGE); Ex.More(); Ex.Next()) {
LOEdge.Append(Ex.Current());
LOSEdge.Append(Ex.Current());
nbe++;
}
BRepAlgo_EdgeConnector EC;
TopoDS_Shape se = LOEdge.First();
EC.Add(LOEdge);
EC.AddStart(LOSEdge);
const TopTools_ListOfShape& LOWire = EC.MakeBlock();
TopTools_ListIteratorOfListOfShape its;
for(its.Initialize(LOWire);its.More();its.Next()) {
BB.Add(aux,its.Value());
}
for(Ex.Init(aux,TopAbs_EDGE); Ex.More(); Ex.Next()) {
nbe--;
}
if(nbe == 0) myShape = aux;
}
else {
// check if there are new vertices - IFV
Standard_Integer nbp = QANewModTopOpe_Tools::NbPoints(myDSFiller);
if(nbp > 0) {
TopoDS_Shape aux1, aux2;
BB.MakeCompound(TopoDS::Compound(aux1));
BB.MakeCompound(TopoDS::Compound(aux2));
BB.Add(aux1, myS1);
BB.Add(aux1, myS2);
Standard_Integer i;
Standard_Real maxtol = 0., tol;
for(i = 1; i <= nbp; i++) {
TopoDS_Vertex aVertex=
TopoDS::Vertex(QANewModTopOpe_Tools::NewVertex(myDSFiller, i));
tol=BRep_Tool::Tolerance(aVertex);
if(tol > maxtol) maxtol = tol;
BB.Add(aux2, aVertex);
}
BRepExtrema_DistShapeShape DSS(aux1, aux2);
if(DSS.IsDone() && DSS.NbSolution() > 0) {
Standard_Integer nbs = DSS.NbSolution();
Standard_Real mindist = DSS.Value();
if(mindist <= maxtol) {
tol = maxtol*maxtol;
TopTools_MapOfShape aMap;
for(i = 1; i <= nbs; i++) {
gp_Pnt p1 = DSS.PointOnShape1(i);
gp_Pnt p2 = DSS.PointOnShape2(i);
if(p1.SquareDistance(p2) > tol) continue;
BRepExtrema_SupportType aSupTyp = DSS.SupportTypeShape1(i);
TopoDS_Vertex aVertex;
if(aSupTyp == BRepExtrema_IsVertex) {
aVertex = TopoDS::Vertex(DSS.SupportOnShape1(i));
TopoDS_Iterator anIter(myShape);
Standard_Boolean anIsNew = Standard_True;
for(; anIter.More(); anIter.Next()) {
if(BRepTools::Compare(aVertex, TopoDS::Vertex(anIter.Value()))) {
anIsNew = Standard_False;
break;
}
}
if(anIsNew) {
BB.Add(myShape, aVertex);
}
}
else {
aVertex = TopoDS::Vertex(DSS.SupportOnShape2(i));
if(aMap.Add(aVertex)) BB.Add(myShape, aVertex);
if (!myMapGener.IsBound(DSS.SupportOnShape1(i))) {
// for Mandrake-10 - mkv,02.06.06 - myMapGener.Bind(DSS.SupportOnShape1(i), TopTools_ListOfShape());
TopTools_ListOfShape aListOfShape3;
myMapGener.Bind(DSS.SupportOnShape1(i), aListOfShape3);
}
myMapGener(DSS.SupportOnShape1(i)).Append(aVertex);
}
} // end for
}
}
}
}
Done();
}
//=======================================================================
//function : Generated
//purpose : gives list of shape generated from shape S
//=======================================================================
const TopTools_ListOfShape& QANewModTopOpe_Intersection::Generated(const TopoDS_Shape& theS)
{
myGenerated.Clear();
if(theS.ShapeType() == TopAbs_FACE || theS.ShapeType() == TopAbs_EDGE) {
if (BRepAlgoAPI_BooleanOperation::HasGenerated()) {
const TopTools_ListOfShape &aLOfShape =
BRepAlgoAPI_BooleanOperation::Generated(theS);
TopTools_ListIteratorOfListOfShape anIter(aLOfShape);
for (; anIter.More(); anIter.Next()) {
const TopoDS_Shape &aGenShape = anIter.Value();
if (aGenShape.ShapeType() == TopAbs_VERTEX)
continue;
myGenerated.Append(aGenShape);
}
}
if(myMapGener.IsBound(theS)) {
TopTools_ListIteratorOfListOfShape anIter(myMapGener(theS));
for(; anIter.More(); anIter.Next())
myGenerated.Append(anIter.Value());
}
}
return myGenerated;
}
//=======================================================================
//function : HasGenerated
//purpose :
//=======================================================================
Standard_Boolean QANewModTopOpe_Intersection::HasGenerated() const
{
Standard_Boolean aHasGenerated = Standard_False;
if (BRepAlgoAPI_BooleanOperation::HasGenerated()) {
aHasGenerated = Standard_True;
}
else {
aHasGenerated = !myMapGener.IsEmpty();
}
return aHasGenerated;
}
//=======================================================================
//function : IsDeleted
//purpose :
//=======================================================================
Standard_Boolean QANewModTopOpe_Intersection::IsDeleted(const TopoDS_Shape& aS)
{
if(BRepAlgoAPI_BooleanOperation::IsDeleted(aS))
return Standard_True;
if(myMapGener.IsBound(aS))
return Standard_False;
return Standard_True;
}
//=======================================================================
//function : HasDeleted
//purpose :
//=======================================================================
Standard_Boolean QANewModTopOpe_Intersection::HasDeleted() const
{
Standard_Real aresult = Standard_False;
TopExp_Explorer anExp;
for(Standard_Integer argit = 0; argit < 2; argit++) {
Standard_Boolean bTillVertex = Standard_True;
if(argit == 0)
anExp.Init(myS1, TopAbs_FACE);
else
anExp.Init(myS2, TopAbs_FACE);
if(anExp.More())
bTillVertex = Standard_False;
Standard_Integer nb = (bTillVertex) ? 3 : 2;
for(Standard_Integer i = 0; i < nb; i++) {
TopAbs_ShapeEnum aType = (i == 0) ? TopAbs_FACE : ((i == 1) ? TopAbs_EDGE : TopAbs_VERTEX);
if(argit == 0)
anExp.Init(myS1, aType);
else
anExp.Init(myS2, aType);
for(; anExp.More(); anExp.Next()) {
if(!myMapGener.IsBound(anExp.Current())) {
return Standard_True;
}
}
}
}
return Standard_False;
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : mkk Date : 19-05-2003
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! ifv ! Creation !25-12-2000! 3.0-00-2!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// ! mkk ! History correction !19-05-2003! 3.0-00-2!
// ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
// +---------------------------------------------------------------------------+
//
// @@SDM: end

View File

@@ -0,0 +1,137 @@
-- File: QANewModTopOpe_Limitation.cdl
-- Created: Thu May 3 11:56:07 2001
-- Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
-- Copyright: SAMTECH S.A. 2001
-- sccsid[] = "@(#) QANewModTopOpe_Limitation.cdl 4.0-2, 07/01/03@(#)";
-- Lastly modified by :
-- +---------------------------------------------------------------------------+
-- ! ifv ! Creation ! 3-05-2001! 3.0-00-2!
-- ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
-- +---------------------------------------------------------------------------+
class Limitation from QANewModTopOpe inherits MakeShape from BRepBuilderAPI
---Purpose: provides cutting shape by face or shell;
uses
Shape from TopoDS,
ListOfShape from TopTools,
ModeOfLimitation from QANewModTopOpe,
State from TopAbs,
CutPtr from QANewModTopOpe,
CommonPtr from QANewModTopOpe
is
Create(theObjectToCut, theCutTool : Shape from TopoDS;
theMode : ModeOfLimitation from QANewModTopOpe = QANewModTopOpe_Forward)
---Purpose: initializes and fills data structure for cutting and
-- makes cutting according to orientation theCutTool and
-- theMode.
-- if theCutTool is not face or shell does nothing.
returns Limitation from QANewModTopOpe;
Cut(me : in out);
---Purpose: makes cutting according to orientation theCutTool
-- and current value of myMode. Does nothing if
-- result already exists.
SetMode(me : in out; theMode : ModeOfLimitation from QANewModTopOpe);
GetMode(me) returns ModeOfLimitation from QANewModTopOpe;
Shape1(me) returns Shape from TopoDS
---Purpose: Returns the first shape.
---C++: return const &
---Level: Public
is static;
Shape2(me) returns Shape from TopoDS
---Purpose: Returns the second shape.
---C++: return const &
---Level: Public
is static;
Modified (me: in out; S : Shape from TopoDS)
---Purpose: Returns the list of shapes modified from the shape
-- <S>.
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined;
Modified2 (me: in out;
aS : Shape from TopoDS)
returns ListOfShape from TopTools;
---Purpose: Returns the list of shapes modified from the shape <S>.
--- For use in BRepNaming.
---C++: return const &
---Level: Public
Generated (me: in out; S : Shape from TopoDS)
returns ListOfShape from TopTools
is redefined;
---Purpose: Returns the list of shapes generated from the shape <S>.
--- For use in BRepNaming.
---C++: return const &
HasModified (me)
returns Boolean from Standard
is virtual;
---Purpose: Returns true if there is at least one modified shape.
--- For use in BRepNaming.
HasGenerated (me)
returns Boolean from Standard
is virtual;
---Purpose: Returns true if there is at least one generated shape.
--- For use in BRepNaming.
HasDeleted (me)
returns Boolean from Standard
is virtual;
---Purpose: Returns true if there is at least one deleted shape.
--- For use in BRepNaming.
IsDeleted (me: in out; S : Shape from TopoDS)
returns Boolean from Standard
is redefined;
Delete(me : in out) is redefined;
---C++: alias "Standard_EXPORT ~QANewModTopOpe_Limitation() {Delete();}"
fields
myResultFwd : Shape from TopoDS;
myResultRvs : Shape from TopoDS;
myObjectToCut : Shape from TopoDS;
myCutTool : Shape from TopoDS;
myCut : CutPtr from QANewModTopOpe;
myCommon : CommonPtr from QANewModTopOpe;
myFwdIsDone : Boolean from Standard;
myRevIsDone : Boolean from Standard;
myMode : ModeOfLimitation from QANewModTopOpe;
end Limitation;
-- @@SDM: begin
-- Copyright SAMTECH ..........................................Version 3.0-00
-- Lastly modified by : skv Date : 6-05-2003
-- File history synopsis (creation,modification,correction)
-- +---------------------------------------------------------------------------+
-- ! Developer ! Comments ! Date ! Version !
-- +-----------!-----------------------------------------!----------!----------+
-- ! ifv ! Creation ! 3-05-2001! 3.0-00-2!
-- ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
-- ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
-- +---------------------------------------------------------------------------+
--
-- @@SDM: end

View File

@@ -0,0 +1,349 @@
// File: QANewModTopOpe_Limitation.cxx
// Created: Sat May 6 14:24:19 2001
// Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2000
const static char sccsid[] = "@(#) QANewModTopOpe_Limitation.cxx 4.0-2, 07/01/03@(#)";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! ifv ! Creation ! 6-05-2001! 3.0-00-3!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe_Limitation.ixx>
#include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopAbs.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepAlgoAPI_Common.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Standard_ConstructionError.hxx>
#include <TopTools_MapOfShape.hxx>
static TopoDS_Shape MakeCutTool(const TopoDS_Shape& theS2)
{
TopoDS_Shape aRealCutTool, aSh;
BRep_Builder aBB;
aBB.MakeSolid(TopoDS::Solid(aRealCutTool));
aBB.MakeShell(TopoDS::Shell(aSh));
TopExp_Explorer anExp;
anExp.Init(theS2,TopAbs_FACE);
for(; anExp.More(); anExp.Next()) aBB.Add(aSh, anExp.Current());
aBB.Add(aRealCutTool, aSh);
return aRealCutTool;
}
QANewModTopOpe_Limitation::QANewModTopOpe_Limitation(const TopoDS_Shape& theObjectToCut,
const TopoDS_Shape& theCutTool,
const QANewModTopOpe_ModeOfLimitation theMode) :
myObjectToCut(theObjectToCut),
myFwdIsDone(Standard_False),
myRevIsDone(Standard_False),
myMode(theMode),
myCut(NULL),
myCommon(NULL)
{
TopExp_Explorer anExp;
anExp.Init(theCutTool,TopAbs_FACE);
if(!anExp.More()) return;
myCutTool = MakeCutTool(theCutTool);
Cut();
}
void QANewModTopOpe_Limitation::Cut()
{
NotDone();
if(myMode == QANewModTopOpe_Forward) {
if(!myFwdIsDone) {
myCut = new BRepAlgoAPI_Cut(myObjectToCut, myCutTool);
if(myCut->IsDone()) {
myResultFwd = myCut->Shape();
myFwdIsDone = Standard_True;
}
}
if(myFwdIsDone) {
myShape = myResultFwd;
Done();
}
}
else if (myMode == QANewModTopOpe_Reversed) {
if(!myRevIsDone) {
myCommon = new BRepAlgoAPI_Common(myObjectToCut, myCutTool);
if(myCommon->IsDone()) {
myResultRvs = myCommon->Shape();
myRevIsDone = Standard_True;
}
}
if(myRevIsDone) {
myShape = myResultRvs;
Done();
}
}
else if (myMode == QANewModTopOpe_BothParts) {
if(!myFwdIsDone) {
myCut = new BRepAlgoAPI_Cut(myObjectToCut, myCutTool);
if(myCut->IsDone()) {
myResultFwd = myCut->Shape();
myFwdIsDone = Standard_True;
}
}
if(!myRevIsDone) {
myCommon = new BRepAlgoAPI_Common(myObjectToCut, myCutTool);
if(myCommon->IsDone()) {
myResultRvs = myCommon->Shape();
myRevIsDone = Standard_True;
}
}
if(myFwdIsDone && myRevIsDone) {
myShape.Nullify();
BRep_Builder aBB;
aBB.MakeCompound(TopoDS::Compound(myShape));
TopoDS_Iterator aItr;
aItr.Initialize(myResultFwd, Standard_False, Standard_False);
for(; aItr.More(); aItr.Next()) aBB.Add(myShape, aItr.Value());
aItr.Initialize(myResultRvs, Standard_False, Standard_False);
for(; aItr.More(); aItr.Next()) aBB.Add(myShape, aItr.Value());
Done();
}
}
else {
Standard_ConstructionError::Raise("QANewModTopOpe_Limitation : wrong mode");
}
}
void QANewModTopOpe_Limitation::SetMode(const QANewModTopOpe_ModeOfLimitation theMode)
{
myMode = theMode;
}
QANewModTopOpe_ModeOfLimitation QANewModTopOpe_Limitation::GetMode() const
{
return myMode;
}
const TopoDS_Shape& QANewModTopOpe_Limitation::Shape1() const
{
return myObjectToCut;
}
const TopoDS_Shape& QANewModTopOpe_Limitation::Shape2() const
{
return myCutTool;
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& QANewModTopOpe_Limitation::Modified(const TopoDS_Shape& S)
{
Check();
myGenerated.Clear();
if(myMode == QANewModTopOpe_Forward) {
myGenerated = myCut->Modified(S);
}
else if(myMode == QANewModTopOpe_Reversed) {
myGenerated = myCommon->Modified(S);
}
else {
myGenerated = myCut->Modified(S);
TopTools_MapOfShape aMap; // to check if shape can be added in list more then one time
TopTools_ListIteratorOfListOfShape It(myGenerated);
for(;It.More();It.Next()) {
aMap.Add(It.Value());
}
It.Initialize(myCommon->Modified(S));
for(;It.More();It.Next()) {
if(aMap.Add(It.Value())) myGenerated.Append(It.Value());
}
}
return myGenerated;
}
// ================================================================================================
// function: Modified2
// purpose:
// ================================================================================================
const TopTools_ListOfShape& QANewModTopOpe_Limitation::Modified2(const TopoDS_Shape& aS)
{
Check();
myGenerated.Clear();
if(myMode == QANewModTopOpe_Forward) {
myGenerated = myCut->Modified2(aS);
}
else if(myMode == QANewModTopOpe_Reversed) {
myGenerated = myCommon->Modified2(aS);
}
else {
myGenerated = myCut->Modified2(aS);
TopTools_MapOfShape aMap; // to check if shape can be added in list more then one time
TopTools_ListIteratorOfListOfShape It(myGenerated);
for(;It.More();It.Next()) {
aMap.Add(It.Value());
}
It.Initialize(myCommon->Modified2(aS));
for(;It.More();It.Next()) {
if(aMap.Add(It.Value())) myGenerated.Append(It.Value());
}
}
return myGenerated;
}
// ================================================================================================
// function: Generated
// purpose:
// ================================================================================================
const TopTools_ListOfShape& QANewModTopOpe_Limitation::Generated(const TopoDS_Shape& S)
{
Check();
myGenerated.Clear();
if(myMode == QANewModTopOpe_Forward) {
myGenerated = myCut->Generated(S);
}
else if(myMode == QANewModTopOpe_Reversed) {
myGenerated = myCommon->Generated(S);
}
else {
myGenerated = myCut->Generated(S);
TopTools_MapOfShape aMap; // to check if shape can be added in list more then one time
TopTools_ListIteratorOfListOfShape It(myGenerated);
for(;It.More();It.Next()) {
aMap.Add(It.Value());
}
It.Initialize(myCommon->Generated(S));
for(;It.More();It.Next()) {
if(aMap.Add(It.Value())) myGenerated.Append(It.Value());
}
}
return myGenerated;
}
// ================================================================================================
// function: HasModified
// purpose:
// ================================================================================================
Standard_Boolean QANewModTopOpe_Limitation::HasModified() const
{
Check();
if(myMode == QANewModTopOpe_Forward) {
return myCut->HasModified();
}
else if(myMode == QANewModTopOpe_Reversed) {
return myCommon->HasModified();
}
else {
return myCut->HasModified() || myCommon->HasModified();
}
}
// ================================================================================================
// function: HasGenerated
// purpose:
// ================================================================================================
Standard_Boolean QANewModTopOpe_Limitation::HasGenerated() const
{
Check();
if(myMode == QANewModTopOpe_Forward) {
return myCut->HasGenerated();
}
else if(myMode == QANewModTopOpe_Reversed) {
return myCommon->HasGenerated();
}
else {
return myCut->HasGenerated() || myCommon->HasGenerated();
}
}
// ================================================================================================
// function: HasDeleted
// purpose:
// ================================================================================================
Standard_Boolean QANewModTopOpe_Limitation::HasDeleted() const
{
Check();
if(myMode == QANewModTopOpe_Forward) {
return myCut->HasDeleted();
}
else if(myMode == QANewModTopOpe_Reversed) {
return myCommon->HasDeleted();
}
else {
return myCut->HasDeleted() || myCommon->HasDeleted();
}
}
Standard_Boolean QANewModTopOpe_Limitation::IsDeleted(const TopoDS_Shape& S)
{
Check();
if(myMode == QANewModTopOpe_Forward) {
return myCut->IsDeleted(S);
}
else if(myMode == QANewModTopOpe_Reversed) {
return myCommon->IsDeleted(S);
}
else {
return myCut->IsDeleted(S) && myCommon->IsDeleted(S);
}
}
void QANewModTopOpe_Limitation::Delete()
{
delete myCut;
delete myCommon;
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : skv Date : 6-05-2003
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! ifv ! Creation ! 6-05-2001! 3.0-00-3!
// ! skv ! Adaptation to OCC version 5.0 ! 6-05-2003! 3.0-00-2!
// ! vladimir ! adaptation to CAS 5.0 ! 07/01/03! 4.0-2!
// +---------------------------------------------------------------------------+
//
// @@SDM: end

View File

@@ -0,0 +1,70 @@
-- File: QANewModTopOpe_ReShaper.cdl
-- Created: Thu Feb 7 12:05:56 2002
-- Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
-- Copyright: SAMTECH S.A. 2002
-- sccsid[] = "@(#) QANewModTopOpe_ReShaper.cdl 4.0-1, 04/28/03@(#)";
-- Lastly modified by :
-- +---------------------------------------------------------------------------+
-- ! ifv ! Creation ! 7-02-2002! 3.0-00-1!
-- +---------------------------------------------------------------------------+
class ReShaper from QANewModTopOpe inherits TShared from MMgt
---Purpose: to remove "floating" objects from compound.
-- "floating" objects are wires, edges, vertices that do not belong
-- solids, shells or faces.
uses
Shape from TopoDS,
HSequenceOfShape from TopTools,
MapOfShape from TopTools
is
Create(TheInitialShape : Shape from TopoDS)
returns mutable ReShaper;
Create(TheInitialShape : Shape from TopoDS;
TheMap : MapOfShape from TopTools)
returns mutable ReShaper;
Create(TheInitialShape : Shape from TopoDS;
TheShapeToBeRemoved : HSequenceOfShape from TopTools)
returns mutable ReShaper;
Remove(me : mutable; TheS : Shape from TopoDS);
Perform(me : mutable);
Clear(me : mutable);
---Purpose: to clear all added for removing shapes from inner map.
GetResult(me) returns Shape from TopoDS;
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Shape() const;"
fields
myInitShape : Shape from TopoDS;
myResult : Shape from TopoDS;
myMap : MapOfShape from TopTools;
end;
-- @@SDM: begin
-- Copyright SAMTECH ..........................................Version 3.0-00
-- Lastly modified by : ifv Date : 7-02-2002
-- File history synopsis (creation,modification,correction)
-- +---------------------------------------------------------------------------+
-- ! Developer ! Comments ! Date ! Version !
-- +-----------!-----------------------------------------!----------!----------+
-- ! ifv ! Creation ! 7-02-2002! 3.0-00-1!
-- +---------------------------------------------------------------------------+
-- @@SDM: end

View File

@@ -0,0 +1,130 @@
// File: QANewModTopOpe_ReShaper.cxx
// Created: Thu Feb 7 12:37:08 2002
// Author: Igor FEOKTISTOV <ifv@nnov.matra-dtv.fr>
// Copyright: SAMTECH S.A. 2002
const static char sccsid[] = "@(#) QANewModTopOpe_ReShaper.cxx 4.0-1, 04/28/03@(#)";
// Lastly modified by :
// +---------------------------------------------------------------------------+
// ! ifv ! Creation ! 7-02-2002! 3.0-00-2!
// +---------------------------------------------------------------------------+
#include <QANewModTopOpe_ReShaper.ixx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopoDS_Compound.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS.hxx>
QANewModTopOpe_ReShaper::QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape):
myInitShape(TheInitialShape)
{
}
QANewModTopOpe_ReShaper::QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape,
const TopTools_MapOfShape& TheMap):
myInitShape(TheInitialShape)
{
myMap.Assign(TheMap);
}
QANewModTopOpe_ReShaper::QANewModTopOpe_ReShaper(const TopoDS_Shape& TheInitialShape,
const Handle(TopTools_HSequenceOfShape)& TheShapeToBeRemoved):
myInitShape(TheInitialShape)
{
Standard_Integer i, n = TheShapeToBeRemoved->Length();
for(i = 1; i <= n; i++) {
myMap.Add(TheShapeToBeRemoved->Value(i));
}
}
void QANewModTopOpe_ReShaper::Remove(const TopoDS_Shape& TheS)
{
myMap.Add(TheS);
}
void QANewModTopOpe_ReShaper::Perform()
{
BRepBuilderAPI_Copy aCopier;
if(myMap.IsEmpty()) {
aCopier.Perform(myInitShape);
myResult = aCopier.Shape();
return;
}
BRep_Builder aBB;
myResult.Nullify();
aBB.MakeCompound(TopoDS::Compound(myResult));
TopoDS_Iterator anIter(myInitShape);
for(; anIter.More(); anIter.Next()) {
const TopoDS_Shape& aS = anIter.Value();
if(myMap.Contains(aS)) continue;
if(aS.ShapeType() != TopAbs_COMPOUND) {
aCopier.Perform(aS);
aBB.Add(myResult, aCopier.Shape());
}
else {
Handle(QANewModTopOpe_ReShaper) aR = new QANewModTopOpe_ReShaper(aS, myMap);
aR->Perform();
const TopoDS_Shape& aSp = aR->GetResult();
if(aSp.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator anIt(aSp);
if(anIt.More()) {
aBB.Add(myResult, aSp);
}
}
else {
aBB.Add(myResult, aSp);
}
}
}
if(myResult.ShapeType() == TopAbs_COMPOUND) {
anIter.Initialize(myResult);
if(anIter.More()) {
const TopoDS_Shape& aSp = anIter.Value();
anIter.Next();
if(!anIter.More()) myResult = aSp;
}
}
}
const TopoDS_Shape& QANewModTopOpe_ReShaper::GetResult() const
{
return myResult;
}
void QANewModTopOpe_ReShaper::Clear()
{
myMap.Clear();
myResult.Nullify();
}
// @@SDM: begin
// Copyright SAMTECH ..........................................Version 3.0-00
// Lastly modified by : ifv Date : 7-02-2002
// File history synopsis (creation,modification,correction)
// +---------------------------------------------------------------------------+
// ! Developer ! Comments ! Date ! Version !
// +-----------!-----------------------------------------!----------!----------+
// ! ifv ! Creation ! 7-02-2002! 3.0-00-2!
// +---------------------------------------------------------------------------+
// @@SDM: end

View File

@@ -0,0 +1,70 @@
-- File: QANewModTopOpe_Tools.cdl
-- Created: Tue May 6 17:49:59 2003
-- Author: Michael KLOKOV
class Tools from QANewModTopOpe
uses
Edge from TopoDS,
Shape from TopoDS,
State from TopAbs,
PDSFiller from BOPTools,
ListOfShape from TopTools,
IndexedDataMapOfShapeListOfShape from TopTools
is
NbPoints(myclass; theDSFiller: PDSFiller from BOPTools)
returns Integer from Standard;
NewVertex(myclass; theDSFiller: PDSFiller from BOPTools;
theIndex : Integer from Standard)
returns Shape from TopoDS;
HasSameDomain(myclass; theDSFiller: PDSFiller from BOPTools;
theFace : Shape from TopoDS)
returns Boolean from Standard;
SameDomain(myclass; theDSFiller: PDSFiller from BOPTools;
theFace : Shape from TopoDS;
theResultList: out ListOfShape from TopTools);
IsSplit(myclass; theDSFiller: PDSFiller from BOPTools;
theEdge : Shape from TopoDS;
theState : State from TopAbs)
returns Boolean from Standard;
---Warning: This method could be called only after boolean operation,
--- arguments of which was solids or compounds of solids.
---
Splits(myclass; theDSFiller: PDSFiller from BOPTools;
theEdge : Shape from TopoDS;
theState : State from TopAbs;
theResultList: out ListOfShape from TopTools);
---Warning: This method could be called only after boolean operation,
--- arguments of which was solids or compounds of solids.
---
SplitE(myclass; theEdge : Edge from TopoDS;
theSplits: out ListOfShape from TopTools)
returns Boolean from Standard;
EdgeCurveAncestors(myclass; theDSFiller: PDSFiller from BOPTools;
theEdge : Shape from TopoDS;
theFace1 : out Shape from TopoDS;
theFace2 : out Shape from TopoDS)
returns Boolean from Standard;
EdgeSectionAncestors(myclass; theDSFiller: PDSFiller from BOPTools;
theEdge : Shape from TopoDS;
LF1,LF2 : out ListOfShape from TopTools;
LE1,LE2 : out ListOfShape from TopTools)
returns Boolean from Standard;
BoolOpe(myclass; theFace1: Shape from TopoDS;
theFace2: Shape from TopoDS;
IsCommonFound: out Boolean from Standard;
theHistoryMap: out IndexedDataMapOfShapeListOfShape from TopTools)
returns Boolean from Standard;
end Tools from QANewModTopOpe;

File diff suppressed because it is too large Load Diff