mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0030958: BRepOffsetAPI_ThruSections operation raises an exception while building history
Correct methods Build and Generated: use BRepTools_WireExplorer instead of TopExp_Explorer or TopoDS_Iterator, for compatibility with previous computations.
This commit is contained in:
parent
4c26106f76
commit
bf97419a18
@ -397,29 +397,30 @@ void BRepOffsetAPI_ThruSections::Build()
|
|||||||
Standard_Integer IndFirstSec = 1;
|
Standard_Integer IndFirstSec = 1;
|
||||||
if (Georges.IsDegeneratedFirstSection())
|
if (Georges.IsDegeneratedFirstSection())
|
||||||
IndFirstSec = 2;
|
IndFirstSec = 2;
|
||||||
TopoDS_Shape aWorkingSection = WorkingSections(IndFirstSec);
|
TopoDS_Wire aWorkingSection = TopoDS::Wire(WorkingSections(IndFirstSec));
|
||||||
myNbEdgesInSection += aWorkingSection.NbChildren();
|
myNbEdgesInSection += aWorkingSection.NbChildren();
|
||||||
for (Standard_Integer ii = 1; ii <= myWires.Length(); ii++)
|
for (Standard_Integer ii = 1; ii <= myWires.Length(); ii++)
|
||||||
{
|
{
|
||||||
TopExp_Explorer Explo(myWires(ii), TopAbs_EDGE);
|
TopoDS_Iterator itw(myWires(ii));
|
||||||
for (; Explo.More(); Explo.Next())
|
for (; itw.More(); itw.Next())
|
||||||
{
|
{
|
||||||
const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
|
const TopoDS_Edge& anEdge = TopoDS::Edge(itw.Value());
|
||||||
Standard_Integer aSign = 1;
|
Standard_Integer aSign = 1;
|
||||||
TopoDS_Vertex Vfirst, Vlast;
|
TopoDS_Vertex Vfirst, Vlast;
|
||||||
TopExp::Vertices(anEdge, Vfirst, Vlast);
|
TopExp::Vertices(anEdge, Vfirst, Vlast);
|
||||||
TopTools_ListOfShape aNewEdges = Georges.GeneratedShapes(anEdge);
|
TopTools_ListOfShape aNewEdges = Georges.GeneratedShapes(anEdge);
|
||||||
TColStd_ListOfInteger IList;
|
TColStd_ListOfInteger IList;
|
||||||
aWorkingSection = WorkingSections(ii);
|
aWorkingSection = TopoDS::Wire(WorkingSections(ii));
|
||||||
Standard_Integer NbNewEdges = aNewEdges.Extent();
|
Standard_Integer NbNewEdges = aNewEdges.Extent();
|
||||||
TopTools_ListIteratorOfListOfShape itl(aNewEdges);
|
TopTools_ListIteratorOfListOfShape itl(aNewEdges);
|
||||||
for (Standard_Integer kk = 1; itl.More(); itl.Next(),kk++)
|
for (Standard_Integer kk = 1; itl.More(); itl.Next(),kk++)
|
||||||
{
|
{
|
||||||
const TopoDS_Edge& aNewEdge = TopoDS::Edge(itl.Value());
|
const TopoDS_Edge& aNewEdge = TopoDS::Edge(itl.Value());
|
||||||
Standard_Integer inde = 1;
|
Standard_Integer inde = 1;
|
||||||
for (TopoDS_Iterator itw (aWorkingSection); itw.More(); itw.Next(), inde++)
|
BRepTools_WireExplorer wexp(aWorkingSection);
|
||||||
|
for (; wexp.More(); wexp.Next(), inde++)
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& aWorkingEdge = itw.Value();
|
const TopoDS_Shape& aWorkingEdge = wexp.Current();
|
||||||
if (aWorkingEdge.IsSame(aNewEdge))
|
if (aWorkingEdge.IsSame(aNewEdge))
|
||||||
{
|
{
|
||||||
aSign = (aWorkingEdge.Orientation() == TopAbs_FORWARD)? 1 : -1;
|
aSign = (aWorkingEdge.Orientation() == TopAbs_FORWARD)? 1 : -1;
|
||||||
@ -1295,12 +1296,14 @@ BRepOffsetAPI_ThruSections::Generated(const TopoDS_Shape& S)
|
|||||||
Standard_Integer Eindex = myVertexIndex(S);
|
Standard_Integer Eindex = myVertexIndex(S);
|
||||||
Standard_Integer Vindex = (Eindex > 0)? 0 : 1;
|
Standard_Integer Vindex = (Eindex > 0)? 0 : 1;
|
||||||
Eindex = Abs(Eindex);
|
Eindex = Abs(Eindex);
|
||||||
const TopoDS_Shape& FirstSection = myWires(1);
|
const TopoDS_Wire& FirstSection = TopoDS::Wire(myWires(1));
|
||||||
TopoDS_Edge FirstEdge;
|
TopoDS_Edge FirstEdge;
|
||||||
TopoDS_Iterator itw(FirstSection);
|
TopoDS_Vertex FirstVertexOfFirstEdge;
|
||||||
for (Standard_Integer inde = 1; itw.More(); itw.Next(),inde++)
|
BRepTools_WireExplorer wexp(FirstSection);
|
||||||
|
for (Standard_Integer inde = 1; wexp.More(); wexp.Next(),inde++)
|
||||||
{
|
{
|
||||||
FirstEdge = TopoDS::Edge(itw.Value());
|
FirstEdge = wexp.Current();
|
||||||
|
FirstVertexOfFirstEdge = wexp.CurrentVertex();
|
||||||
if (inde == Eindex)
|
if (inde == Eindex)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1330,7 +1333,20 @@ BRepOffsetAPI_ThruSections::Generated(const TopoDS_Shape& S)
|
|||||||
FirstEdgeInFace = Explo.Current();
|
FirstEdgeInFace = Explo.Current();
|
||||||
TopoDS_Vertex VV [2];
|
TopoDS_Vertex VV [2];
|
||||||
TopExp::Vertices(FirstEdge, VV[0], VV[1]);
|
TopExp::Vertices(FirstEdge, VV[0], VV[1]);
|
||||||
FirstVertex = VV[Vindex];
|
if (Vindex == 0)
|
||||||
|
{
|
||||||
|
if (VV[0].IsSame(FirstVertexOfFirstEdge))
|
||||||
|
FirstVertex = VV[0];
|
||||||
|
else
|
||||||
|
FirstVertex = VV[1];
|
||||||
|
}
|
||||||
|
else //Vindex == 1
|
||||||
|
{
|
||||||
|
if (VV[0].IsSame(FirstVertexOfFirstEdge))
|
||||||
|
FirstVertex = VV[1];
|
||||||
|
else
|
||||||
|
FirstVertex = VV[0];
|
||||||
|
}
|
||||||
const TopTools_ListOfShape& Elist = VEmap.FindFromKey(FirstVertex);
|
const TopTools_ListOfShape& Elist = VEmap.FindFromKey(FirstVertex);
|
||||||
TopTools_ListIteratorOfListOfShape itl(Elist);
|
TopTools_ListIteratorOfListOfShape itl(Elist);
|
||||||
TopAbs_Orientation anEdgeOr = (Vindex == 0)? TopAbs_REVERSED : TopAbs_FORWARD;
|
TopAbs_Orientation anEdgeOr = (Vindex == 0)? TopAbs_REVERSED : TopAbs_FORWARD;
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
puts "TODO OCC29653 All:exception"
|
|
||||||
puts "TODO OCC29653 All:\\*\\* Exception \\*\\*"
|
|
||||||
puts "TODO OCC29653 All:TEST INCOMPLETE"
|
|
||||||
|
|
||||||
puts "============"
|
puts "============"
|
||||||
puts "OCC22646"
|
puts "OCC22646"
|
||||||
puts "============"
|
puts "============"
|
||||||
@ -13,27 +9,59 @@ puts ""
|
|||||||
|
|
||||||
set BugNumber OCC22646
|
set BugNumber OCC22646
|
||||||
|
|
||||||
|
|
||||||
restore [locate_data_file bug22646_source.brep] s1
|
restore [locate_data_file bug22646_source.brep] s1
|
||||||
restore [locate_data_file bug22646_scale_translate_xyz.brep] s2
|
restore [locate_data_file bug22646_scale_translate_xyz.brep] s2
|
||||||
restore [locate_data_file bug22646_scale_translate_yz.brep] s3
|
restore [locate_data_file bug22646_scale_translate_yz.brep] s3
|
||||||
restore [locate_data_file bug22646_scale_translate_z.brep] s4
|
restore [locate_data_file bug22646_scale_translate_z.brep] s4
|
||||||
|
|
||||||
vinit
|
|
||||||
explode s1
|
explode s1
|
||||||
explode s2
|
explode s2
|
||||||
explode s3
|
explode s3
|
||||||
explode s4
|
explode s4
|
||||||
vfit
|
|
||||||
|
|
||||||
donly s1_1 s2_1
|
|
||||||
thrusections res2 0 0 s1_1 s2_1
|
thrusections res2 0 0 s1_1 s2_1
|
||||||
|
savehistory hist
|
||||||
|
|
||||||
|
foreach s {s1_1 s2_1} {
|
||||||
|
foreach type {v e} {
|
||||||
|
foreach ss [explode $s $type] {
|
||||||
|
if {[catch { generated g2 hist $ss } catch_res]} {
|
||||||
|
puts "Error: Unable to get generated shapes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
donly s1_1 s3_1
|
|
||||||
thrusections res3 0 0 s1_1 s3_1
|
thrusections res3 0 0 s1_1 s3_1
|
||||||
|
savehistory hist
|
||||||
|
|
||||||
|
foreach s {s1_1 s3_1} {
|
||||||
|
foreach type {v e} {
|
||||||
|
foreach ss [explode $s $type] {
|
||||||
|
if {[catch { generated g3 hist $ss } catch_res]} {
|
||||||
|
puts "Error: Unable to get generated shapes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
donly s1_1 s4_1
|
|
||||||
thrusections res4 0 0 s1_1 s4_1
|
thrusections res4 0 0 s1_1 s4_1
|
||||||
|
savehistory hist
|
||||||
|
|
||||||
|
foreach s {s1_1 s4_1} {
|
||||||
|
foreach type {v e} {
|
||||||
|
foreach ss [explode $s $type] {
|
||||||
|
if {[catch { generated g4 hist $ss } catch_res]} {
|
||||||
|
puts "Error: Unable to get generated shapes"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vinit
|
||||||
|
vsetdispmode 1
|
||||||
|
vdisplay g2
|
||||||
|
vdisplay g3
|
||||||
|
vdisplay g4
|
||||||
|
vfit
|
||||||
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
checkview -screenshot -3d -path ${imagedir}/${test_image}.png
|
||||||
|
|
||||||
|
43
tests/bugs/modalg_7/bug30958
Normal file
43
tests/bugs/modalg_7/bug30958
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
puts "=========================================================================================="
|
||||||
|
puts "OCC30958: BRepOffsetAPI_ThruSections operation raises an except-ion while building history"
|
||||||
|
puts "=========================================================================================="
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
restore [locate_data_file bug30958_CompWires.brep] ww
|
||||||
|
explode ww
|
||||||
|
|
||||||
|
thrusections res 0 1 ww_1 ww_2
|
||||||
|
|
||||||
|
savehistory hist
|
||||||
|
|
||||||
|
explode ww_1
|
||||||
|
|
||||||
|
generated r1 hist ww_1_1
|
||||||
|
generated r2 hist ww_1_2
|
||||||
|
|
||||||
|
checkprops r1 -s 22.4404
|
||||||
|
checkprops r2 -s 81.2396
|
||||||
|
|
||||||
|
explode ww_1 v
|
||||||
|
|
||||||
|
generated rr1 hist ww_1_1
|
||||||
|
generated rr2 hist ww_1_2
|
||||||
|
generated rr3 hist ww_1_3
|
||||||
|
|
||||||
|
distmini dd ww_1_1 rr1
|
||||||
|
regexp {([-0-9.+eE]+)} [dump dd_val] full dist
|
||||||
|
if { $dist > 1.e-7} {
|
||||||
|
puts "Error: wrong generated list of edges"
|
||||||
|
}
|
||||||
|
|
||||||
|
distmini dd ww_1_2 rr2
|
||||||
|
regexp {([-0-9.+eE]+)} [dump dd_val] full dist
|
||||||
|
if { $dist > 1.e-7} {
|
||||||
|
puts "Error: wrong generated list of edges"
|
||||||
|
}
|
||||||
|
|
||||||
|
distmini dd ww_1_3 rr3
|
||||||
|
regexp {([-0-9.+eE]+)} [dump dd_val] full dist
|
||||||
|
if { $dist > 1.e-7} {
|
||||||
|
puts "Error: wrong generated list of edges"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user