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

0028949: BRepOffsetAPI_MakePipe Generated() method produces no result for spine edges

Add history for subshapes of spine: edges and vertices. Each edge of spine generates a shell. Each vertex of spine generates a set of edges and, possibly, faces (in the case of Round Corner).
This commit is contained in:
jgv
2018-09-13 16:17:21 +03:00
committed by bugmaster
parent 4ba5491a50
commit a922aab52c
14 changed files with 496 additions and 8 deletions

View File

@@ -1409,6 +1409,73 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
inde++;
}
}
//For subshapes of spine
const Handle(TopTools_HArray2OfShape)& aFaces = theSweep.SubShape();
const Handle(TopTools_HArray2OfShape)& aVEdges = theSweep.Sections();
BRepTools_WireExplorer wexp(mySpine);
inde = 0;
Standard_Boolean ToExit = Standard_False;
for (;;)
{
if (!wexp.More())
ToExit = Standard_True;
inde++;
if (!ToExit)
{
const TopoDS_Edge& anEdgeOfSpine = wexp.Current();
TopoDS_Shell aShell;
BB.MakeShell(aShell);
for (Standard_Integer i = 1; i <= aFaces->UpperRow(); i++)
{
const TopoDS_Shape& aFace = aFaces->Value(i, inde);
if (aFace.ShapeType() == TopAbs_FACE)
BB.Add(aShell, aFace);
}
TopTools_ListOfShape ListShell;
ListShell.Append(aShell);
myGenMap.Bind(anEdgeOfSpine, ListShell);
}
const TopoDS_Vertex& aVertexOfSpine = wexp.CurrentVertex();
TopTools_ListOfShape ListVshapes;
for (Standard_Integer i = 1; i <= aVEdges->UpperRow(); i++)
{
const TopoDS_Shape& aVshape = aVEdges->Value(i, inde);
if (aVshape.ShapeType() == TopAbs_EDGE ||
aVshape.ShapeType() == TopAbs_FACE)
ListVshapes.Append(aVshape);
else
{
TopoDS_Iterator itvshape(aVshape);
for (; itvshape.More(); itvshape.Next())
{
const TopoDS_Shape& aSubshape = itvshape.Value();
if (aSubshape.ShapeType() == TopAbs_EDGE ||
aSubshape.ShapeType() == TopAbs_FACE)
ListVshapes.Append(aSubshape);
else
{
//it is wire
for (itw.Initialize(aSubshape); itw.More(); itw.Next())
ListVshapes.Append(itw.Value());
}
}
}
}
myGenMap.Bind(aVertexOfSpine, ListVshapes);
if (ToExit)
break;
if (wexp.More())
wexp.Next();
}
}

View File

@@ -192,6 +192,12 @@ public:
theProfiles.Append(mySeq(i).OriginalShape());
}
//! Returns the spine
const TopoDS_Wire& Spine()
{
return mySpine;
}
//! Returns the list of shapes generated from the
//! shape <S>.
Standard_EXPORT void Generated (const TopoDS_Shape& S, TopTools_ListOfShape& L);

View File

