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

Compare commits

...

9 Commits

Author SHA1 Message Date
akaftasev
1ae062108e 0033420: Modeling Algorithm - Missing inner part after offset operation
Added condition to not remove face image, consisting only of invalid edges for artifactically invalid face.
This face image should be connected with other image faces minimum through the edge.
2023-07-26 12:13:34 +01:00
akaftasev
dbbf2cd055 0033340: Modeling Algorithm - Improve memory management performance in the PaveFiller
Changed NCollection_BaseAllocator to NCollection_IncAllocator in BOPAlgo_PaveFiller::MakeBlocks()
2023-03-16 15:59:49 +03:00
akaftasev
1b7ba0fb6a 0033138: [Foundation Classes] - NCollection_IncAllocator- Decrease the default block size
Set default memory block size for IncAllocator to 12KB to make sure the Low Fragmentation Heap is used for memory allocations on Windows platform.
2023-03-16 14:07:20 +03:00
akaftasev
b9fff2cc6e 0033227: Modeling Algorithm - BOPAlgo_BuilderSolid generates incomplete result
Deleted outer loop for shells.
Added additional check of edges orientation for RefineShell().
2022-12-27 15:03:05 +03:00
akaftasev
47c187a5f5 0033298: Modeling Algorithm - Offset operation gives wrong result
Process only those images of the faces, if one of them has anInsideEdges/anInsideVertices and the other is not.
2022-12-23 18:36:05 +03:00
Eugeny Maltchikov
19eb4fe4a3 0033171: Modeling Algorithms - Invalid result of faces unification
Avoid unification of the faces belonging to the different shells.
2022-10-17 10:58:38 +03:00
jgv
129b356365 0032814: Modeling algorithms - Unifysamedom produces invalid result
Minor correction in ShapeUpgrade_UnifySameDomain::IntUnifyFaces: correct collecting splitting vertices in the new wire
2022-02-18 16:04:07 +03:00
jgv
406cb34e08 0032715: Modelling Algorithms - UnifySameDomain does incomplete union
Add the case of closed, smooth but not periodic surface (unification of faces lying on it if the flag "myConcatBSplines" is true - modify the underlying surface to make it periodic).
2022-02-18 16:04:06 +03:00
emv
ab11b50079 0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode "Complete" join type "Intersection"
Add more faces for intersection in rebuilding process basing on the connection of the splits of offset faces (special treatment for the artificially invalid faces).
When rebuilding faces add vertices common for faces for trimming the new intersection edges.

Adjust existing and create new test cases.
2022-01-12 19:41:13 +03:00
49 changed files with 1581 additions and 345 deletions

View File

@@ -1331,7 +1331,7 @@ Therefore if the user of *NCollection* does not specify any allocator as a param
Nevertheless, it is possible to define a custom *Allocator* type to manage the memory in the most optimal or convenient way for this algorithm.
As one possible choice, the class *NCollection_IncAllocator* is included.
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 20kB) and the allocator keeps track of the amount of occupied memory.
Unlike *NCollection_BaseAllocator*, the memory is allocated in big blocks (about 12kB) and the allocator keeps track of the amount of occupied memory.
The method *Allocate* just increments the pointer to non-occupied memory and returns its previous value.
Memory is only released in the destructor of *NCollection_IncAllocator*, the method *Free* is empty.
If used properly, this Allocator can greatly improve the performance of specific algorithms.

View File

@@ -67,6 +67,7 @@
#include <IntTools_SequenceOfPntOn2Faces.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <IntTools_Tools.hxx>
#include <NCollection_IncAllocator.hxx>
#include <NCollection_Vector.hxx>
#include <Precision.hxx>
#include <TColStd_ListOfInteger.hxx>
@@ -483,14 +484,12 @@ void BOPAlgo_PaveFiller::MakeBlocks(const Message_ProgressRange& theRange)
Standard_Integer i, nF1, nF2, aNbC, aNbP, j;
Standard_Integer nV1, nV2;
Standard_Real aT1, aT2;
Handle(NCollection_BaseAllocator) aAllocator;
Handle(NCollection_BaseAllocator) aAllocator = new NCollection_IncAllocator;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
TopoDS_Edge aES;
Handle(BOPDS_PaveBlock) aPBOut;
//
//-----------------------------------------------------scope f
aAllocator=
NCollection_BaseAllocator::CommonBaseAllocator();
//
TColStd_ListOfInteger aLSE(aAllocator), aLBV(aAllocator);
TColStd_MapOfInteger aMVOnIn(100, aAllocator), aMVCommon(100, aAllocator),

View File

@@ -248,167 +248,178 @@ void BOPAlgo_ShellSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
//
// Build the shells
aItF.Initialize (aLFConnected);
for (i = 1; aItF.More() && !bAllFacesTaken; aItF.Next(), ++i) {
for (i = 1; aItF.More() && !bAllFacesTaken; aItF.Next(), ++i)
{
const TopoDS_Shape& aFF = aItF.Value();
if (!AddedFacesMap.Add(aFF)) {
continue;
}
//
// make a new shell
TopoDS_Shell aShellStart;
aBB.MakeShell(aShellStart);
aBB.Add(aShellStart, aFF);
TopoDS_Shell aShell;
aBB.MakeShell(aShell);
aBB.Add(aShell, aFF);
aMEFP.Clear();
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEFP);
//
TopTools_ListOfShape aLShells;
aLShells.Append(aShellStart);
//
TopTools_ListIteratorOfListOfShape aItLShells(aLShells);
for (; aItLShells.More(); aItLShells.Next()) {
TopoDS_Shell& aShell = TopoDS::Shell(aItLShells.ChangeValue());
// loop on faces added to Shell;
// add their neighbor faces to Shell and so on
aItS.Initialize(aShell);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aItS.Value()));
Standard_Boolean isBoundary = aBoundaryFaces.Contains (aF);
//
aMEFP.Clear();
TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEFP);
//
// loop on faces added to Shell;
// add their neighbor faces to Shell and so on
aItS.Initialize(aShell);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Face& aF = (*(TopoDS_Face*)(&aItS.Value()));
Standard_Boolean isBoundary = aBoundaryFaces.Contains (aF);
// loop on edges of aF; find a good neighbor face of aF by aE
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aExp.Current()));
//
// loop on edges of aF; find a good neighbor face of aF by aE
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE = (*(TopoDS_Edge*)(&aExp.Current()));
//
// proceed only free edges in this shell
if (aMEFP.Contains(aE)) {
const TopTools_ListOfShape& aLFP = aMEFP.FindFromKey(aE);
aNbFP = aLFP.Extent();
if (aNbFP > 1) {
continue;
}
}
// avoid processing of internal edges
anOr = aE.Orientation();
if (anOr == TopAbs_INTERNAL) {
// proceed only free edges in this shell
if (aMEFP.Contains(aE)) {
const TopTools_ListOfShape& aLFP = aMEFP.FindFromKey(aE);
aNbFP = aLFP.Extent();
if (aNbFP > 1) {
continue;
}
// avoid processing of degenerated edges
if (BRep_Tool::Degenerated(aE)) {
}
// avoid processing of internal edges
anOr = aE.Orientation();
if (anOr == TopAbs_INTERNAL) {
continue;
}
// avoid processing of degenerated edges
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//
// candidate faces list
const TopTools_ListOfShape& aLF = aEFMap.FindFromKey(aE);
aNbLF = aLF.Extent();
if (!aNbLF) {
continue;
}
//
// prepare for selecting the next face
// take only not-processed faces as a candidates
BOPTools_ListOfCoupleOfShape aLCSOff;
//
Standard_Integer aNbWaysInside = 0;
TopoDS_Face aSelF;
TopTools_ListIteratorOfListOfShape aItLF(aLF);
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aFL = (*(TopoDS_Face*)(&aItLF.Value()));
if (aF.IsSame(aFL) || AddedFacesMap.Contains(aFL)) {
continue;
}
//
// candidate faces list
const TopTools_ListOfShape& aLF = aEFMap.FindFromKey(aE);
aNbLF = aLF.Extent();
if (!aNbLF) {
// find current edge in the face
if (!BOPTools_AlgoTools::GetEdgeOff(aE, aFL, aEL)) {
continue;
}
//
// prepare for selecting the next face
// take only not-processed faces as a candidates
BOPTools_ListOfCoupleOfShape aLCSOff;
//
Standard_Integer aNbWaysInside = 0;
TopoDS_Face aSelF;
TopTools_ListIteratorOfListOfShape aItLF(aLF);
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aFL = (*(TopoDS_Face*)(&aItLF.Value()));
if (aF.IsSame(aFL) || AddedFacesMap.Contains(aFL)) {
continue;
}
//
// find current edge in the face
if (!BOPTools_AlgoTools::GetEdgeOff(aE, aFL, aEL)) {
continue;
}
//
if (isBoundary && !aBoundaryFaces.Contains (aFL))
{
++aNbWaysInside;
aSelF = aFL;
}
aCSOff.SetShape1(aEL);
aCSOff.SetShape2(aFL);
aLCSOff.Append(aCSOff);
}//for (; aItLF.More(); aItLF.Next()) {
//
aNbOff = aLCSOff.Extent();
if (!aNbOff){
continue;
}
//
// among all the adjacent faces chose one with the minimal
// angle to the current one
if (!isBoundary || aNbWaysInside != 1)
if (isBoundary && !aBoundaryFaces.Contains (aFL))
{
if (aNbOff == 1) {
aSelF = (*(TopoDS_Face*)(&aLCSOff.First().Shape2()));
}
else if (aNbOff > 1) {
BOPTools_AlgoTools::GetFaceOff(aE, aF, aLCSOff, aSelF, aContext);
}
++aNbWaysInside;
aSelF = aFL;
}
//
if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {
aBB.Add(aShell, aSelF);
TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
}
} // for (; aExp.More(); aExp.Next()) {
} // for (; aItS.More(); aItS.Next()) {
//
// split the shell on multi-connected edges
TopTools_ListOfShape aLShSp;
RefineShell(aShell, aMEFP, aLShSp);
//
// collect the not closed shells for further processing
TopTools_ListOfShape aLShNC;
//
TopTools_ListIteratorOfListOfShape aItLShSp(aLShSp);
for (; aItLShSp.More(); aItLShSp.Next()) {
TopoDS_Shell& aShSp = *((TopoDS_Shell*)&aItLShSp.Value());
aCSOff.SetShape1(aEL);
aCSOff.SetShape2(aFL);
aLCSOff.Append(aCSOff);
}//for (; aItLF.More(); aItLF.Next()) {
//
if (BRep_Tool::IsClosed(aShSp)) {
aShSp.Closed(Standard_True);
myLoops.Append(aShSp);
aNbOff = aLCSOff.Extent();
if (!aNbOff){
continue;
}
else {
aLShNC.Append(aShSp);
}
}
//
bAllFacesTaken = (AddedFacesMap.Extent() == aNbShapes);
if (bAllFacesTaken) {
break;
}
//
if (aLShSp.Extent() == 1) {
// not further processing of not closed shells is needed,
// as it will not bring any new results
continue;
}
//
Standard_Integer aNbShNC = aLShNC.Extent();
if (aNbShNC == 1) {
// try to complete the shell with other faces
aLShells.Append(aLShNC);
}
else if (aNbShNC > 1) {
// remove th faces of not closed shells from the map of processed faces
// and try to rebuild the shells using all not processed faces,
// because faces of one shell might be needed for building the other
TopTools_ListIteratorOfListOfShape aItLShNC(aLShNC);
for (; aItLShNC.More(); aItLShNC.Next()) {
TopoDS_Iterator aItNC(aItLShNC.Value());
for (; aItNC.More(); aItNC.Next()) {
AddedFacesMap.Remove(aItNC.Value());
//
// among all the adjacent faces chose one with the minimal
// angle to the current one
if (!isBoundary || aNbWaysInside != 1)
{
if (aNbOff == 1) {
aSelF = (*(TopoDS_Face*)(&aLCSOff.First().Shape2()));
}
else if (aNbOff > 1) {
BOPTools_AlgoTools::GetFaceOff(aE, aF, aLCSOff, aSelF, aContext);
}
}
//
if (!aSelF.IsNull() && AddedFacesMap.Add(aSelF)) {
aBB.Add(aShell, aSelF);
TopExp::MapShapesAndAncestors(aSelF, TopAbs_EDGE, TopAbs_FACE, aMEFP);
}
} // for (; aExp.More(); aExp.Next()) {
} // for (; aItS.More(); aItS.Next()) {
//
// split the shell on multi-connected edges
TopTools_ListOfShape aLShSp;
RefineShell(aShell, aMEFP, aLShSp);
//
// collect the not closed shells for further processing
TopTools_ListOfShape aLShNC;
//
TopTools_ListIteratorOfListOfShape aItLShSp(aLShSp);
for (; aItLShSp.More(); aItLShSp.Next()) {
TopoDS_Shell& aShSp = *((TopoDS_Shell*)&aItLShSp.Value());
//
if (BRep_Tool::IsClosed(aShSp)) {
aShSp.Closed(Standard_True);
myLoops.Append(aShSp);
}
else {
aLShNC.Append(aShSp);
}
}
//
bAllFacesTaken = (AddedFacesMap.Extent() == aNbShapes);
if (bAllFacesTaken) {
break;
}
//
if (aLShSp.Extent() == 1) {
// not further processing of not closed shells is needed,
// as it will not bring any new results
continue;
}
//
// remove th faces of not closed shells from the map of processed faces
// and try to rebuild the shells using all not processed faces,
// because faces of one shell might be needed for building the other
TopTools_ListIteratorOfListOfShape aItLShNC(aLShNC);
for (; aItLShNC.More(); aItLShNC.Next())
{
TopoDS_Iterator aItNC(aItLShNC.Value());
for (; aItNC.More(); aItNC.Next())
{
AddedFacesMap.Remove(aItNC.Value());
}
}
} // for (; aItF.More(); aItF.Next()) {
}
//=======================================================================
//function : FindShape
//purpose :
//=======================================================================
TopoDS_Shape FindShape (const TopoDS_Shape& theShapeToFind,
const TopoDS_Shape& theShape)
{
TopoDS_Shape aRes;
TopExp_Explorer anExp(theShape, theShapeToFind.ShapeType());
for (; anExp.More(); anExp.Next())
{
const TopoDS_Shape& aShape = anExp.Current();
if (aShape.IsSame(theShapeToFind))
{
aRes = aShape;
break;
}
}
return aRes;
}
//=======================================================================
//function : RefineShell
//purpose :
@@ -434,6 +445,21 @@ void RefineShell(TopoDS_Shell& theShell,
aMEStop.Add(aE);
continue;
}
if (aLF.Extent() == 2)
{
const TopoDS_Face& aF1 = TopoDS::Face(aLF.First());
const TopoDS_Face& aF2 = TopoDS::Face(aLF.Last());
TopoDS_Shape aE1 = FindShape(aE, aF1);
TopoDS_Shape aE2 = FindShape(aE, aF2);
if (aE1.Orientation() == aE2.Orientation())
{
aMEStop.Add(aE);
continue;
}
}
//
// check for internal edges - count faces, in which the edge
// is internal, twice

