mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0027575: Reading STEP file gives an empty result
Exception is raised during translation BSpline curve having only one unique knot. Protection for such case was added Added protection against exception during reading BSpline curve with number of control points equal to 0 Added protection against exception due to using null binder during writing XDE document Test case for issue #27575
This commit is contained in:
parent
7a1b96cb98
commit
72523826de
@ -76,13 +76,18 @@ void RWStepGeom_RWBSplineCurveWithKnots::ReadStep
|
||||
Standard_Integer nsub3;
|
||||
if (data->ReadSubList (num,3,"control_points_list",ach,nsub3)) {
|
||||
Standard_Integer nb3 = data->NbParams(nsub3);
|
||||
aControlPointsList = new StepGeom_HArray1OfCartesianPoint (1, nb3);
|
||||
for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
|
||||
//szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
|
||||
if (data->ReadEntity (nsub3, i3,"cartesian_point", ach,
|
||||
STANDARD_TYPE(StepGeom_CartesianPoint), anent3))
|
||||
aControlPointsList->SetValue(i3, anent3);
|
||||
}
|
||||
if(nb3 <1)
|
||||
ach->AddFail("Number of control points of the b_spline_curve_form is equal to 0");
|
||||
else
|
||||
{
|
||||
aControlPointsList = new StepGeom_HArray1OfCartesianPoint (1, nb3);
|
||||
for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
|
||||
//szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
|
||||
if (data->ReadEntity (nsub3, i3,"cartesian_point", ach,
|
||||
STANDARD_TYPE(StepGeom_CartesianPoint), anent3))
|
||||
aControlPointsList->SetValue(i3, anent3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- inherited field : curveForm ---
|
||||
|
@ -889,8 +889,9 @@ static Standard_Integer FindEntities (const Handle(Transfer_FinderProcess) &FP,
|
||||
seqRI.Append (aLocalItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(!TransientListBinder.IsNull())
|
||||
{
|
||||
|
||||
const Standard_Integer nb = TransientListBinder->NbTransients();
|
||||
for (Standard_Integer i=1; i<=nb; i++) {
|
||||
Handle(Standard_Transient) t = TransientListBinder->Transient(i);
|
||||
|
@ -43,7 +43,10 @@
|
||||
lastKnot = aKnots->Value(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(NbUniqueKnots <= 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
TColStd_Array1OfReal Kn(1,NbUniqueKnots);
|
||||
TColStd_Array1OfInteger Mult(1,NbUniqueKnots);
|
||||
lastKnot = aKnots->Value(1);
|
||||
@ -83,6 +86,11 @@
|
||||
//aControlPointsList = new StepGeom_HArray1OfCartesianPoint(1,NbPoles);
|
||||
const Handle(StepGeom_HArray1OfCartesianPoint)& aControlPointsList = BSCW->ControlPointsList();
|
||||
Standard_Integer aSumMulDiff = aFMulDiff + aLMulDiff;
|
||||
Standard_Integer nbP = NbPoles - aSumMulDiff;
|
||||
if( nbP <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Array1OfPnt_gen Poles(1,NbPoles - aSumMulDiff);
|
||||
|
||||
for (i = 1 + aFMulDiff; i<= NbPoles - aLMulDiff; ++i)
|
||||
|
16
tests/bugs/step/bug27575
Normal file
16
tests/bugs/step/bug27575
Normal file
@ -0,0 +1,16 @@
|
||||
puts "========"
|
||||
puts "OCC27575"
|
||||
puts "========"
|
||||
puts ""
|
||||
###########################################
|
||||
# Reading STEP file gives an empty result
|
||||
###########################################
|
||||
|
||||
stepread [locate_data_file bug27575_Outer_Shell.stp] a *
|
||||
renamevar a_1 result
|
||||
|
||||
whatis result
|
||||
|
||||
checkshape result
|
||||
|
||||
checkview -display result -2d -path ${imagedir}/${test_image}.png
|
@ -1,17 +1,20 @@
|
||||
# !!!! This file is generated automatically, do not edit manually! See end script
|
||||
puts "TODO CR23096 ALL: NBSHAPES : Faulty"
|
||||
|
||||
|
||||
set filename Inventor_iPartExample.stp
|
||||
|
||||
set ref_data {
|
||||
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
|
||||
TPSTAT : Faulties = 0 ( 16 ) Warnings = 0 ( 0 ) Summary = 0 ( 16 )
|
||||
DATA : Faulties = 0 ( 30 ) Warnings = 0 ( 0 ) Summary = 0 ( 30 )
|
||||
TPSTAT : Faulties = 0 ( 188 ) Warnings = 0 ( 96 ) Summary = 0 ( 284 )
|
||||
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
|
||||
NBSHAPES : Solid = 8 ( 8 ) Shell = 8 ( 8 ) Face = 517 ( 517 ) Summary = 3521 ( 3521 )
|
||||
STATSHAPE : Solid = 8 ( 8 ) Shell = 8 ( 8 ) Face = 517 ( 517 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 1464 ( 1464 )
|
||||
TOLERANCE : MaxTol = 1.000100003e-007 ( 1.000100003e-007 ) AvgTol = 1.00006193e-007 ( 1.00006193e-007 )
|
||||
LABELS : N0Labels = 9 ( 9 ) N1Labels = 11 ( 11 ) N2Labels = 0 ( 0 ) TotalLabels = 20 ( 20 ) NameLabels = 17 ( 17 ) ColorLabels = 8 ( 8 ) LayerLabels = 0 ( 0 )
|
||||
NBSHAPES : Solid = 8 ( 8 ) Shell = 10 ( 44 ) Face = 783 ( 817 ) Summary = 5535 ( 5605 )
|
||||
STATSHAPE : Solid = 8 ( 8 ) Shell = 10 ( 44 ) Face = 783 ( 817 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 2330 ( 2330 )
|
||||
TOLERANCE : MaxTol = 0.0003647191536 ( 0.0003647191504 ) AvgTol = 4.200927531e-005 ( 4.190525894e-005 )
|
||||
LABELS : N0Labels = 9 ( 9 ) N1Labels = 11 ( 11 ) N2Labels = 0 ( 0 ) TotalLabels = 20 ( 20 ) NameLabels = 17 ( 17 ) ColorLabels = 10 ( 10 ) LayerLabels = 0 ( 0 )
|
||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||
NCOLORS : NColors = 2 ( 2 )
|
||||
COLORS : Colors = GRAY66 SANDYBROWN ( GRAY66 SANDYBROWN )
|
||||
NCOLORS : NColors = 3 ( 3 )
|
||||
COLORS : Colors = GOLDENROD3 GRAY66 SANDYBROWN ( GOLDENROD3 GRAY66 SANDYBROWN )
|
||||
NLAYERS : NLayers = 0 ( 0 )
|
||||
LAYERS : Layers = ( )
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user