1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-09 18:50:54 +03:00

0031469: BRepFeat_MakePrism failed

BRepFeat_Form.cxx: methods IsDeleted, Modified, Generated are corrected
BRepTest_FeatureCommands.cxx: history treatment is added in methods DEFIN and PERF
bugs/modalg_7/bug31469: test case added
This commit is contained in:
ifv 2020-03-27 14:45:28 +03:00 committed by bugmaster
parent 9171cefaad
commit f0ada3e8d4
3 changed files with 964 additions and 855 deletions

View File

@ -1014,9 +1014,13 @@ static void Descendants(const TopoDS_Shape&,
//=======================================================================
Standard_Boolean BRepFeat_Form::IsDeleted(const TopoDS_Shape& F)
{
if (myMap.IsBound(F))
{
return (myMap(F).IsEmpty());
}
return Standard_False;
}
//=======================================================================
//function : Modified
@ -1026,16 +1030,23 @@ Standard_Boolean BRepFeat_Form::IsDeleted(const TopoDS_Shape& F)
const TopTools_ListOfShape& BRepFeat_Form::Modified
(const TopoDS_Shape& F)
{
myGenerated.Clear();
if (!IsDone())
return myGenerated;
if (mySbase.IsEqual(F))
{
myGenerated.Append(myShape);
return myGenerated;
}
if (myMap.IsBound(F)) {
static TopTools_ListOfShape list;
list.Clear(); // For the second passage DPF
TopTools_ListIteratorOfListOfShape ite(myMap(F));
for(; ite.More(); ite.Next()) {
const TopoDS_Shape& sh = ite.Value();
if(!sh.IsSame(F))
list.Append(sh);
if(!sh.IsSame(F) && sh.ShapeType() == F.ShapeType())
myGenerated.Append(sh);
}
return list;
}
return myGenerated; // empty list
}
@ -1048,19 +1059,20 @@ const TopTools_ListOfShape& BRepFeat_Form::Modified
const TopTools_ListOfShape& BRepFeat_Form::Generated
(const TopoDS_Shape& S)
{
myGenerated.Clear();
if (!IsDone())
return myGenerated;
if (myMap.IsBound(S) &&
S.ShapeType() != TopAbs_FACE) { // check if filter on face or not
static TopTools_ListOfShape list;
list.Clear(); // For the second passage DPF
TopTools_ListIteratorOfListOfShape ite(myMap(S));
for(; ite.More(); ite.Next()) {
const TopoDS_Shape& sh = ite.Value();
if(!sh.IsSame(S))
list.Append(sh);
myGenerated.Append(sh);
}
return list;
return myGenerated;
}
else return myGenerated;
return myGenerated;
}

View File

@ -85,6 +85,10 @@ static BRepFeat_MakePipe thePipe;
static BRepFeat_MakeLinearForm theLF;
static BRepFeat_MakeRevolutionForm theRF;
//Input shapes for Prism, DPrism, Revol, Pipe
static TopoDS_Shape theSbase, thePbase;
static TopoDS_Face theSkface;
static Standard_Boolean dprdef = Standard_False;
static Standard_Boolean prdef = Standard_False;
static Standard_Boolean rvdef = Standard_False;
@ -1015,7 +1019,8 @@ Standard_Integer offsetparameter(Draw_Interpretor& di,
di << " --> TheInter : ";
if (TheInter) {
di << "Complet";
} else {
}
else {
di << "Partial";
}
di << "\n --> TheJoin : ";
@ -1606,6 +1611,9 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
if (narg == 9) { // prism
prdef = Standard_True;
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
thePrism.Init(Sbase, Pbase, Skface, gp_Dir(X, Y, Z), Fuse, Modify);
}
else if (narg == 14) {
@ -1633,6 +1641,9 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
X = Draw::Atof(a[7]);
Y = Draw::Atof(a[8]);
Z = Draw::Atof(a[9]);
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
theRevol.Init(Sbase, Pbase, Skface, gp_Ax1(Or, gp_Dir(X, Y, Z)),
Fuse, Modify);
}
@ -1661,6 +1672,9 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
}
Standard_Real Angle = Draw::Atof(a[4])*M_PI / 360;
dprdef = Standard_True;
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
theDPrism.Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
}
else { // FEATPIPE
@ -1678,6 +1692,9 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
B.Add(Spine, Edspine);
}
pidef = Standard_True;
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
thePipe.Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
}
}
@ -1772,6 +1789,7 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
return 1;
}
TopTools_ListOfShape anArgs;
Standard_Integer Kas;
if (!strcasecmp("PRISM", a[1])) {
Kas = 1;
@ -2026,6 +2044,15 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
}
DBRep::Set(a[2], thePrism);
dout.Flush();
//History
if (BRepTest_Objects::IsHistoryNeeded())
{
anArgs.Clear();
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, thePrism);
}
return 0;
case 2:
if (!theRevol.IsDone()) {
@ -2036,6 +2063,15 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
theCommands << aSStream << "\n";
return 1;
}
//History
if (BRepTest_Objects::IsHistoryNeeded())
{
anArgs.Clear();
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, theRevol);
}
DBRep::Set(a[2], theRevol);
dout.Flush();
return 0;
@ -2048,6 +2084,15 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
theCommands << aSStream << "\n";
return 1;
}
//History
if (BRepTest_Objects::IsHistoryNeeded())
{
anArgs.Clear();
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, thePipe);
}
DBRep::Set(a[2], thePipe);
dout.Flush();
return 0;
@ -2060,6 +2105,15 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
theCommands << aSStream << "\n";
return 1;
}
//History
if (BRepTest_Objects::IsHistoryNeeded())
{
anArgs.Clear();
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
BRepTest_Objects::SetHistory(anArgs, theDPrism);
}
DBRep::Set(a[2], theDPrism);
dout.Flush();
return 0;

View File

@ -0,0 +1,43 @@
puts "========"
puts "0031469: Modeling Algorithms - 0031469: BRepFeat_MakePrism has problem with method IsDeleted(...)"
puts "========"
puts ""
box S 400 250 300
explode S face
mksurface pl2 S_2
trim pl2 pl2 100 200 -200 -100
mkface pbase pl2
featprism S pbase S_2 -1 0 0 0 1
featperformval prism pp 200
checkshape pp
checknbshapes pp -vertex 12 -edge 20 -face 11 -solid 1
savehistory ph
if { ![regexp "Not deleted" [isdeleted ph S]] } {
puts "Error: S has wrong delete status"
}
if { ![regexp "Not deleted" [isdeleted ph S_2]] } {
puts "Error: S_2 has wrong delete status"
}
if {![regexp "The shape has not been modified." [modified m1 ph S]] } {
checknbshapes m1 -vertex 12 -edge 20 -face 11 -solid 1
} else {
puts "Error: S has wrong modified list"
}
if {![regexp "The shape has not been modified." [modified m2 ph S_2]] } {
checknbshapes m2 -vertex 8 -edge 8 -wire 2 -face 1
} else {
puts "Error: S_2 has wrong modified list"
}
explode pbase e
if {![regexp "No shapes were generated from the shape." [generated g1 ph pbase_1]] } {
checknbshapes g1 -vertex 2 -edge 3 -wire 1 -face 1
checkprops g1 -s 20000
} else {
puts "Error: pbase_1 has wrong generated list"
}