View File

@@ -1978,6 +1978,12 @@ public:
return aDeriv.Transformed(mySurfaceTrsf);
}
gp_Dir Normal()
{
gp_Dir aNormal = mySurfaceProps.Normal();
return aNormal.Transformed(mySurfaceTrsf);
}
// Calculate principal curvatures, which consist of minimal and maximal normal curvatures and
// the directions on the tangent plane (principal direction) where the extremums are reached
void Curvature(gp_Dir& thePrincipalDir1, Standard_Real& theCurvature1,
@@ -2016,32 +2022,63 @@ private:
//purpose : check the angle at the border between two squares.
// Two shares should have a shared front edge.
//=======================================================================
static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
const Standard_Real theAngleTol)
GeomAbs_Shape BRepLib::ContinuityOfFaces(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
const Standard_Real theAngleTol)
{
Standard_Boolean isSeam = F1.IsEqual(F2);
Standard_Boolean isSeam = theFace1.IsEqual(theFace2);
TopoDS_Edge E = Ed;
TopoDS_Edge anEdgeInFace1, anEdgeInFace2;
Handle(Geom2d_Curve) aCurve1, aCurve2;
Standard_Real aFirst, aLast;
if (!theFace1.IsSame (theFace2) &&
BRep_Tool::IsClosed (theEdge, theFace1) &&
BRep_Tool::IsClosed (theEdge, theFace2))
{
//Find the edge in the face 1: this edge will have correct orientation
TopoDS_Face aFace1 = theFace1;
aFace1.Orientation (TopAbs_FORWARD);
TopExp_Explorer anExplo (aFace1, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
if (anEdge.IsSame (theEdge))
{
anEdgeInFace1 = anEdge;
break;
}
}
if (anEdgeInFace1.IsNull())
return GeomAbs_C0;
aCurve1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace1, aFirst, aLast);
TopoDS_Face aFace2 = theFace2;
aFace2.Orientation (TopAbs_FORWARD);
anEdgeInFace2 = anEdgeInFace1;
anEdgeInFace2.Reverse();
aCurve2 = BRep_Tool::CurveOnSurface (anEdgeInFace2, aFace2, aFirst, aLast);
}
else
{
// Obtaining of pcurves of edge on two faces.
anEdgeInFace1 = anEdgeInFace2 = theEdge;
aCurve1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, theFace1, aFirst, aLast);
//For the case of seam edge
if (theFace1.IsSame(theFace2))
anEdgeInFace2.Reverse();
aCurve2 = BRep_Tool::CurveOnSurface (anEdgeInFace2, theFace2, aFirst, aLast);
}
// Check if pcurves exist on both faces of edge
Standard_Real aFirst,aLast;
E.Orientation(TopAbs_FORWARD);
Handle(Geom2d_Curve) aCurve1 = BRep_Tool::CurveOnSurface(E, F1, aFirst, aLast);
if(aCurve1.IsNull())
return GeomAbs_C0;
if (isSeam)
E.Orientation(TopAbs_REVERSED);
Handle(Geom2d_Curve) aCurve2 = BRep_Tool::CurveOnSurface(E, F2, aFirst, aLast);
if(aCurve2.IsNull())
if (aCurve1.IsNull() || aCurve2.IsNull())
return GeomAbs_C0;
TopLoc_Location aLoc1, aLoc2;
Handle(Geom_Surface) aSurface1 = BRep_Tool::Surface(F1, aLoc1);
Handle(Geom_Surface) aSurface1 = BRep_Tool::Surface (theFace1, aLoc1);
const gp_Trsf& aSurf1Trsf = aLoc1.Transformation();
Handle(Geom_Surface) aSurface2 = BRep_Tool::Surface(F2, aLoc2);
Handle(Geom_Surface) aSurface2 = BRep_Tool::Surface (theFace2, aLoc2);
const gp_Trsf& aSurf2Trsf = aLoc2.Transformation();
if (aSurface1->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
@@ -2058,11 +2095,11 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
return GeomAbs_CN;
}
SurfaceProperties aSP1(aSurface1, aSurf1Trsf, aCurve1, F1.Orientation() == TopAbs_REVERSED);
SurfaceProperties aSP2(aSurface2, aSurf2Trsf, aCurve2, F2.Orientation() == TopAbs_REVERSED);
SurfaceProperties aSP1(aSurface1, aSurf1Trsf, aCurve1, theFace1.Orientation() == TopAbs_REVERSED);
SurfaceProperties aSP2(aSurface2, aSurf2Trsf, aCurve2, theFace2.Orientation() == TopAbs_REVERSED);
Standard_Real f, l, eps;
BRep_Tool::Range(E,f,l);
BRep_Tool::Range (theEdge,f,l);
Extrema_LocateExtPC ext;
Handle(BRepAdaptor_Curve) aHC2;
@@ -2073,7 +2110,6 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
const Standard_Real anAngleTol2 = theAngleTol * theAngleTol;
gp_Vec aDer1, aDer2;
gp_Vec aNorm1;
Standard_Real aSqLen1, aSqLen2;
gp_Dir aCrvDir1[2], aCrvDir2[2];
Standard_Real aCrvLen1[2], aCrvLen2[2];
@@ -2101,13 +2137,26 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
aDer2 = aSP2.Derivative();
aSqLen2 = aDer2.SquareMagnitude();
Standard_Boolean isSmoothSuspect = (aDer1.CrossSquareMagnitude(aDer2) <= anAngleTol2 * aSqLen1 * aSqLen2);
if (isSmoothSuspect)
{
gp_Dir aNormal1 = aSP1.Normal();
if (theFace1.Orientation() == TopAbs_REVERSED)
aNormal1.Reverse();
gp_Dir aNormal2 = aSP2.Normal();
if (theFace2.Orientation() == TopAbs_REVERSED)
aNormal2.Reverse();
if (aNormal1 * aNormal2 < 0.)
return GeomAbs_C0;
}
if (!isSmoothSuspect)
{
// Refine by projection
if (aHC2.IsNull())
{
// adaptor for pcurve on the second surface
aHC2 = new BRepAdaptor_Curve (E, F2);
aHC2 = new BRepAdaptor_Curve (anEdgeInFace2, theFace2);
ext.Initialize(*aHC2, f, l, Precision::PConfusion());
}
ext.Perform(aSP1.Value(), u);
@@ -2303,9 +2352,8 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
BRep_Builder B;
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
try {
GeomAbs_Shape aCont = tgtfaces(E, F1, F2, TolAng);
GeomAbs_Shape aCont = ContinuityOfFaces(E, F1, F2, TolAng);
B.Continuity(E,F1,F2,aCont);
}
catch(Standard_Failure const&)
{

View File

@@ -202,7 +202,14 @@ public:
//! orientation to have matter in the solid. Returns
//! False if the solid is unOrientable (open or incoherent)
Standard_EXPORT static Standard_Boolean OrientClosedSolid (TopoDS_Solid& solid);
//! Returns the order of continuity between two faces
//! connected by an edge
Standard_EXPORT static GeomAbs_Shape ContinuityOfFaces(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
const Standard_Real theAngleTol);
//! Encodes the Regularity of edges on a Shape.
//! Warning: <TolAng> is an angular tolerance, expressed in Rad.
//! Warning: If the edges's regularity are coded before, nothing

View File

@@ -52,6 +52,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Section.hxx>
#include <BOPAlgo_Splitter.hxx>
#include <BOPAlgo_BOP.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
@@ -107,6 +108,19 @@ namespace {
{
BRep_Builder().Add (theSOut, theS);
}
static void AddToContainer (const TopoDS_Shape& theKey,
const TopoDS_Shape& theValue,
TopTools_DataMapOfShapeListOfShape& theMap)
{
if (TopTools_ListOfShape* pList = theMap.ChangeSeek (theKey))
{
pList->Append (theValue);
}
else
{
theMap.Bound (theKey, TopTools_ListOfShape())->Append (theValue);
}
}
//=======================================================================
//function : TakeModified
@@ -617,7 +631,9 @@ private: //! @name Intersection and post-treatment of edges
//! Filtering the invalid edges according to currently invalid faces
void FilterInvalidEdges (const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
const TopTools_IndexedMapOfShape& theMERemoved);
const TopTools_IndexedMapOfShape& theMERemoved,
const TopTools_IndexedMapOfShape& theMEInside,
TopTools_MapOfShape& theMEUseInRebuild);
private: //! @name Checking faces
@@ -766,6 +782,7 @@ private: //! @name Checking faces
const TopTools_MapOfShape& theVertsToAvoid,
const TopTools_MapOfShape& theNewVertsToAvoid,
const TopTools_MapOfShape& theMECheckExt,
const TopTools_DataMapOfShapeListOfShape* theSSInterfs,
TopTools_MapOfShape& theMVBounds,
TopTools_DataMapOfShapeListOfShape& theEImages);
@@ -877,16 +894,18 @@ private:
TopTools_IndexedMapOfShape myEdgesToAvoid; //!< Splits of edges to be avoided when building splits of faces
TopTools_MapOfShape myLastInvEdges; //!< Edges marked invalid on the current step and to be avoided on the next step
TopTools_MapOfShape myModifiedEdges; //!< Edges to be used for building splits
TopTools_IndexedMapOfShape myInsideEdges; //!< Edges located fully inside solids built from the splits of offset faces
TopTools_IndexedDataMapOfShapeListOfShape myInvalidFaces; //!< Invalid faces - splits of offset faces consisting of invalid edges
TopTools_DataMapOfShapeShape myArtInvalidFaces; //!< Artificially invalid faces - valid faces intentionally marked invalid
//! to be rebuilt on the future steps in the situations when invalid edges
//! are present, but invalid faces not
BRepOffset_DataMapOfShapeIndexedMapOfShape myArtInvalidFaces; //!< Artificially invalid faces - valid faces intentionally marked invalid
//! to be rebuilt on the future steps in the situations when invalid edges
//! are present, but invalid faces not
TopTools_DataMapOfShapeInteger myAlreadyInvFaces; //!< Count number of the same face being marked invalid to avoid infinite
//! rebuilding of the same face
TopTools_DataMapOfShapeListOfShape myFNewHoles; //!< Images of the hole faces of the original face
TopTools_DataMapOfShapeListOfShape mySSInterfs; //!< Intersection information, used to collect intersection pairs during rebuild
TopTools_DataMapOfShapeListOfShape mySSInterfsArt; //!< Intersection information, used to collect intersection pairs during rebuild
NCollection_DataMap <TopoDS_Shape,
BRepOffset_DataMapOfShapeMapOfShape,
TopTools_ShapeMapHasher> myIntersectionPairs; //!< All possible intersection pairs, used to avoid some of the intersections
@@ -1004,6 +1023,7 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfExtendedFaces (const Message_Prog
myInvalidEdges.Clear();
myInvertedEdges.Clear();
mySSInterfs.Clear();
mySSInterfsArt.Clear();
myIntersectionPairs.Clear();
mySolids.Nullify();
myFacesToRebuild.Clear();
@@ -1165,6 +1185,45 @@ void BRepOffset_BuildOffsetFaces::IntersectTrimmedEdges (const Message_ProgressR
UpdateIntersectedEdges (aLA, aGFE);
}
namespace
{
//=======================================================================
//function : CheckConnectionsOfFace
//purpose : Checks number of connections for theFace with theLF
// Returns true if number of connections more than 1
//=======================================================================
static Standard_Boolean checkConnectionsOfFace(const TopoDS_Shape& theFace,
const TopTools_ListOfShape& theLF)
{
TopTools_IndexedMapOfShape aShapeVert;
for (TopTools_ListOfShape::Iterator aFImIterator(theLF); aFImIterator.More(); aFImIterator.Next())
{
const TopoDS_Shape& aShape = aFImIterator.Value();
if (aShape.IsSame(theFace))
{
continue;
}
TopExp::MapShapes(aShape, TopAbs_VERTEX, aShapeVert);
}
Standard_Integer aNbConnections = 0;
TopTools_IndexedMapOfShape aFaceVertices;
TopExp::MapShapes(theFace, TopAbs_VERTEX, aFaceVertices);
for (TopTools_IndexedMapOfShape::Iterator aVertIter(aFaceVertices); aVertIter.More(); aVertIter.Next())
{
const TopoDS_Shape& aVert = aVertIter.Value();
if (aShapeVert.Contains(aVert))
{
++aNbConnections;
}
if (aNbConnections > 1)
{
return Standard_True;
}
}
return Standard_False;
}
}
//=======================================================================
//function : BuildSplitsOfFaces
//purpose : Building the splits of offset faces and
@@ -1256,6 +1315,10 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
for (TopTools_ListIteratorOfListOfShape aItLFIm (aLFImages1); aItLFIm.More();)
{
Standard_Boolean bAllInv = Standard_True;
// Additional check for artificial case
// if current image face consist only of edges from aMapEInv and aMENInv
// then recheck current face for the futher processing
Standard_Boolean aToReCheckFace = bArtificialCase;
const TopoDS_Shape& aFIm = aItLFIm.Value();
TopExp_Explorer aExpE (aFIm, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next())
@@ -1266,12 +1329,19 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
bAllInv = Standard_False;
if (!aMENInv.Contains (aE))
{
aToReCheckFace = Standard_False;
break;
}
}
}
//
if (!aExpE.More())
// if current image face is to recheck then check number of connections for this face
// with other image faces for current face
if (!aExpE.More() && aToReCheckFace)
{
aToReCheckFace = checkConnectionsOfFace(aFIm, aLFImages1);
}
// do not delete image face from futher processing if aToReCheckFace is true
if (!aExpE.More() && !aToReCheckFace)
{
if (bAllInv)
{
@@ -1299,9 +1369,8 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
//
if (bArtificialCase)
{
TopTools_IndexedMapOfShape aMEInv;
// make the face invalid
myArtInvalidFaces.Bind (aF, aCE);
TopTools_IndexedMapOfShape aMEInv;
//
*pLFIm = aLFImages;
TopTools_ListIteratorOfListOfShape aItLFIm (aLFImages);
@@ -1324,6 +1393,7 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
}
}
//
myArtInvalidFaces.Bind (aF, aMEInv);
aDMFMIE.Bind (aF, aMEInv);
aLFDone.Append (aF);
//
@@ -1519,9 +1589,8 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
RemoveInvalidSplitsFromValid (aDMFMVIE);
//
// remove inside faces
TopTools_IndexedMapOfShape aMEInside;
RemoveInsideFaces (anInvertedFaces, aMFToCheckInt, aMFInvInHole, aFHoles,
aMERemoved, aMEInside, aPSOuter.Next (5.));
aMERemoved, myInsideEdges, aPSOuter.Next (5.));
//
// make compound of valid splits
TopoDS_Compound aCFIm;
@@ -1546,7 +1615,7 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
FilterEdgesImages (aCFIm);
//
// filter invalid faces
FilterInvalidFaces (aDMEF, aMEInside);
FilterInvalidFaces (aDMEF, aMERemoved.Extent() ? myInsideEdges : aMERemoved);
aNb = myInvalidFaces.Extent();
if (!aNb)
{
@@ -1572,7 +1641,10 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
#endif
//
// filter invalid edges
FilterInvalidEdges (aDMFMIE, aMERemoved);
TopTools_MapOfShape aMEUseInRebuild;
FilterInvalidEdges (aDMFMIE, aMERemoved,
aMERemoved.Extent() ? myInsideEdges : aMERemoved,
aMEUseInRebuild);
//
// Check additionally validity of edges originated from vertices.
CheckEdgesCreatedByVertex();
@@ -1594,8 +1666,11 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
for (i = 1; i <= aNb; ++i)
{
const TopoDS_Shape& aE = myInvalidEdges (i);
myEdgesToAvoid.Add (aE);
myLastInvEdges.Add (aE);
if (!aMEUseInRebuild.Contains(aE))
{
myEdgesToAvoid.Add (aE);
}
}
//
aNb = myInvalidFaces.Extent();
@@ -1793,11 +1868,10 @@ Standard_Boolean BRepOffset_BuildOffsetFaces::CheckIfArtificial (const TopoDS_Sh
{
const TopoDS_Edge& aE = TopoDS::Edge (aItLE.Value());
//
if (myOEImages.IsBound (aE))
if (const TopTools_ListOfShape* pLEIm = myOEImages.Seek (aE))
{
Standard_Boolean bChecked = Standard_False;
const TopTools_ListOfShape& aLEIm = myOEImages.Find (aE);
TopTools_ListIteratorOfListOfShape aItLEIm (aLEIm);
TopTools_ListIteratorOfListOfShape aItLEIm (*pLEIm);
for (; aItLEIm.More(); aItLEIm.Next())
{
const TopoDS_Edge& aEIm = TopoDS::Edge (aItLEIm.Value());
@@ -4165,6 +4239,7 @@ void BRepOffset_BuildOffsetFaces::RemoveInsideFaces (const TopTools_ListOfShape&
RemoveInvalidSplits (aMFToRem, aMV, theMERemoved);
//
// Get inside faces from the removed ones comparing them with boundary edges
theMEInside.Clear();
aNb = theMERemoved.Extent();
for (i = 1; i <= aNb; ++i)
{
@@ -4189,6 +4264,28 @@ void BRepOffset_BuildOffsetFaces::RemoveInsideFaces (const TopTools_ListOfShape&
void BRepOffset_BuildOffsetFaces::ShapesConnections (const TopTools_DataMapOfShapeShape& theDMFOr,
BOPAlgo_Builder& theBuilder)
{
// Make connexity blocks from invalid edges to use the whole block
// to which the edge is connected instead of the single edge.
TopoDS_Compound aCEInv;
BRep_Builder().MakeCompound(aCEInv);
for (Standard_Integer i = 1; i <= myInvalidEdges.Extent(); ++i)
{
AddToContainer (myInvalidEdges(i), aCEInv);
}
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks (aCEInv, TopAbs_VERTEX, TopAbs_EDGE, aLCB);
// Binding from the edge to the block
TopTools_DataMapOfShapeShape aECBMap;
for (TopTools_ListOfShape::Iterator itCB(aLCB); itCB.More(); itCB.Next())
{
for (TopoDS_Iterator itE(itCB.Value()); itE.More(); itE.Next())
{
aECBMap.Bind(itE.Value(), itCB.Value());
}
}
// update invalid edges with images and keep connection to original edge
TopTools_DataMapOfShapeListOfShape aDMEOr;
Standard_Integer aNb = myInvalidEdges.Extent();
@@ -4206,13 +4303,7 @@ void BRepOffset_BuildOffsetFaces::ShapesConnections (const TopTools_DataMapOfSha
for (; aItLEIm.More(); aItLEIm.Next())
{
const TopoDS_Shape& aEIm = aItLEIm.Value();
//
TopTools_ListOfShape* pLEOr = aDMEOr.ChangeSeek (aEIm);
if (!pLEOr)
{
pLEOr = aDMEOr.Bound (aEIm, TopTools_ListOfShape());
}
AppendToList (*pLEOr, aEInv);
AddToContainer (aEIm, aEInv, aDMEOr);
}
}
//
@@ -4365,6 +4456,121 @@ void BRepOffset_BuildOffsetFaces::ShapesConnections (const TopTools_DataMapOfSha
AppendToList (*pLF, aFOp);
}
}
// Treatment for the artificial case - check if one of the faces is artificially invalid
for (Standard_Integer iF = 0; iF < 2; ++iF)
{
const TopoDS_Shape& aFArt = !iF ? *pF1 : *pF2;
const TopoDS_Shape& aFOpposite = !iF ? *pF2 : *pF1;
if (!myArtInvalidFaces.IsBound (aFArt))
continue;
if (myInvalidFaces.Contains (aFOpposite) && !myArtInvalidFaces.IsBound (aFOpposite))
continue;
// Collect own invalid edges of the face and the invalid edges connected to those
// own invalid edges to be avoided in the check for intersection.
TopTools_IndexedMapOfShape aMEAvoid;
if (const TopTools_IndexedMapOfShape* pFEInv = myArtInvalidFaces.Seek (aFOpposite))
{
for (Standard_Integer iE = 1; iE <= pFEInv->Extent(); ++iE)
{
if (const TopoDS_Shape* pCB = aECBMap.Seek (pFEInv->FindKey(iE)))
{
TopExp::MapShapes (*pCB, TopAbs_EDGE, aMEAvoid);
}
}
}
else if (const TopTools_ListOfShape* pLFIm = myOFImages.Seek (aFOpposite))
{
for (TopTools_ListOfShape::Iterator itLFIm (*pLFIm); itLFIm.More(); itLFIm.Next())
{
for (TopExp_Explorer expE (itLFIm.Value(), TopAbs_EDGE); expE.More(); expE.Next())
{
if (const TopoDS_Shape* pCB = aECBMap.Seek (expE.Current()))
{
TopExp::MapShapes (*pCB, TopAbs_EDGE, aMEAvoid);
}
}
}
}
const TopoDS_Shape& aFArtIm = !iF ? aFIm1 : aFIm2;
const TopoDS_Shape& aFOppositeIm = !iF ? aFIm2 : aFIm1;
// Check if there are any intersections between edges of artificially
// invalid face and opposite face
const Standard_Integer nFOp = pDS->Index (aFOppositeIm);
for (TopExp_Explorer expE (aFArtIm, TopAbs_EDGE); expE.More(); expE.Next())
{
const TopoDS_Shape& aE = expE.Current();
if (!myInvalidEdges.Contains (aE) || myInvertedEdges.Contains (aE) || aMEAvoid.Contains (aE))
{
continue;
}
const Standard_Integer nE = pDS->Index (aE);
if (nE < 0)
{
continue;
}
if (!pDS->HasInterf(nE, nFOp))
{
continue;
}
TopTools_ListOfShape aLV;
const BOPDS_VectorOfInterfEF& aEFs = pDS->InterfEF();
for (Standard_Integer iEF = 0; iEF < aEFs.Size(); ++iEF)
{
const BOPDS_InterfEF& aEF = aEFs (iEF);
if (aEF.Contains (nE) && aEF.Contains(nFOp))
{
if (aEF.CommonPart().Type() == TopAbs_VERTEX)
aLV.Append (pDS->Shape (aEF.IndexNew()));
}
}
if (aLV.IsEmpty())
{
continue;
}
// Make sure that there is an opposite intersection exists, i.e. some of the edges
// of the opposite face intersect the artificially invalid face.
const Standard_Integer nFArt = pDS->Index (aFArtIm);
TopExp_Explorer expEOp (aFOppositeIm, TopAbs_EDGE);
for (; expEOp.More(); expEOp.Next())
{
const TopoDS_Shape& aEOp = expEOp.Current();
const Standard_Integer nEOp = pDS->Index (aEOp);
if (pDS->HasInterf(nEOp, nFArt))
{
break;
}
}
if (!expEOp.More())
{
continue;
}
// Intersection is present - add connection between offset faces.
AddToContainer (aFArt, aFOpposite, mySSInterfsArt);
// Add connection between edge and opposite face
AddToContainer (aE, aFOpposite, mySSInterfsArt);
// Along with the opposite face, save the intersection vertices to
// be used for trimming the intersection edge in the rebuilding process
for (TopTools_ListOfShape::Iterator itLV (aLV); itLV.More(); itLV.Next())
{
// Add connection to intersection vertex
AddToContainer (aE, itLV.Value(), mySSInterfsArt);
}
}
}
}
}
@@ -4960,7 +5166,9 @@ void BRepOffset_BuildOffsetFaces::CheckEdgesCreatedByVertex()
//purpose : Filtering the invalid edges according to currently invalid faces
//=======================================================================
void BRepOffset_BuildOffsetFaces::FilterInvalidEdges (const BRepOffset_DataMapOfShapeIndexedMapOfShape& theDMFMIE,
const TopTools_IndexedMapOfShape& theMERemoved)
const TopTools_IndexedMapOfShape& theMERemoved,
const TopTools_IndexedMapOfShape& theMEInside,
TopTools_MapOfShape& theMEUseInRebuild)
{
TopoDS_Compound aCEInv;
TopTools_IndexedMapOfShape aMEInv;
@@ -5023,14 +5231,16 @@ void BRepOffset_BuildOffsetFaces::FilterInvalidEdges (const BRepOffset_DataMapOf
const TopoDS_Shape& aF = myInvalidFaces.FindKey (i);
if (myArtInvalidFaces.IsBound (aF))
{
const TopTools_IndexedMapOfShape& aMIE = theDMFMIE.Find (aF);
const Standard_Integer aNbIE = aMIE.Extent();
for (Standard_Integer iE = 1; iE <= aNbIE; ++iE)
if (const TopTools_IndexedMapOfShape* aMIE = theDMFMIE.Seek (aF))
{
const TopoDS_Shape& aE = aMIE (iE);
if (aMEInv.Contains (aE) && !aMEInvToAvoid.Contains (aE))
const Standard_Integer aNbIE = aMIE->Extent();
for (Standard_Integer iE = 1; iE <= aNbIE; ++iE)
{
aReallyInvEdges.Add (aE);
const TopoDS_Shape& aE = aMIE->FindKey (iE);
if (aMEInv.Contains (aE) && !aMEInvToAvoid.Contains (aE))
{
aReallyInvEdges.Add (aE);
}
}
}
}
@@ -5053,8 +5263,45 @@ void BRepOffset_BuildOffsetFaces::FilterInvalidEdges (const BRepOffset_DataMapOf
}
}
}
//
myInvalidEdges = aReallyInvEdges;
// Check if any of the currently invalid edges may be used for
// rebuilding splits of invalid faces.
// For that the edge should be inside and not connected to invalid
// boundary edges of the same origin.
aNb = myInvalidEdges.Extent();
for (i = 1; i <= aNb; ++i)
{
const TopoDS_Shape& aE = myInvalidEdges (i);
if (!theMEInside.Contains (aE) || !myValidEdges.Contains (aE))
{
continue;
}
const TopTools_ListOfShape* pEOrigins = myOEOrigins.Seek (aE);
if (!pEOrigins)
{
continue;
}
Standard_Boolean bHasInvOutside = Standard_False;
for (TopTools_ListOfShape::Iterator itEOr (*pEOrigins); !bHasInvOutside && itEOr.More(); itEOr.Next())
{
if (const TopTools_ListOfShape* pEIms = myOEImages.Seek (itEOr.Value()))
{
for (TopTools_ListOfShape::Iterator itEIms (*pEIms); !bHasInvOutside && itEIms.More(); itEIms.Next())
{
bHasInvOutside = myInvalidEdges.Contains (itEIms.Value()) && !theMEInside.Contains (itEIms.Value());
}
}
}
if (!bHasInvOutside)
{
theMEUseInRebuild.Add (aE);
}
}
}
//=======================================================================
@@ -5116,7 +5363,7 @@ void BRepOffset_BuildOffsetFaces::FindFacesToRebuild()
aDMFLV.Bind (aF, aLVAvoid);
}
//
const TopTools_ListOfShape* pLF = mySSInterfs.Seek (aF);
const TopTools_ListOfShape* pLF = !myArtInvalidFaces.IsBound(aF) ? mySSInterfs.Seek (aF) : mySSInterfsArt.Seek(aF);
if (pLF)
{
TopTools_ListIteratorOfListOfShape aItLFE (*pLF);
@@ -5203,6 +5450,29 @@ void BRepOffset_BuildOffsetFaces::FindFacesToRebuild()
}
}
namespace
{
//=======================================================================
//function : mapShapes
//purpose : Collect theVecShapes into theMap with setted theType
//=======================================================================
template<class Container>
static void mapShapes (const Container& theVecShapes,
const TopAbs_ShapeEnum theType,
TopTools_MapOfShape& theMap)
{
for (const auto& aShape : theVecShapes)
{
for (TopExp_Explorer anExp(aShape, theType); anExp.More(); anExp.Next())
{
theMap.Add(anExp.Current());
}
}
}
}
//=======================================================================
//function : IntersectFaces
//purpose : Intersection of the faces that should be rebuild to resolve all invalidities
@@ -5275,7 +5545,7 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
TopTools_DataMapOfShapeShape aDMFImF;
TopoDS_Compound aCFArt;
BRep_Builder().MakeCompound (aCFArt);
TopTools_DataMapIteratorOfDataMapOfShapeShape aItM (myArtInvalidFaces);
BRepOffset_DataMapOfShapeIndexedMapOfShape::Iterator aItM (myArtInvalidFaces);
for (; aItM.More(); aItM.Next())
{
const TopoDS_Shape& aF = aItM.Key();
@@ -5525,7 +5795,10 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
TopoDS_Compound aCBE;
aBB.MakeCompound (aCBE);
//
TopExp_Explorer aExp (aCBInv, TopAbs_EDGE);
// remember inside edges and vertices to further check
TopTools_MapOfShape anInsideEdges;
TopTools_MapOfShape anInsideVertices;
TopExp_Explorer aExp(aCBInv, TopAbs_EDGE);
for (; aExp.More(); aExp.Next())
{
const TopoDS_Shape& aE = aExp.Current();
@@ -5534,6 +5807,15 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
if (aMEFence.Add (aE))
{
aBB.Add (aCBE, aE);
if (!myEdgesToAvoid.Contains(aE) && myInvalidEdges.Contains(aE))
{
anInsideEdges.Add(aE);
TopoDS_Iterator anIt(aE);
for (; anIt.More(); anIt.Next())
{
anInsideVertices.Add(anIt.Value());
}
}
}
}
}
@@ -5559,10 +5841,6 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
TopExp::MapShapes (aCBELoc, TopAbs_EDGE, aME);
aMECV = aME;
TopExp::MapShapes (aCBELoc, TopAbs_VERTEX, aME);
//
// Using the map <aME> find chain of faces to be intersected;
//
// faces for intersection
TopTools_IndexedMapOfShape aMFInt;
// additional faces for intersection
TopTools_IndexedMapOfShape aMFIntExt;
@@ -5597,9 +5875,13 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
continue;
}
//
const TopTools_ListOfShape& aLFImi = myOFImages.FindFromKey (aFi);
const TopTools_ListOfShape* aLFImi = myOFImages.Seek (aFi);
if (!aLFImi)
continue;
//
TopTools_ListOfShape& aLFEi = aFLE.ChangeFromKey (aFi);
TopTools_ListOfShape* aLFEi = aFLE.ChangeSeek (aFi);
if (!aLFEi)
continue;
//
TopTools_ListOfShape& aLFDone = aMDone.ChangeFind (aFi);
//
@@ -5607,6 +5889,14 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
if (pMFInter && !pInterFi)
continue;
// create map of edges and vertices for aLFImi
TopTools_MapOfShape aMEVIm;
mapShapes(*aLFImi, TopAbs_EDGE, aMEVIm);
mapShapes(*aLFImi, TopAbs_VERTEX, aMEVIm);
Standard_Boolean isIContainsE = aMEVIm.HasIntersection(anInsideEdges);
Standard_Boolean isIContainsV = aMEVIm.HasIntersection(anInsideVertices);
for (j = i + 1; j <= aNb; ++j)
{
const TopoDS_Face& aFj = TopoDS::Face (aMFInt (j));
@@ -5618,20 +5908,64 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
if (pInterFi && !pInterFi->Contains (aFj))
continue;
const TopTools_ListOfShape& aLFImj = myOFImages.FindFromKey (aFj);
const TopTools_ListOfShape* aLFImj = myOFImages.Seek(aFj);
if (!aLFImj)
continue;
//
TopTools_ListOfShape& aLFEj = aFLE.ChangeFromKey (aFj);
TopTools_ListOfShape* aLFEj = aFLE.ChangeSeek (aFj);
if (!aLFEj)
continue;
// create map of edges and vertices for aLFImi
aMEVIm.Clear();
mapShapes(*aLFImj, TopAbs_EDGE, aMEVIm);
mapShapes(*aLFImj, TopAbs_VERTEX, aMEVIm);
// check images of both faces contain anInsideEdges and anInsideVertices
// not process if false and true
Standard_Boolean isJContainsE = aMEVIm.HasIntersection(anInsideEdges);
Standard_Boolean isJContainsV = aMEVIm.HasIntersection(anInsideVertices);
// Check if one face is connected to inside edge then
// the other must be also connected
if (isIContainsE && !isJContainsV ||
isJContainsE && !isIContainsV)
{
TopTools_ListOfShape aLVC;
// it is necessary to process the images if they already have
// common vertices
FindCommonParts(*aLFImi, *aLFImj, aLVC, TopAbs_VERTEX);
if (aLVC.IsEmpty())
continue;
}
//
// if there are some common edges between faces
// we should use these edges and do not intersect again.
TopTools_ListOfShape aLEC;
FindCommonParts (aLFImi, aLFImj, aLEC);
FindCommonParts (*aLFImi, *aLFImj, aLEC);
//
if (aLEC.Extent())
{
// no need to intersect if we have common edges between faces
Standard_Boolean bForceUse = aMFIntExt.Contains (aFi) || aMFIntExt.Contains (aFj);
ProcessCommonEdges (aLEC, aME, aMEInfETrim, aMAllInvs, bForceUse, aMECV, aMECheckExt, aDMEETrim, aLFEi, aLFEj, aMEToInt);
ProcessCommonEdges (aLEC, aME, aMEInfETrim, aMAllInvs, bForceUse, aMECV, aMECheckExt, aDMEETrim, *aLFEi, *aLFEj, aMEToInt);
// Add common vertices not belonging to the common edges for trimming the intersection edges
TopTools_IndexedMapOfShape aMVOnCE;
for (TopTools_ListOfShape::Iterator itE (aLEC); itE.More(); itE.Next())
{
TopExp::MapShapes (itE.Value(), TopAbs_VERTEX, aMVOnCE);
}
TopTools_ListOfShape aLEV;
FindCommonParts (*aLFImi, *aLFImj, aLEV, TopAbs_VERTEX);
for (TopTools_ListOfShape::Iterator itV (aLEV); itV.More(); itV.Next())
{
if (!aMVOnCE.Contains (itV.Value()))
{
aMECV.Add (itV.Value());
}
}
continue;
}
//
@@ -5657,7 +5991,7 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
{
// use intersection line obtained on the previous steps
// plus, find new origins for these lines
UpdateIntersectedFaces (aFInv, aFi, aFj, aLFInv, aLFImi, aLFImj, aLFEi, aLFEj, aMEToInt);
UpdateIntersectedFaces (aFInv, aFi, aFj, aLFInv, *aLFImi, *aLFImj, *aLFEi, *aLFEj, aMEToInt);
continue;
}
//
@@ -5669,13 +6003,14 @@ void BRepOffset_BuildOffsetFaces::IntersectFaces (TopTools_MapOfShape& theVertsT
aLFDone.Append (aFj);
aMDone.ChangeFind (aFj).Append (aFi);
//
IntersectFaces (aFInv, aFi, aFj, aLFInv, aLFImi, aLFImj, aLFEi, aLFEj, aMECV, aMEToInt);
IntersectFaces (aFInv, aFi, aFj, aLFInv, *aLFImi, *aLFImj, *aLFEi, *aLFEj, aMECV, aMEToInt);
}
}
//
// intersect and trim edges for this chain
IntersectAndTrimEdges (aMFInt, aMEToInt, aDMEETrim, aME, aMECV,
aMVInv, aMVRInv, aMECheckExt, aMVBounds, aEImages);
aMVInv, aMVRInv, aMECheckExt, bArtificial ? &mySSInterfsArt : 0,
aMVBounds, aEImages);
//
Standard_Integer iE, aNbEToInt = aMEToInt.Extent();
for (iE = 1; iE <= aNbEToInt; ++iE)
@@ -5956,12 +6291,8 @@ void BRepOffset_BuildOffsetFaces::FindFacesForIntersection (const TopoDS_Shape&
}
}
//
if (theArtCase)
{
return;
}
//
const TopTools_ListOfShape* pLFInv = mySSInterfs.Seek (theFInv);
const TopTools_DataMapOfShapeListOfShape& aSSInterfsMap = theArtCase ? mySSInterfsArt : mySSInterfs;
const TopTools_ListOfShape* pLFInv = aSSInterfsMap.Seek (theFInv);
if (!pLFInv)
{
return;
@@ -5985,7 +6316,7 @@ void BRepOffset_BuildOffsetFaces::FindFacesForIntersection (const TopoDS_Shape&
for (i = 1; i <= aNbE; ++i)
{
const TopoDS_Shape& aS = theME (i);
const TopTools_ListOfShape* pLF = mySSInterfs.Seek (aS);
const TopTools_ListOfShape* pLF = aSSInterfsMap.Seek (aS);
if (!pLF)
{
continue;
@@ -6002,30 +6333,33 @@ void BRepOffset_BuildOffsetFaces::FindFacesForIntersection (const TopoDS_Shape&
//
// check if the face has some connection to already added for intersection faces
const TopTools_ListOfShape& aLFIm = myOFImages.FindFromKey (aF);
TopTools_ListIteratorOfListOfShape aItLFIm (aLFIm);
for (; aItLFIm.More(); aItLFIm.Next())
if (!theArtCase)
{
const TopoDS_Shape& aFIm = aItLFIm.Value();
TopExp_Explorer aExp (aFIm, TopAbs_EDGE);
for (; aExp.More(); aExp.Next())
TopTools_ListIteratorOfListOfShape aItLFIm (aLFIm);
for (; aItLFIm.More(); aItLFIm.Next())
{
if (aMShapes.Contains (aExp.Current()))
const TopoDS_Shape& aFIm = aItLFIm.Value();
TopExp_Explorer aExp (aFIm, TopAbs_EDGE);
for (; aExp.More(); aExp.Next())
{
if (aMShapes.Contains (aExp.Current()))
{
break;
}
}
if (aExp.More())
{
break;
}
}
if (aExp.More())
if (!aItLFIm.More())
{
break;
continue;
}
}
if (!aItLFIm.More())
{
continue;
}
//
aMFToAdd.Add (aF);
aItLFIm.Initialize (aLFIm);
TopTools_ListIteratorOfListOfShape aItLFIm (aLFIm);
for (; aItLFIm.More(); aItLFIm.Next())
{
const TopoDS_Shape& aFIm = aItLFIm.Value();
@@ -6423,6 +6757,7 @@ void BRepOffset_BuildOffsetFaces::IntersectAndTrimEdges (const TopTools_IndexedM
const TopTools_MapOfShape& theVertsToAvoid,
const TopTools_MapOfShape& theNewVertsToAvoid,
const TopTools_MapOfShape& theMECheckExt,
const TopTools_DataMapOfShapeListOfShape* theSSInterfs,
TopTools_MapOfShape& theMVBounds,
TopTools_DataMapOfShapeListOfShape& theEImages)
{
@@ -6468,30 +6803,39 @@ void BRepOffset_BuildOffsetFaces::IntersectAndTrimEdges (const TopTools_IndexedM
aNb = theMSInv.Extent();
for (i = 1; i <= aNb; ++i)
{
const TopoDS_Shape& aV = theMSInv (i);
if (aV.ShapeType() != TopAbs_VERTEX)
const TopoDS_Shape& aS = theMSInv(i);
// edge case
if (theSSInterfs)
{
continue;
}
//
TopTools_ListOfShape* pLVE = aDMVE.ChangeSeek (aV);
if (!pLVE)
{
continue;
}
//
aIt.Initialize (*pLVE);
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aE = aIt.Value();
//
aExp.Init (aE, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next())
if (const TopTools_ListOfShape* pLV = theSSInterfs->Seek (aS))
{
const TopoDS_Shape& aV1 = aExp.Current();
if (!theVertsToAvoid.Contains (aV1) && aMFence.Add (aV1))
// Add vertices from intersection info to trim section edges of artificial faces
for (TopTools_ListOfShape::Iterator itLV (*pLV); itLV.More(); itLV.Next())
{
aLArgs.Append (aV1);
if (itLV.Value().ShapeType() == TopAbs_VERTEX)
{
aLArgs.Append (itLV.Value());
}
}
}
}
// vertex case
if (const TopTools_ListOfShape* pLVE = aDMVE.ChangeSeek(aS))
{
aIt.Initialize(*pLVE);
for (; aIt.More(); aIt.Next())
{
const TopoDS_Shape& aE = aIt.Value();
//
aExp.Init(aE, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next())
{
const TopoDS_Shape& aV1 = aExp.Current();
if (!theVertsToAvoid.Contains(aV1) && aMFence.Add(aV1))
{
aLArgs.Append(aV1);
}
}
}
}
@@ -7137,9 +7481,19 @@ void BRepOffset_BuildOffsetFaces::UpdateValidEdges (const TopTools_IndexedDataMa
TopExp::MapShapes (aItSpIm.Value(), TopAbs_EDGE, aNewEdges);
}
}
TopoDS_Compound anInsideEdges;
BRep_Builder().MakeCompound (anInsideEdges);
for (Standard_Integer iE = 1; iE <= myInsideEdges.Extent(); ++iE)
{
BRep_Builder().Add (anInsideEdges, myInsideEdges (iE));
}
//
// Rebuild the map of edges to avoid, using the intersection results
TopTools_IndexedMapOfShape aMEAvoid;
TopoDS_Compound aCEAvoid;
BRep_Builder().MakeCompound (aCEAvoid);
// GF's data structure
const BOPDS_PDS& pDS = aGF.PDS();
@@ -7175,7 +7529,7 @@ void BRepOffset_BuildOffsetFaces::UpdateValidEdges (const TopTools_IndexedDataMa
if (bKeep)
{
// keep the original edge
aMEAvoid.Add (aE);
AddToContainer (aE, aMEAvoid);
continue;
}
@@ -7184,9 +7538,41 @@ void BRepOffset_BuildOffsetFaces::UpdateValidEdges (const TopTools_IndexedDataMa
{
const TopoDS_Shape& aEIm = aItLEIm.Value();
if (!aNewEdges.Contains (aEIm))
aMEAvoid.Add (aEIm);
{
AddToContainer(aEIm, aCEAvoid);
}
}
}
Standard_Boolean isCut = Standard_False;
if (aCEAvoid.NbChildren() > 0)
{
// Perform intersection with the small subset of the edges to make
// it possible to use the inside edges for building new splits.
BOPAlgo_BOP aBOP;
aBOP.AddArgument (aCEAvoid);
aBOP.AddTool (anInsideEdges);
aBOP.SetOperation (BOPAlgo_CUT);
aBOP.Perform();
isCut = !aBOP.HasErrors();
if (isCut)
{
for (TopoDS_Iterator itCE (aCEAvoid); itCE.More(); itCE.Next())
{
if (!aBOP.IsDeleted (itCE.Value()))
{
aMEAvoid.Add (itCE.Value());
}
}
}
}
if (!isCut)
{
TopExp::MapShapes (aCEAvoid, TopAbs_EDGE, aMEAvoid);
}
myEdgesToAvoid = aMEAvoid;
}

View File

@@ -139,12 +139,12 @@ ChFiDS_TypeOfConcavity ChFi3d::DefineConnectType(const TopoDS_Edge& E,
//function : IsTangentFaces
//purpose :
//=======================================================================
Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
const GeomAbs_Shape Order)
Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
const GeomAbs_Shape theOrder)
{
if (Order == GeomAbs_G1 && BRep_Tool::Continuity(theEdge, theFace1, theFace2) != GeomAbs_C0)
if (theOrder == GeomAbs_G1 && BRep_Tool::Continuity(theEdge, theFace1, theFace2) != GeomAbs_C0)
return Standard_True;
Standard_Real TolC0 = Max(0.001, 1.5*BRep_Tool::Tolerance(theEdge));
@@ -152,15 +152,46 @@ Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
Standard_Real aFirst;
Standard_Real aLast;
// Obtaining of pcurves of edge on two faces.
const Handle(Geom2d_Curve) aC2d1 = BRep_Tool::CurveOnSurface
(theEdge, theFace1, aFirst, aLast);
//For the case of seam edge
TopoDS_Edge EE = theEdge;
if (theFace1.IsSame(theFace2))
EE.Reverse();
const Handle(Geom2d_Curve) aC2d2 = BRep_Tool::CurveOnSurface
(EE, theFace2, aFirst, aLast);
Handle(Geom2d_Curve) aC2d1, aC2d2;
if (!theFace1.IsSame (theFace2) &&
BRep_Tool::IsClosed (theEdge, theFace1) &&
BRep_Tool::IsClosed (theEdge, theFace2))
{
//Find the edge in the face 1: this edge will have correct orientation
TopoDS_Edge anEdgeInFace1;
TopoDS_Face aFace1 = theFace1;
aFace1.Orientation (TopAbs_FORWARD);
TopExp_Explorer anExplo (aFace1, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
if (anEdge.IsSame (theEdge))
{
anEdgeInFace1 = anEdge;
break;
}
}
if (anEdgeInFace1.IsNull())
return Standard_False;
aC2d1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace1, aFirst, aLast);
TopoDS_Face aFace2 = theFace2;
aFace2.Orientation (TopAbs_FORWARD);
anEdgeInFace1.Reverse();
aC2d2 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace2, aFirst, aLast);
}
else
{
// Obtaining of pcurves of edge on two faces.
aC2d1 = BRep_Tool::CurveOnSurface (theEdge, theFace1, aFirst, aLast);
//For the case of seam edge
TopoDS_Edge EE = theEdge;
if (theFace1.IsSame(theFace2))
EE.Reverse();
aC2d2 = BRep_Tool::CurveOnSurface (EE, theFace2, aFirst, aLast);
}
if (aC2d1.IsNull() || aC2d2.IsNull())
return Standard_False;
@@ -191,15 +222,19 @@ Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
if (i == aNbSamples) aPar = aLast;
LocalAnalysis_SurfaceContinuity aCont(aC2d1, aC2d2, aPar,
aSurf1, aSurf2, Order,
aSurf1, aSurf2, theOrder,
0.001, TolC0, 0.1, 0.1, 0.1);
if (!aCont.IsDone())
{
if (theOrder == GeomAbs_C2 &&
aCont.StatusError() == LocalAnalysis_NullSecondDerivative)
continue;
nbNotDone++;
continue;
}
if (Order == GeomAbs_G1)
if (theOrder == GeomAbs_G1)
{
if (!aCont.IsG1())
return Standard_False;

View File

@@ -33,7 +33,12 @@ class Standard_Mutex;
* type "aligned_t". To modify the size of memory blocks requested from the
* OS, use the parameter of the constructor (measured in bytes); if this
* parameter is smaller than 25 bytes on 32bit or 49 bytes on 64bit, the
* block size will be the default 24 kbytes
* block size will be the default 12 kbytes.
*
* It is not recommended to use memory blocks larger than 16KB on Windows
* platform for the repeated operations because Low Fragmentation Heap is
* not going to be used for these allocations which may lead to memory
* fragmentation and the general performance slow down.
*
* Note that this allocator is most suitable for single-threaded algorithms
* (consider creating dedicated allocators per working thread),
@@ -50,6 +55,12 @@ class NCollection_IncAllocator : public NCollection_BaseAllocator
//! Constructor.
//! Note that this constructor does NOT setup mutex for using allocator concurrently from different threads,
//! see SetThreadSafe() method.
//!
//! The default size of the memory blocks is 12KB.
//! It is not recommended to use memory blocks larger than 16KB on Windows
//! platform for the repeated operations (and thus multiple allocations)
//! because Low Fragmentation Heap is not going to be used for these allocations,
//! leading to memory fragmentation and eventual performance slow down.
Standard_EXPORT NCollection_IncAllocator (size_t theBlockSize = DefaultBlockSize);
//! Setup mutex for thread-safe allocations.
@@ -83,7 +94,8 @@ class NCollection_IncAllocator : public NCollection_BaseAllocator
Standard_EXPORT void Reset (const Standard_Boolean
doReleaseMem=Standard_True);
static const size_t DefaultBlockSize = 24600;
//! Default size for the memory blocks - 12KB
static const size_t DefaultBlockSize = 12300;
protected:
struct IBlock;

View File

@@ -46,6 +46,7 @@
#include <Geom_TrimmedCurve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomConvert.hxx>
#include <GeomConvert_ApproxSurface.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <GeomLib_IsPlanarSurface.hxx>
#include <gp_Cylinder.hxx>
@@ -102,6 +103,19 @@
IMPLEMENT_STANDARD_RTTIEXT(ShapeUpgrade_UnifySameDomain,Standard_Transient)
static Standard_Boolean IsOnSingularity(const TopTools_ListOfShape& theEdgeList)
{
TopTools_ListIteratorOfListOfShape anItl (theEdgeList);
for (; anItl.More(); anItl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anItl.Value());
if (BRep_Tool::Degenerated (anEdge))
return Standard_True;
}
return Standard_False;
}
static void SplitWire (const TopoDS_Wire& theWire,
const TopoDS_Face& theFace,
const TopTools_IndexedMapOfShape& theVmap,
@@ -1212,7 +1226,31 @@ static Standard_Boolean GetNormalToSurface(const TopoDS_Face& theFace,
{
Standard_Real f, l;
// get 2d curve to get point in 2d
const Handle(Geom2d_Curve)& aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, f, l);
Handle(Geom2d_Curve) aC2d;
if (BRep_Tool::IsClosed(theEdge, theFace))
{
//Find the edge in the face: it will have correct orientation
TopoDS_Edge anEdgeInFace;
TopoDS_Face aFace = theFace;
aFace.Orientation (TopAbs_FORWARD);
TopExp_Explorer anExplo (aFace, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
if (anEdge.IsSame (theEdge))
{
anEdgeInFace = anEdge;
break;
}
}
if (anEdgeInFace.IsNull())
return Standard_False;
aC2d = BRep_Tool::CurveOnSurface (anEdgeInFace, aFace, f, l);
}
else
aC2d = BRep_Tool::CurveOnSurface(theEdge, theFace, f, l);
if (aC2d.IsNull()) {
return Standard_False;
}
@@ -2625,6 +2663,26 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
for (Standard_Integer i = 1; i <= aFaceMap.Extent(); i++)
TopExp::MapShapesAndAncestors (aFaceMap(i), TopAbs_EDGE, TopAbs_FACE, aGMapEdgeFaces);
// creating map of face shells for the whole shape to avoid
// unification of faces belonging to the different shells
DataMapOfShapeMapOfShape aGMapFaceShells;
for (TopExp_Explorer anExp (myShape, TopAbs_SHELL); anExp.More(); anExp.Next())
{
const TopoDS_Shape& aShell = anExp.Current();
for (TopoDS_Iterator anItF (aShell); anItF.More(); anItF.Next())
{
const TopoDS_Shape& aF = anItF.Value();
if (TopTools_MapOfShape* pShells = aGMapFaceShells.ChangeSeek (aF))
{
pShells->Add (aShell);
}
else
{
(aGMapFaceShells.Bound (aF, TopTools_MapOfShape()))->Add (aShell);
}
}
}
// creating map of free boundaries
TopTools_MapOfShape aFreeBoundMap;
// look at only shells not belonging to solids
@@ -2646,7 +2704,7 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
// unify faces in each shell separately
TopExp_Explorer exps;
for (exps.Init(myShape, TopAbs_SHELL); exps.More(); exps.Next())
IntUnifyFaces(exps.Current(), aGMapEdgeFaces, aFreeBoundMap);
IntUnifyFaces(exps.Current(), aGMapEdgeFaces, aGMapFaceShells, aFreeBoundMap);
// gather all faces out of shells in one compound and unify them at once
BRep_Builder aBB;
@@ -2657,7 +2715,10 @@ void ShapeUpgrade_UnifySameDomain::UnifyFaces()
aBB.Add(aCmp, exps.Current());
if (nbf > 0)
IntUnifyFaces(aCmp, aGMapEdgeFaces, aFreeBoundMap);
{
// No connection to shells, thus no need to pass the face-shell map
IntUnifyFaces(aCmp, aGMapEdgeFaces, DataMapOfShapeMapOfShape(), aFreeBoundMap);
}
myShape = myContext->Apply(myShape);
}
@@ -2680,13 +2741,52 @@ static void SetFixWireModes(ShapeFix_Face& theSff)
aFixWire->FixSmallMode() = 0;
}
//=======================================================================
//function : isSameSets
//purpose : Compares two sets of shapes. Returns true if they are the same,
// false otherwise.
//=======================================================================
template<class Container>
static Standard_Boolean isSameSets(const Container* theFShells1,
const Container* theFShells2)
{
// If both are null - no problem
if (theFShells1 == nullptr && theFShells2 == nullptr)
{
return Standard_True;
}
// If only one is null - not the same
if (theFShells1 == nullptr || theFShells2 == nullptr)
{
return Standard_False;
}
// Both not null
if (theFShells1->Extent() != theFShells2->Extent())
{
return Standard_False;
}
// number of shells in each set should be very small in normal cases - max 2.
// thus just check if all objects of one are contained in the other and vice versa.
for (typename Container::Iterator it1(*theFShells1), it2(*theFShells2);
it1.More() && it2.More(); it1.Next(), it2.Next())
{
if (!theFShells1->Contains(it2.Value()) || !theFShells2->Contains(it1.Value()))
{
return Standard_False;
}
}
return Standard_True;
}
//=======================================================================
//function : IntUnifyFaces
//purpose :
//=======================================================================
void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape,
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const DataMapOfShapeMapOfShape& theGMapFaceShells,
const TopTools_MapOfShape& theFreeBoundMap)
{
// creating map of edge faces for the shape
@@ -2735,6 +2835,9 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
Standard_Real Uperiod = (aBaseSurface->IsUPeriodic())? aBaseSurface->UPeriod() : 0.;
Standard_Real Vperiod = (aBaseSurface->IsVPeriodic())? aBaseSurface->VPeriod() : 0.;
// Get shells connected to the face (in normal cases should not be more than 2)
const TopTools_MapOfShape* pFShells1 = theGMapFaceShells.Seek (aFace);
// find adjacent faces to union
Standard_Integer i;
for (i = 1; i <= edges.Length(); i++) {
@@ -2783,6 +2886,15 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
if (aProcessed.Contains(aCheckedFace))
continue;
// Get shells connected to the checked face
const TopTools_MapOfShape* pFShells2 = theGMapFaceShells.Seek (aCheckedFace);
// Faces can be unified only if the shells of faces connected to
// these faces are the same. Otherwise, topology would be broken.
if (!isSameSets (pFShells1, pFShells2))
{
continue;
}
if (bCheckNormals) {
// get normal of checked face using the same parameter on edge
gp_Dir aDN2;
@@ -2965,29 +3077,107 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
TopTools_IndexedDataMapOfShapeListOfShape VEmap;
for (Standard_Integer ind = 1; ind <= edges.Length(); ind++)
TopExp::MapShapesAndUniqueAncestors(edges(ind), TopAbs_VERTEX, TopAbs_EDGE, VEmap);
//Try to find seam edge and an edge that is not seam but has 2 pcurves on the surface
Standard_Boolean SeamFound = Standard_False;
TopoDS_Edge EdgeWith2pcurves;
for (Standard_Integer ii = 1; ii <= faces.Length(); ii++)
{
const TopoDS_Face& face_ii = TopoDS::Face(faces(ii));
TopoDS_Wire anOuterWire = BRepTools::OuterWire(face_ii);
TopoDS_Iterator itw(anOuterWire);
for (; itw.More(); itw.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itw.Value());
if (BRep_Tool::IsClosed (anEdge, face_ii))
{
if (BRepTools::IsReallyClosed(anEdge, face_ii))
SeamFound = Standard_True;
else
EdgeWith2pcurves = anEdge;
}
}
}
Standard_Boolean aIsEdgeWith2pcurvesSmooth = Standard_False;
if (myConcatBSplines && !EdgeWith2pcurves.IsNull() && !SeamFound)
{
const TopTools_ListOfShape& aFaceList = theGMapEdgeFaces.FindFromKey (EdgeWith2pcurves);
const TopoDS_Face& aFace1 = TopoDS::Face (aFaceList.First());
const TopoDS_Face& aFace2 = TopoDS::Face (aFaceList.Last());
GeomAbs_Shape anOrderOfCont = BRepLib::ContinuityOfFaces (EdgeWith2pcurves,
aFace1, aFace2,
myAngTol);
aIsEdgeWith2pcurvesSmooth = (anOrderOfCont >= GeomAbs_G1);
}
if (aIsEdgeWith2pcurvesSmooth)
{
Handle(Geom2d_Curve) aPC1, aPC2;
Standard_Real aFirst, aLast;
aPC1 = BRep_Tool::CurveOnSurface (EdgeWith2pcurves, F_RefFace, aFirst, aLast);
EdgeWith2pcurves.Reverse();
aPC2 = BRep_Tool::CurveOnSurface (EdgeWith2pcurves, F_RefFace, aFirst, aLast);
gp_Pnt2d aPnt1 = aPC1->Value (aFirst);
gp_Pnt2d aPnt2 = aPC2->Value (aFirst);
Standard_Boolean anIsUclosed = (Abs(aPnt1.X() - aPnt2.X()) > Abs(aPnt1.Y() - aPnt2.Y()));
Standard_Boolean aToMakeUPeriodic = Standard_False, aToMakeVPeriodic = Standard_False;
if (anIsUclosed && Uperiod == 0.)
aToMakeUPeriodic = Standard_True;
if (!anIsUclosed && Vperiod == 0.)
aToMakeVPeriodic = Standard_True;
if (aToMakeUPeriodic || aToMakeVPeriodic)
{
Handle(Geom_BSplineSurface) aBSplineSurface = Handle(Geom_BSplineSurface)::DownCast(aBaseSurface);
if (aBSplineSurface.IsNull())
{
Standard_Real aTol = 1.e-4;
GeomAbs_Shape aUCont = GeomAbs_C1, aVCont = GeomAbs_C1;
Standard_Integer degU = 14, degV = 14;
Standard_Integer nmax = 16;
Standard_Integer aPrec = 1;
GeomConvert_ApproxSurface Approximator(aBaseSurface,aTol,aUCont,aVCont,degU,degV,nmax,aPrec);
aBSplineSurface = Approximator.Surface();
}
if (aToMakeUPeriodic)
{
aBSplineSurface->SetUPeriodic();
Uperiod = aBSplineSurface->UPeriod();
}
if (aToMakeVPeriodic)
{
aBSplineSurface->SetVPeriodic();
Vperiod = aBSplineSurface->VPeriod();
}
//Update ref face and pcurves if the surface changed
if (aBSplineSurface != aBaseSurface)
{
TopoDS_Face OldRefFace = RefFace;
Handle(Geom2d_Curve) NullPCurve;
RefFace.Nullify();
BB.MakeFace(RefFace, aBSplineSurface, aBaseLocation, 0.);
for (Standard_Integer ii = 1; ii <= edges.Length(); ii++)
{
TopoDS_Edge anEdge = TopoDS::Edge(edges(ii));
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface (anEdge, OldRefFace, aFirst, aLast);
if (MapEdgesWithTemporaryPCurves.Contains(anEdge))
BB.UpdateEdge(anEdge, NullPCurve, OldRefFace, 0.);
BB.UpdateEdge(anEdge, aPCurve, RefFace, 0.);
}
F_RefFace = RefFace;
F_RefFace.Orientation(TopAbs_FORWARD);
}
}
} //if (myConcatBSplines && !EdgeWith2pcurves.IsNull() && !SeamFound)
//Perform relocating to new U-origin
//Define boundaries in 2d space of RefFace
if (Uperiod != 0.)
{
//try to find a real seam edge - if it exists, do nothing
Standard_Boolean SeamFound = Standard_False;
for (Standard_Integer ii = 1; ii <= faces.Length(); ii++)
{
const TopoDS_Face& face_ii = TopoDS::Face(faces(ii));
TopoDS_Wire anOuterWire = BRepTools::OuterWire(face_ii);
TopoDS_Iterator itw(anOuterWire);
for (; itw.More(); itw.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itw.Value());
if (BRepTools::IsReallyClosed(anEdge, face_ii))
{
SeamFound = Standard_True;
break;
}
}
}
//if seam edge exists, do nothing
if (!SeamFound)
{
//try to find the origin of U in 2d space
@@ -3189,6 +3379,10 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
if (NextEdge.IsNull())
{
Standard_Boolean EndOfWire = Standard_False;
Standard_Boolean anIsOnSingularity = IsOnSingularity (Elist);
if (!anIsOnSingularity && Elist.Extent() > 1)
SplittingVertices.Add (CurVertex);
TopTools_ListOfShape TmpElist, TrueElist;
//<TrueElist> will be the list of candidates to become <NextEdge>
@@ -3208,7 +3402,6 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
else
{
//we must choose the closest direction - the biggest angle
SplittingVertices.Add (CurVertex);
Standard_Real MaxAngle = RealFirst();
TopoDS_Edge TrueEdge;
Handle(Geom2d_Curve) CurPCurve = BRep_Tool::CurveOnSurface(CurEdge, F_RefFace, fpar, lpar);

View File

@@ -71,6 +71,7 @@ class ShapeUpgrade_UnifySameDomain : public Standard_Transient
public:
typedef NCollection_DataMap<TopoDS_Shape, Handle(Geom_Plane), TopTools_ShapeMapHasher> DataMapOfFacePlane;
typedef NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> DataMapOfShapeMapOfShape;
//! Empty constructor
Standard_EXPORT ShapeUpgrade_UnifySameDomain();
@@ -169,7 +170,8 @@ protected:
Standard_EXPORT void UnifyEdges();
void IntUnifyFaces(const TopoDS_Shape& theInpShape,
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const DataMapOfShapeMapOfShape& theGMapFaceShells,
const TopTools_MapOfShape& theFreeBoundMap);
//! Splits the sequence of edges into the sequence of chains

View File

@@ -0,0 +1,24 @@
puts "================================================================================"
puts "OCC29382: ShapeUpgrade_UnifySameDomain algorithm incorrectly processes the shape"
puts "================================================================================"
puts ""
restore [locate_data_file bug29382_Group_3.brep] a
unifysamedom result a +b
checkshape result
checkshape a
checknbshapes result -solid 3 -shell 3 -face 16 -wire 16 -edge 30 -vertex 18
set tolres [checkmaxtol result]
if { ${tolres} > 1.8066863810061599e-05} {
puts "Error: bad tolerance of result"
}
explode result
checkprops result_1 -v 4.41996e-06
checkprops result_2 -v 1.30453e-06
checkprops result_3 -v 1.16532e-06

View File

@@ -0,0 +1,24 @@
puts "================================================================================"
puts "OCC29382: ShapeUpgrade_UnifySameDomain algorithm incorrectly processes the shape"
puts "================================================================================"
puts ""
beziercurve a 5 0 0 0 1 0 0 2 2 0 0 0.5 0 0 0 0
mkedge a a
wire a a
mkplane a a
prism a a 0 0 1
box b -0.3 -0.2 0 1 0.4 1
bcommon shape a b
unifysamedom result shape +b
checkshape result
checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 9 -vertex 5
set tolres [checkmaxtol result]
if { ${tolres} > 6.e-6} {
puts "Error: bad tolerance of result"
}

View File

@@ -0,0 +1,23 @@
puts "=============================================="
puts "OCC32814: Unifysamedom produces invalid result"
puts "=============================================="
puts ""
restore [locate_data_file bug32814_1.brep] s
unifysamedom result s -a 1e-4
checkshape result
bopargcheck result
checknbshapes result -t -face 7 -wire 13 -edge 70 -vertex 64
set tolres [checkmaxtol result]
if { ${tolres} > 1.e-7} {
puts "Error: bad tolerance of result"
}
checkprops result -s 5.54082e+06
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,23 @@
puts "=============================================="
puts "OCC32814: Unifysamedom produces invalid result"
puts "=============================================="
puts ""
restore [locate_data_file bug32814_2.brep] s
unifysamedom result s
checkshape result
bopargcheck result
checknbshapes result -t -solid 1 -shell 1 -face 78 -wire 110 -edge 220 -vertex 136
set tolres [checkmaxtol result]
if { ${tolres} > 2.e-7} {
puts "Error: bad tolerance of result"
}
checkprops result -s 1.61456e+06 -v 3e+07
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,71 @@
puts "========================"
puts " 0033171: Modeling Algorithms - Invalid result of faces unification"
puts "========================"
puts ""
# make outer prism
polyline p 0 0 0 10 0 0 10 10 0 0 10 0 0 0 0
mkplane f p
prism s f 0 0 5
# make section shells
polyline p1 3 10 0 3 7 0 6 7 0 6 3 0 10 3 0
polyline p2 6 7 0 10 7 0
polyline p3 8 7 0 8 10 0
polyline p4 0 5 0 10 5 0
prism sh1 p1 0 0 5
prism sh2 p2 0 0 5
prism sh3 p3 0 0 5
prism sh4 p4 0 0 5
# split the prism
bclearobjects
bcleartools
baddobjects s
baddtools sh1 sh2 sh3 sh4
bfillds
bsplit r
checkshape r
if {![regexp "This shape seems to be OK" [bopcheck r]]} {
puts "Error: invalid shape after split"
}
# try to unify faces in the result compound
unifysamedom ru1 r
unifysamedom ru2 r +i
checkshape ru1
checkshape ru2
checknbshapes ru1 -ref [nbshapes r -t] -t
checknbshapes ru2 -ref [nbshapes r -t] -t
if {![regexp "This shape seems to be OK" [bopcheck ru1]]} {
puts "Error: invalid shape after faces unification"
}
if {![regexp "This shape seems to be OK" [bopcheck ru2]]} {
puts "Error: invalid shape after faces unification"
}
# make compound of shells
eval compound [explode r] shs
unifysamedom shsu1 r
unifysamedom shsu2 r +i
checkshape shsu1
checkshape shsu2
checknbshapes shsu1 -ref [nbshapes shs -t] -t
checknbshapes shsu2 -ref [nbshapes shs -t] -t
if {![regexp "This shape seems to be OK" [bopcheck shsu1]]} {
puts "Error: invalid shape after faces unification"
}
if {![regexp "This shape seems to be OK" [bopcheck shsu2]]} {
puts "Error: invalid shape after faces unification"
}
checkview -display ru2 -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,57 @@
puts "========================"
puts " 0033171: Modeling Algorithms - Invalid result of faces unification"
puts "========================"
puts ""
# make two solids
box b1 10 10 5
box b2 10 0 0 5 5 5
# make shared
bclearobjects
bcleartools
baddobjects b1 b2
bfillds
bbuild r
checkshape r
if {![regexp "This shape seems to be OK" [bopcheck r]]} {
puts "Error: invalid shape after fuse"
}
# try to unify faces in the result compound
unifysamedom ru1 r
unifysamedom ru2 r +i
checkshape ru1
checkshape ru2
checknbshapes ru1 -ref [nbshapes r -t] -t
checknbshapes ru2 -ref [nbshapes r -t] -t
if {![regexp "This shape seems to be OK" [bopcheck ru1]]} {
puts "Error: invalid shape after faces unification"
}
if {![regexp "This shape seems to be OK" [bopcheck ru2]]} {
puts "Error: invalid shape after faces unification"
}
# make compound of shells
eval compound [explode r] shs
unifysamedom shsu1 r
unifysamedom shsu2 r +i
checkshape shsu1
checkshape shsu2
checknbshapes shsu1 -ref [nbshapes shs -t] -t
checknbshapes shsu2 -ref [nbshapes shs -t] -t
if {![regexp "This shape seems to be OK" [bopcheck shsu1]]} {
puts "Error: invalid shape after faces unification"
}
if {![regexp "This shape seems to be OK" [bopcheck shsu2]]} {
puts "Error: invalid shape after faces unification"
}
checkview -display ru2 -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,13 @@
puts "============"
puts "0033227: Modeling Algorithm - BOPAlgo_BuilderSolid generates incomplete result"
puts "============"
puts ""
restore [locate_data_file bug33227.brep] s
bopbsolid r s
compound r_2 r_3 res
checknbshapes res -shell 6 -solid 2
checkprops res -v 3.33117e+07
checkview -display res -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,7 @@
restore [locate_data_file bug33420.brep] s
OFFSETSHAPE 35 {} $calcul $type
checkprops result -v 4.04602e+07
checknbshapes result -face 43 -shell 1

View File

@@ -1,7 +1,11 @@
restore [locate_data_file bug25926_before_offset.brep] s
OFFSETSHAPE 50 {} $calcul $type
explode s so
offsetparameter 1e-7 c i r
offsetload s_1 50
offsetperform result
checkprops result -v 3.68672e+008
checkprops result -s 4.96128e+06 -v 3.68655e+08
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -wire 12 -face 12 -shell 1 -solid 1

View File

@@ -1,8 +1,10 @@
restore [locate_data_file bug25926_before_offset_trim1.brep] s
OFFSETSHAPE 50 {} $calcul $type
offsetparameter 1e-7 c i r
offsetload s 50
offsetperform result
checkprops result -v 3.61993e+007
checkprops result -s 696458
checkprops result -s 694900 -v 3.6175e+07
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -wire 9 -face 9 -shell 1 -solid 1

View File

@@ -7,7 +7,7 @@ restore [locate_data_file bug25926_offset_shape_trim3.brep] s
OFFSETSHAPE 12 {} $calcul $type
checkprops result -v 948181 -s 66208.6
checkprops result -v 948181 -s 66208.6 -deps 1.e-3
unifysamedom result_unif result
checknbshapes result_unif -shell 1 -face 14

View File

@@ -0,0 +1,8 @@
restore [locate_data_file bug33298.brep] s
OFFSETSHAPE 35 {} $calcul $type
checkprops result -v 1.20105e+08
checknbshapes result -shell 1

View File

@@ -0,0 +1,8 @@
restore [locate_data_file bug33298_trimmed.brep] s
OFFSETSHAPE 35 {} $calcul $type
checkprops result -v 7.3756e+07
checknbshapes result -shell 1

View File

@@ -1,5 +1,3 @@
puts "TODO CR27414 ALL: Error : is WRONG because number of FACE entities in shape"
restore [locate_data_file bug26917_dom-8092_trim3.brep] s
offsetparameter 1e-7 $calcul $type

View File

@@ -1,5 +1,3 @@
puts "TODO CR27414 ALL: Error : is WRONG because number of FACE entities in shape"
restore [locate_data_file bug26917_dom-8092_trim4.brep] s
offsetparameter 1e-7 $calcul $type

View File

@@ -1,5 +1,3 @@
puts "TODO CR27414 ALL: Error : is WRONG because number of FACE entities in shape"
restore [locate_data_file bug26917_dom-8092_simple.brep] s
offsetparameter 1e-7 $calcul $type

View File

@@ -7,7 +7,7 @@ restore [locate_data_file bug26917_25926_offset_shape_trim4.brep] s
OFFSETSHAPE 12 {} $calcul $type
checkprops result -v 643336 -s 45602.9
checkprops result -v 643336 -s 45602.9 -deps 1.e-3
unifysamedom result_unif result
checknbshapes result_unif -shell 1 -face 8

View File

@@ -1,6 +1,6 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: Tcl Exception"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
puts "TODO OCC27414 ALL: Error : is WRONG because number of"
puts "TODO OCC27414 ALL: Error : The area of result shape is"
puts "TODO OCC27414 ALL: Error : The volume of result shape is"
restore [locate_data_file bug26917_dom-8092.t6c1_trim5_with_faces.brep] c

View File

@@ -4,9 +4,9 @@ offsetparameter 1e-7 c i r
offsetload s 8
offsetperform result
checkprops result -v 4.40128e+007 -s 1.81672e+006
checkprops result -s 1.81645e+06 -v 4.40127e+07
unifysamedom result_unif result
checknbshapes result_unif -edge 186 -face 64 -shell 1
checknbshapes result_unif -wire 62 -face 62 -shell 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,17 @@
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_Z4_trim.brep] s
offsetparameter 1e-7 c i r
offsetload s 9.5
offsetperform result
checkprops result -s 88948.9 -v 1.11587e+06
unifysamedom result_unif result
checknbshapes result_unif -wire 15 -face 15 -shell 1 -solid 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,31 @@
puts "TODO CR27414 ALL: Error: operation with offset value 7 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 8 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 9 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 10 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 11 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 12 has failed"
puts "TODO CR27414 ALL: Operations with following offset values have failed: 7 8 9 10 11 12"
puts "TODO CR27414 ALL: Error : The offset cannot be built"
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
# This is a simplified version of XZ7 case
restore [locate_data_file bug32333_178_trim4.brep] s
set ref_values { { 94323.2 1.42329e+06 14 14 } \
{ 98288.3 1.51959e+06 14 14 } \
{ 102311 1.61989e+06 14 14 } \
{ 106392 1.72423e+06 14 14 } \
{ 110531 1.83269e+06 14 14 } \
{ 114728 1.94532e+06 14 14 } }
perform_offset_increasing s 7 12 1 $ref_values
#copy r10 result
#copy r10_unif result_unif
#checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,7 +1,4 @@
puts "TODO CR32333 ALL: Error : The area of result shape is"
puts "TODO CR32333 ALL: Error : The command is not valid."
puts "TODO CR32333 ALL: Error : The volume of result shape is"
puts "TODO CR32333 ALL: Error : is WRONG because number of"
puts "TODO CR27414 ALL: Error : is WRONG because number of"
puts "============================================================================================="
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
@@ -17,6 +14,6 @@ offsetperform result
checkprops result -s 3.1312e+06 -v 5.77267e+07
unifysamedom result_unif result
checknbshapes result_unif -wire 492 -face 492 -shell 1 -solid 1
checknbshapes result_unif -wire 491 -face 492 -shell 1 -solid 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,7 +1,3 @@
puts "TODO OCC32333 ALL: Error: The command cannot be built"
puts "TODO OCC32333 ALL: gives an empty result"
puts "TODO OCC32333 ALL: TEST INCOMPLETE"
puts "============================================================================================="
puts "0032088: Modeling Algorithms - Empty result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="

View File

@@ -0,0 +1,29 @@
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_ZU6_trim.brep] s
set ref_values { { 154279 1.16809e+06 31 31 } \
{ 159804 1.32512e+06 31 31 } \
{ 165387 1.48771e+06 31 31 } \
{ 171028 1.65592e+06 31 31 } \
{ 148419 1.82979e+06 29 29 } \
{ 132204 1.98042e+06 17 17 } \
{ 136267 2.11465e+06 17 17 } \
{ 125291 2.25298e+06 13 13 } \
{ 129494 2.38037e+06 13 13 } \
{ 133767 2.51199e+06 13 13 } \
{ 138109 2.64793e+06 13 13 } \
{ 142522 2.78824e+06 13 13 } \
{ 147004 2.93299e+06 13 13 } \
{ 151557 3.08227e+06 13 13 } \
{ 156179 3.23613e+06 13 13 } }
perform_offset_increasing s 1 15 1 $ref_values
copy r10 result
copy r10_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,29 @@
puts "TODO CR27414 ALL: Error: number of wire entities in the result"
puts "TODO CR27414 ALL: Error: number of face entities in the result"
puts "TODO CR27414 ALL: Error: operation with offset value 10 has failed"
puts "TODO CR27414 ALL: Operations with following offset values have failed: 10"
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_172.brep] s
set ref_values { { 2.68545e+06 6.72361e+07 386 386 } \
{ 2.69691e+06 6.99355e+07 330 330 } \
{ 2.73363e+06 7.26508e+07 330 330 } \
{ 2.74228e+06 7.54028e+07 166 166 } \
{ 2.78873e+06 7.81683e+07 166 166 } \
{ 2.82923e+06 8.09803e+07 106 106 } \
{ 2.88058e+06 8.38352e+07 106 106 } \
{ 2.93204e+06 8.67414e+07 106 106 } \
{ 2.65427e+06 8.95363e+07 6 6 } \
{ 2.69318e+06 9.22106e+07 6 6 } }
perform_offset_increasing s 1 10 1 $ref_values
copy r5 result
copy r5_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,30 @@
puts "TODO CR27414 ALL: Error: number of wire entities in the result"
puts "TODO CR27414 ALL: Error: number of face entities in the result"
puts "TODO CR27414 ALL: Error: operation with offset value 9 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 10 has failed"
puts "TODO CR27414 ALL: Operations with following offset values have failed: 9 10"
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_172_trim1.brep] s
set ref_values { { 171093 2.538e+06 42 42 } \
{ 169448 2.70883e+06 41 41 } \
{ 174262 2.88068e+06 41 41 } \
{ 176065 3.05738e+06 25 25 } \
{ 181589 3.2362e+06 25 25 } \
{ 185420 3.42058e+06 17 17 } \
{ 191400 3.60898e+06 17 17 } \
{ 197447 3.8034e+06 17 17 } \
{ 175027 3.98979e+06 11 11 } \
{ 179953 4.16727e+06 11 11 } }
perform_offset_increasing s 1 10 1 $ref_values
copy r5 result
copy r5_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,27 @@
puts "TODO CR27414 ALL: Error: operation with offset value 9 has failed"
puts "TODO CR27414 ALL: Operations with following offset values have failed: 9"
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_172_trim2.brep] s
set ref_values { { 82542.8 820795 18 18 } \
{ 82089.5 903148 19 19 } \
{ 86737.5 987555 19 19 } \
{ 91176.7 1.07665e+06 15 15 } \
{ 95898.3 1.17018e+06 15 15 } \
{ 100690 1.26847e+06 15 15 } \
{ 105551 1.37158e+06 15 15 } \
{ 110483 1.47959e+06 15 15 } \
{ 98501.1 1.58422e+06 5 5 } \
{ 102414 1.68468e+06 5 5 } }
perform_offset_increasing s 1 10 1 $ref_values
copy r5 result
copy r5_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,21 @@
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_178.brep] s
set ref_values { { 6.2988e+06 1.0009e+08 1590 1590 } \
{ 6.46295e+06 1.12852e+08 1556 1556 } \
{ 6.59935e+06 1.25914e+08 1585 1570 } \
{ 5.67319e+06 1.38166e+08 552 552 } \
{ 5.52249e+06 1.49358e+08 260 260 } \
{ 5.72672e+06 1.60607e+08 260 260 } \
{ 4.90877e+06 1.71755e+08 44 44 } }
perform_offset_increasing s 1 13 2 $ref_values
copy r5 result
copy r5_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,37 @@
puts "TODO CR27414 ALL: Error: operation with offset value 7 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 8 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 9 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 10 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 11 has failed"
puts "TODO CR27414 ALL: Error: operation with offset value 12 has failed"
puts "TODO CR27414 ALL: Operations with following offset values have failed: 7 8 9 10 11 12"
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_178_trim1.brep] s
set ref_values { { 237838 3.74252e+06 61 61 } \
{ 241858 3.98236e+06 61 61 } \
{ 245948 4.22626e+06 59 59 } \
{ 250116 4.47428e+06 59 59 } \
{ 245191 4.72003e+06 60 60 } \
{ 236043 4.96659e+06 29 29 } \
{ 241534 5.20537e+06 25 25 } \
{ 245656 5.44968e+06 17 17 } \
{ 251925 5.69846e+06 17 17 } \
{ 258263 5.95355e+06 17 17 } \
{ 264668 6.21501e+06 17 17 } \
{ 271141 6.48291e+06 17 17 } \
{ 243904 6.74052e+06 9 9 } \
{ 249735 6.98734e+06 9 9 } \
{ 255633 7.24002e+06 9 9 } }
perform_offset_increasing s 1 15 1 $ref_values
copy r5 result
copy r5_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,29 @@
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_178_trim2.brep] s
set ref_values { { 72863.6 1.02754e+06 24 24 } \
{ 75700.8 1.10182e+06 24 24 } \
{ 78584.1 1.17895e+06 24 24 } \
{ 81513.2 1.259e+06 24 24 } \
{ 84488.3 1.342e+06 24 24 } \
{ 87509.3 1.42799e+06 24 24 } \
{ 90576.3 1.51703e+06 24 24 } \
{ 91698.4 1.60916e+06 16 16 } \
{ 94791 1.7024e+06 16 16 } \
{ 97929.5 1.79876e+06 16 16 } \
{ 101114 1.89827e+06 16 16 } \
{ 104344 2.001e+06 16 16 } \
{ 107621 2.10698e+06 16 16 } \
{ 110943 2.21626e+06 16 16 } \
{ 114311 2.32888e+06 16 16 } }
perform_offset_increasing s 1 15 1 $ref_values
copy r5 result
copy r5_unif result_unif
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,17 @@
puts "============================================================================================="
puts "0032333: Modeling Algorithms - Empty(wrong) result of offset operation in mode \"Complete\" join type \"Intersection\""
puts "============================================================================================="
puts ""
restore [locate_data_file bug32333_178_trim3.brep] s
offsetparameter 1e-7 c i r
offsetload s 15
offsetperform result
checkprops result -s 117600 -v 2.73811e+06
unifysamedom result_unif result
checknbshapes result_unif -wire 7 -face 7 -shell 1 -solid 1
checkview -display result_unif -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,7 +1,10 @@
restore [locate_data_file bug26917_M2_trim4.brep] s
OFFSETSHAPE 8 {} $calcul $type
offsetparameter 1e-7 c i r
offsetload s 8
offsetperform result
checkprops result -v 4.65244e+006
checkprops result -s 279365 -v 4.65244e+06
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -wire 72 -face 72 -shell 1 -solid 1

View File

@@ -1,10 +1,13 @@
puts "TODO CR27414 ALL: Error : The area of result shape is"
puts "TODO CR27414 ALL: Error : The volume of result shape is"
puts "TODO OCC27414 ALL: Error : is WRONG because number of"
puts "TODO OCC27414 ALL: Error : The area of result shape is"
puts "TODO OCC27414 ALL: Error : The volume of result shape is"
puts "TODO OCC27414 ALL: Error: bsection of the result and s is not equal to zero"
restore [locate_data_file bug26917_M2_trim22.brep] s
OFFSETSHAPE 8 {} $calcul $type
checkprops result -v 1.1318e+006 -s 69137.2
checkprops result -s 69299.9 -v 1.08094e+06 -deps 1.e-3
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -wire 19 -face 19 -shell 1 -solid 1

View File

@@ -1,3 +1,5 @@
puts "TODO OCC27414 ALL: Error : The area of result shape is"
restore [locate_data_file bug26917_M2_trim33.brep] s
OFFSETSHAPE 8 {} $calcul $type

View File

@@ -1,11 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
puts "TODO OCC27414 ALL: Error : is WRONG because number of"
puts "TODO OCC27414 ALL: Error : The area of result shape is"
puts "TODO OCC27414 ALL: Error : The volume of result shape is"
restore [locate_data_file bug26917_M2_trim35.brep] s
OFFSETSHAPE 8 {} $calcul $type
checkprops result -v 0
checkprops result -s 30085.9 -v 282977 -deps 1.e-3
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -wire 9 -face 9 -shell 1 -solid 1

View File

@@ -1,11 +1,12 @@
puts "TODO OCC27414 ALL: Error: The command cannot be built"
puts "TODO OCC27414 ALL: gives an empty result"
puts "TODO OCC27414 ALL: TEST INCOMPLETE"
puts "TODO OCC27414 ALL: Error : is WRONG because number of"
puts "TODO OCC27414 ALL: Error : The area of result shape is"
puts "TODO OCC27414 ALL: Error : The volume of result shape is"
restore [locate_data_file bug26917_M2_trim9.brep] s
OFFSETSHAPE 15 {} $calcul $type
checkprops result -s 0 -v 0
checkprops result -s 29576.6 -v 276693
checknbshapes result -shell 1
unifysamedom result_unif result
checknbshapes result_unif -wire 16 -face 16 -shell 1 -solid 1

View File

@@ -7,4 +7,4 @@ offsetperform result
checkprops result -s 6.21471e+06 -v 8.95633e+08
unifysamedom result_unif result
checknbshapes result_unif -wire 140 -face 138 -shell 1 -solid 1
checknbshapes result_unif -wire 142 -face 140 -shell 1 -solid 1

View File

@@ -21,7 +21,7 @@ restore [locate_data_file bug31148_plate_split.brep] s
perform_offset_multi_with_ref r0_01 s 0 {6 10 14} {1 5 1} {464 244 26 26} 1; # BAD (null shape)
perform_offset_multi_with_ref r0_02 s 0 {9 11} {5 5} {448 244 24 23} 1; # BAD (filled part)
perform_offset_multi_with_ref r0_03 s 0 {6 9 11 14} {1 5 5 1} {464 268 36 35} 1; # BAD (mostly removed)
perform_offset_multi_with_ref r0_03 s 0 {6 9 11 14} {1 5 5 1} {464 268 36 35} 1; # BAD (internal part is filled)
perform_offset_multi_with_ref r0_04 s 0 {8 10 12} {5 5 5} {464 276 22 20} 1; # BAD (out of borders)
perform_offset_multi_with_ref r0_05 s 0 {6 8 10 12 14 } {1 5 5 5 1} {464 292 30 28} 1
perform_offset_multi_with_ref r0_06 s 0 {7 9 11 13} {1 3 3 1} {424 236 28 27} 1