mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0027065: BRepOffsetAPI_MakePipe misses definition of virtual method Generated()
Virtual method Generated() inherited from BRepPrimAPI_MakeSweep is overridden in class BRepOffsetAPI_MakePipe, providing information on shapes generated from the profile.
This commit is contained in:
parent
9e5394288d
commit
b3cbd47d26
@ -28,7 +28,9 @@ uses
|
|||||||
|
|
||||||
HArray2OfShape from TopTools,
|
HArray2OfShape from TopTools,
|
||||||
MapOfShape from TopTools,
|
MapOfShape from TopTools,
|
||||||
|
ListOfShape from TopTools,
|
||||||
DataMapOfShapeHArray2OfShape from BRepFill,
|
DataMapOfShapeHArray2OfShape from BRepFill,
|
||||||
|
DataMapOfShapeListOfShape from TopTools,
|
||||||
LocationLaw from BRepFill,
|
LocationLaw from BRepFill,
|
||||||
Shape from TopoDS,
|
Shape from TopoDS,
|
||||||
Face from TopoDS,
|
Face from TopoDS,
|
||||||
@ -83,6 +85,9 @@ is
|
|||||||
---C++ : return const &
|
---C++ : return const &
|
||||||
is static;
|
is static;
|
||||||
|
|
||||||
|
Generated(me: in out; S: Shape from TopoDS; L: in out ListOfShape from TopTools);
|
||||||
|
---Purpose: Returns the list of shapes generated from the shape <S>.
|
||||||
|
|
||||||
Face(me : in out; ESpine, EProfile : Edge from TopoDS)
|
Face(me : in out; ESpine, EProfile : Edge from TopoDS)
|
||||||
returns Face from TopoDS
|
returns Face from TopoDS
|
||||||
---Purpose: Returns the face created from an edge of the spine
|
---Purpose: Returns the face created from an edge of the spine
|
||||||
@ -181,6 +186,7 @@ fields
|
|||||||
myCurIndexOfSectionEdge : Integer from Standard;
|
myCurIndexOfSectionEdge : Integer from Standard;
|
||||||
myFirst : Shape from TopoDS;
|
myFirst : Shape from TopoDS;
|
||||||
myLast : Shape from TopoDS;
|
myLast : Shape from TopoDS;
|
||||||
|
myGenMap : DataMapOfShapeListOfShape from TopTools;
|
||||||
|
|
||||||
myDegmax : Integer from Standard;
|
myDegmax : Integer from Standard;
|
||||||
mySegmax : Integer from Standard;
|
mySegmax : Integer from Standard;
|
||||||
|
@ -69,6 +69,38 @@
|
|||||||
static Standard_Boolean Affich = 0;
|
static Standard_Boolean Affich = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
// static function: UpdateMap
|
||||||
|
// purpose:
|
||||||
|
// ---------------------------------------------------------------------------------
|
||||||
|
static Standard_Boolean UpdateMap(const TopoDS_Shape& theKey,
|
||||||
|
const TopoDS_Shape& theValue,
|
||||||
|
TopTools_DataMapOfShapeListOfShape& theMap)
|
||||||
|
{
|
||||||
|
if(!theMap.IsBound(theKey))
|
||||||
|
{
|
||||||
|
TopTools_ListOfShape thelist;
|
||||||
|
theMap.Bind(theKey, thelist);
|
||||||
|
}
|
||||||
|
TopTools_ListOfShape& aList = theMap.ChangeFind(theKey);
|
||||||
|
TopTools_ListIteratorOfListOfShape anIt(aList);
|
||||||
|
Standard_Boolean found = Standard_False;
|
||||||
|
|
||||||
|
for(; anIt.More(); anIt.Next())
|
||||||
|
{
|
||||||
|
if(theValue.IsSame(anIt.Value()))
|
||||||
|
{
|
||||||
|
found = Standard_True;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!found)
|
||||||
|
aList.Append(theValue);
|
||||||
|
|
||||||
|
return !found;
|
||||||
|
}
|
||||||
|
|
||||||
static void ReverseModifiedEdges(TopoDS_Shape& aShape,
|
static void ReverseModifiedEdges(TopoDS_Shape& aShape,
|
||||||
TopTools_MapOfShape& Emap)
|
TopTools_MapOfShape& Emap)
|
||||||
{
|
{
|
||||||
@ -374,6 +406,47 @@ const TopoDS_Shape& BRepFill_Pipe::LastShape() const
|
|||||||
return myLast;
|
return myLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Generated
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void BRepFill_Pipe::Generated(const TopoDS_Shape& theShape,
|
||||||
|
TopTools_ListOfShape& theList)
|
||||||
|
{
|
||||||
|
theList.Clear();
|
||||||
|
|
||||||
|
if (theShape.IsSame(myProfile))
|
||||||
|
theList.Append(myShape);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (theShape.ShapeType() == TopAbs_FACE ||
|
||||||
|
theShape.ShapeType() == TopAbs_WIRE)
|
||||||
|
{
|
||||||
|
if(myGenMap.IsBound(theShape))
|
||||||
|
theList = myGenMap.Find(theShape);
|
||||||
|
}
|
||||||
|
else if (theShape.ShapeType() == TopAbs_EDGE)
|
||||||
|
{
|
||||||
|
TopoDS_Iterator itw(mySpine);
|
||||||
|
for (; itw.More(); itw.Next())
|
||||||
|
{
|
||||||
|
const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
|
||||||
|
const TopoDS_Shape& aFace = Face(aSpineEdge, TopoDS::Edge(theShape));
|
||||||
|
theList.Append(aFace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (theShape.ShapeType() == TopAbs_VERTEX)
|
||||||
|
{
|
||||||
|
TopoDS_Iterator itw(mySpine);
|
||||||
|
for (; itw.More(); itw.Next())
|
||||||
|
{
|
||||||
|
const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
|
||||||
|
const TopoDS_Shape& anEdge = Edge(aSpineEdge, TopoDS::Vertex(theShape));
|
||||||
|
theList.Append(anEdge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Face
|
//function : Face
|
||||||
@ -640,6 +713,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
|||||||
MkSw.Build( myReversedEdges, myTapes, myRails,
|
MkSw.Build( myReversedEdges, myTapes, myRails,
|
||||||
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||||
result = MkSw.Shape();
|
result = MkSw.Shape();
|
||||||
|
UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
|
||||||
myErrorOnSurf = MkSw.ErrorOnSurface();
|
myErrorOnSurf = MkSw.ErrorOnSurface();
|
||||||
|
|
||||||
Handle(TopTools_HArray2OfShape) aSections = MkSw.Sections();
|
Handle(TopTools_HArray2OfShape) aSections = MkSw.Sections();
|
||||||
@ -662,6 +736,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
|||||||
MkSw.Build( myReversedEdges, myTapes, myRails,
|
MkSw.Build( myReversedEdges, myTapes, myRails,
|
||||||
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
|
||||||
result = MkSw.Shape();
|
result = MkSw.Shape();
|
||||||
|
UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
|
||||||
myErrorOnSurf = MkSw.ErrorOnSurface();
|
myErrorOnSurf = MkSw.ErrorOnSurface();
|
||||||
//Correct <myFirst> and <myLast>
|
//Correct <myFirst> and <myLast>
|
||||||
ReverseModifiedEdges(myFirst, myReversedEdges);
|
ReverseModifiedEdges(myFirst, myReversedEdges);
|
||||||
@ -769,6 +844,7 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
|
|||||||
BS.Add(solid,TopoDS::Shell(aLocalShape));
|
BS.Add(solid,TopoDS::Shell(aLocalShape));
|
||||||
// BS.Add(solid,TopoDS::Shell(result.Reversed()));
|
// BS.Add(solid,TopoDS::Shell(result.Reversed()));
|
||||||
}
|
}
|
||||||
|
UpdateMap(TheS.Located(myProfile.Location()), solid, myGenMap);
|
||||||
return solid;
|
return solid;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -84,6 +84,11 @@ is
|
|||||||
---Purpose: Returns the TopoDS Shape of the top of the prism.
|
---Purpose: Returns the TopoDS Shape of the top of the prism.
|
||||||
returns Shape from TopoDS;
|
returns Shape from TopoDS;
|
||||||
|
|
||||||
|
Generated (me: in out; S: Shape from TopoDS)
|
||||||
|
returns ListOfShape from TopTools
|
||||||
|
is redefined;
|
||||||
|
---C++: return const &
|
||||||
|
---Level: Public
|
||||||
|
|
||||||
Generated (me: in out; SSpine, SProfile : Shape from TopoDS)
|
Generated (me: in out; SSpine, SProfile : Shape from TopoDS)
|
||||||
---Level: Public
|
---Level: Public
|
||||||
|
@ -109,14 +109,23 @@ TopoDS_Shape BRepOffsetAPI_MakePipe::LastShape()
|
|||||||
return myPipe.LastShape();
|
return myPipe.LastShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Generated
|
||||||
|
//purpose : standard method
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_ListOfShape& BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& S)
|
||||||
|
{
|
||||||
|
myPipe.Generated(S, myGenerated);
|
||||||
|
return myGenerated;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Generated
|
//function : Generated
|
||||||
//purpose :
|
//purpose : returns generated elementary subshape
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
TopoDS_Shape BRepOffsetAPI_MakePipe::Generated (const TopoDS_Shape& SSpine,
|
TopoDS_Shape BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& SSpine,
|
||||||
const TopoDS_Shape& SProfile)
|
const TopoDS_Shape& SProfile)
|
||||||
{
|
{
|
||||||
if (SProfile.ShapeType () == TopAbs_EDGE) {
|
if (SProfile.ShapeType () == TopAbs_EDGE) {
|
||||||
return myPipe.Face (TopoDS::Edge (SSpine), TopoDS::Edge (SProfile));
|
return myPipe.Face (TopoDS::Edge (SSpine), TopoDS::Edge (SProfile));
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include <GeomFill_Trihedron.hxx>
|
#include <GeomFill_Trihedron.hxx>
|
||||||
#include <BRepOffsetAPI_MakePipe.hxx>
|
#include <BRepOffsetAPI_MakePipe.hxx>
|
||||||
#include <Standard_Atomic.hxx>
|
#include <Standard_Atomic.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
|
||||||
#include <Standard_Version.hxx>
|
#include <Standard_Version.hxx>
|
||||||
|
|
||||||
@ -4306,6 +4307,95 @@ static Standard_Integer OCC26313(Draw_Interpretor& di,Standard_Integer n,const c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
//function : OCC27065
|
||||||
|
//purpose : Tests overloaded method "Generated" of BRepOffsetAPI_MakePipe
|
||||||
|
//========================================================================
|
||||||
|
static Standard_Integer OCC27065(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n, const char** a)
|
||||||
|
{
|
||||||
|
if (n < 3) return 1;
|
||||||
|
BRep_Builder BB;
|
||||||
|
|
||||||
|
TopoDS_Shape SpineShape = DBRep::Get(a[1],TopAbs_WIRE);
|
||||||
|
if ( SpineShape.IsNull()) return 1;
|
||||||
|
TopoDS_Wire Spine = TopoDS::Wire(SpineShape);
|
||||||
|
|
||||||
|
TopoDS_Shape Profile = DBRep::Get(a[2]);
|
||||||
|
if ( Profile.IsNull()) return 1;
|
||||||
|
|
||||||
|
BRepOffsetAPI_MakePipe aPipeBuilder(Spine, Profile);
|
||||||
|
if (!aPipeBuilder.IsDone())
|
||||||
|
{
|
||||||
|
di << "Error: failed to create pipe\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TopExp_Explorer Explo(Profile, TopAbs_SHELL);
|
||||||
|
TopoDS_Shape aShape;
|
||||||
|
TopTools_ListIteratorOfListOfShape itl;
|
||||||
|
if (Explo.More())
|
||||||
|
{
|
||||||
|
aShape = Explo.Current();
|
||||||
|
TopoDS_Compound res1;
|
||||||
|
BB.MakeCompound(res1);
|
||||||
|
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||||
|
for (; itl.More(); itl.Next())
|
||||||
|
BB.Add(res1, itl.Value());
|
||||||
|
DBRep::Set("res_shell", res1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Explo.Init(Profile, TopAbs_FACE);
|
||||||
|
if (Explo.More())
|
||||||
|
{
|
||||||
|
aShape = Explo.Current();
|
||||||
|
TopoDS_Compound res2;
|
||||||
|
BB.MakeCompound(res2);
|
||||||
|
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||||
|
for (; itl.More(); itl.Next())
|
||||||
|
BB.Add(res2, itl.Value());
|
||||||
|
DBRep::Set("res_face", res2);
|
||||||
|
}
|
||||||
|
|
||||||
|
Explo.Init(Profile, TopAbs_WIRE);
|
||||||
|
if (Explo.More())
|
||||||
|
{
|
||||||
|
aShape = Explo.Current();
|
||||||
|
TopoDS_Compound res3;
|
||||||
|
BB.MakeCompound(res3);
|
||||||
|
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||||
|
for (; itl.More(); itl.Next())
|
||||||
|
BB.Add(res3, itl.Value());
|
||||||
|
DBRep::Set("res_wire", res3);
|
||||||
|
}
|
||||||
|
|
||||||
|
Explo.Init(Profile, TopAbs_EDGE);
|
||||||
|
if (Explo.More())
|
||||||
|
{
|
||||||
|
aShape = Explo.Current();
|
||||||
|
TopoDS_Compound res4;
|
||||||
|
BB.MakeCompound(res4);
|
||||||
|
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||||
|
for (; itl.More(); itl.Next())
|
||||||
|
BB.Add(res4, itl.Value());
|
||||||
|
DBRep::Set("res_edge", res4);
|
||||||
|
}
|
||||||
|
|
||||||
|
Explo.Init(Profile, TopAbs_VERTEX);
|
||||||
|
if (Explo.More())
|
||||||
|
{
|
||||||
|
aShape = Explo.Current();
|
||||||
|
TopoDS_Compound res5;
|
||||||
|
BB.MakeCompound(res5);
|
||||||
|
itl.Initialize(aPipeBuilder.Generated(aShape));
|
||||||
|
for (; itl.More(); itl.Next())
|
||||||
|
BB.Add(res5, itl.Value());
|
||||||
|
DBRep::Set("res_vertex", res5);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
||||||
const char *group = "QABugs";
|
const char *group = "QABugs";
|
||||||
|
|
||||||
@ -4397,5 +4487,9 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
|
|||||||
|
|
||||||
theCommands.Add ("OCC26313", "OCC26313 result shape", __FILE__, OCC26313, group);
|
theCommands.Add ("OCC26313", "OCC26313 result shape", __FILE__, OCC26313, group);
|
||||||
|
|
||||||
|
theCommands.Add ("OCC27065",
|
||||||
|
"OCC27065 spine profile",
|
||||||
|
__FILE__, OCC27065, group);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
24
tests/bugs/modalg_6/bug27065_1
Normal file
24
tests/bugs/modalg_6/bug27065_1
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27065"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## BRepOffsetAPI_MakePipe misses definition of virtual method Generated()
|
||||||
|
###############################
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
restore [locate_data_file bug24840_comp.brep] sh
|
||||||
|
explode sh
|
||||||
|
OCC27065 sh_1 sh_2
|
||||||
|
fit
|
||||||
|
|
||||||
|
checknbshapes res_shell -vertex 56 -edge 130 -wire 99 -face 99 -shell 24 -solid 24 -compsolid 1 -compound 1 -shape 434
|
||||||
|
|
||||||
|
checknbshapes res_face -vertex 8 -edge 12 -wire 6 -face 6 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 35
|
||||||
|
|
||||||
|
checknbshapes res_wire -vertex 8 -edge 12 -wire 4 -face 4 -shell 1 -solid 0 -compsolid 0 -compound 1 -shape 30
|
||||||
|
|
||||||
|
checknbshapes res_edge -vertex 4 -edge 4 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 11
|
||||||
|
|
||||||
|
checknbshapes res_vertex -vertex 2 -edge 1 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 4
|
28
tests/bugs/modalg_6/bug27065_2
Normal file
28
tests/bugs/modalg_6/bug27065_2
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27065"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
###############################
|
||||||
|
## BRepOffsetAPI_MakePipe misses definition of virtual method Generated()
|
||||||
|
###############################
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
restore [locate_data_file bug23903_base.brep] base
|
||||||
|
restore [locate_data_file bug23903_path.brep] sp
|
||||||
|
explode base
|
||||||
|
shape pr Sh
|
||||||
|
add base_1 pr
|
||||||
|
add base_2 pr
|
||||||
|
OCC27065 sp pr
|
||||||
|
fit
|
||||||
|
|
||||||
|
checknbshapes res_shell -vertex 2 -edge 5 -wire 3 -face 3 -shell 2 -solid 2 -compsolid 1 -compound 1 -shape 19
|
||||||
|
|
||||||
|
checknbshapes res_face -vertex 2 -edge 4 -wire 2 -face 2 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 13
|
||||||
|
|
||||||
|
checknbshapes res_wire -vertex 2 -edge 4 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 1 -shape 12
|
||||||
|
|
||||||
|
checknbshapes res_edge -vertex 2 -edge 3 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 8
|
||||||
|
|
||||||
|
checknbshapes res_vertex -vertex 1 -edge 1 -wire 0 -face 0 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 3
|
Loading…
x
Reference in New Issue
Block a user