@@ -2941,9 +2941,10 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
// Management of looping ends
if ( (NbTrous>0) && (myLoc->IsClosed()) &&
(Trous->Value(NbTrous) == NbPath+1) ) {
Translate(myVEdges, NbPath+1, Bounds, 1);
Translate(myVEdges, 1, Bounds, 2);
Translate(myVEdges, NbPath+1, Bounds, 1);
Translate(myVEdges, 1, Bounds, 2);
PerformCorner(1, Transition, Bounds);
Translate(myVEdges, 1, myVEdges, NbPath+1);
}
// Construction of the shell
@@ -3041,7 +3042,8 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
for (jj = myUEdges->LowerCol(); jj <= myUEdges->UpperCol(); jj++)
{
TopoDS_Edge anEdge = TopoDS::Edge(myUEdges->Value(ii, jj));
if (anEdge.IsNull())
if (anEdge.IsNull() ||
BRep_Tool::Degenerated(anEdge))
continue;
TopoDS_Face Face1, Face2;
Standard_Integer i1 = ii-1, i2 = ii;
@@ -3266,10 +3268,27 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
BRepFill_TrimShellCorner aTrim(aFaces, Transition, AxeOfBisPlane);
aTrim.AddBounds(Bounds);
aTrim.AddUEdges(aUEdges);
aTrim.AddVEdges(myVEdges, Index);
aTrim.Perform();
if (aTrim.IsDone()) {
TopTools_ListOfShape listmodif;
for (ii = 1; ii <= mySec->NbLaw(); ii++)
{
listmodif.Clear();
aTrim.Modified(myVEdges->Value(ii, Index), listmodif);
if (listmodif.IsEmpty())
{
TopoDS_Edge NullEdge;
myVEdges->SetValue(ii, Index, NullEdge);
}
else
myVEdges->SetValue(ii, Index, listmodif.First());
}
listmodif.Clear();
Standard_Integer iit = 0;
for(iit = 0; iit < 2; iit++) {
@@ -3356,8 +3375,15 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
if (B) {
myAuxShape.Append(FF);
myVEdges->ChangeValue(ii, I2) = FF;
BRep_Builder BB;
TopoDS_Shape aVshape = myVEdges->Value(ii, I2);
TopoDS_Compound aCompound;
BB.MakeCompound(aCompound);
if (!aVshape.IsNull())
BB.Add(aCompound, aVshape);
BB.Add(aCompound, FF);
myVEdges->ChangeValue(ii, I2) = aCompound;
BB.Add(myTapes->ChangeValue(ii), FF);
HasFilling = Standard_True;
}

View File

@@ -91,6 +91,11 @@ static Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& t
const BOPDS_PDS& theDS,
TopTools_DataMapOfShapeListOfShape& theHistMap);
static void StoreVedgeInHistMap(const Handle(TopTools_HArray1OfShape)& theVEdges,
const Standard_Integer theIndex,
const TopoDS_Shape& theNewVedge,
TopTools_DataMapOfShapeListOfShape& theHistMap);
static void FindFreeVertices(const TopoDS_Shape& theShape,
const TopTools_MapOfShape& theVerticesToAvoid,
TopTools_ListOfShape& theListOfVertex);
@@ -229,6 +234,19 @@ void BRepFill_TrimShellCorner::AddUEdges(const Handle(TopTools_HArray2OfShape)&
myUEdges->ChangeArray2() = theUEdges->Array2();
}
// ===========================================================================================
// function: AddVEdges
// purpose:
// ===========================================================================================
void BRepFill_TrimShellCorner::AddVEdges(const Handle(TopTools_HArray2OfShape)& theVEdges,
const Standard_Integer theIndex)
{
myVEdges = new TopTools_HArray1OfShape(theVEdges->LowerRow(), theVEdges->UpperRow());
for (Standard_Integer i = theVEdges->LowerRow(); i <= theVEdges->UpperRow(); i++)
myVEdges->SetValue(i, theVEdges->Value(i, theIndex));
}
// ===========================================================================================
// function: Perform
// purpose:
@@ -479,9 +497,12 @@ BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer
aMapV.Add(aV);
aBB.Add(aComp, aUE);
}
if(bHasNewEdge) {
aBB.Add(aComp, aNewEdge);
StoreVedgeInHistMap(myVEdges, theIndex, aNewEdge, myHistMap);
}
TopTools_ListOfShape alonevertices;
FindFreeVertices(aComp, aMapV, alonevertices);
@@ -686,6 +707,8 @@ BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer
for (; explo.More(); explo.Next())
BB.Add( aComp, explo.Current() );
aSecEdges = aComp;
StoreVedgeInHistMap(myVEdges, theIndex, SecWire, myHistMap);
}
TopTools_ListOfShape aCommonVertices;
@@ -1123,6 +1146,22 @@ Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdge
return Standard_True;
}
// ------------------------------------------------------------------------------------------
// static function: StoreVedgeInHistMap
// purpose:
// ------------------------------------------------------------------------------------------
void StoreVedgeInHistMap(const Handle(TopTools_HArray1OfShape)& theVEdges,
const Standard_Integer theIndex,
const TopoDS_Shape& theNewVshape,
TopTools_DataMapOfShapeListOfShape& theHistMap)
{
//Replace default value in the map (v-iso edge of face)
//by intersection of two consecutive faces
const TopoDS_Shape& aVEdge = theVEdges->Value(theIndex);
theHistMap.Bound(aVEdge, TopTools_ListOfShape())->Append(theNewVshape);
}
// ------------------------------------------------------------------------------------------
// static function: FindFreeVertices
// purpose:

View File

@@ -26,6 +26,7 @@
#include <TopoDS_Wire.hxx>
#include <TopoDS_Face.hxx>
#include <TopTools_HArray2OfShape.hxx>
#include <TopTools_HArray1OfShape.hxx>
#include <Standard_Boolean.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
@@ -55,6 +56,9 @@ public:
Standard_EXPORT void AddUEdges (const Handle(TopTools_HArray2OfShape)& theUEdges);
Standard_EXPORT void AddVEdges (const Handle(TopTools_HArray2OfShape)& theVEdges,
const Standard_Integer theIndex);
Standard_EXPORT void Perform();
Standard_EXPORT Standard_Boolean IsDone() const;
@@ -99,6 +103,7 @@ private:
TopoDS_Shape myShape2;
Handle(TopTools_HArray2OfShape) myBounds;
Handle(TopTools_HArray2OfShape) myUEdges;
Handle(TopTools_HArray1OfShape) myVEdges;
Handle(TopTools_HArray2OfShape) myFaces;
Standard_Boolean myDone;
Standard_Boolean myHasSection;