mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024135: Result of reading step file is invalid.
Now wrong multiplicity of boundary knots will be set to Degree + 1 (if it is higher). Adding test case for issue CR24135
This commit is contained in:
parent
18e8557466
commit
4552136784
@ -52,22 +52,23 @@ void RWStepAP214_RWAppliedGroupAssignment::ReadStep (const Handle(StepData_StepR
|
|||||||
|
|
||||||
// Own fields of AppliedGroupAssignment
|
// Own fields of AppliedGroupAssignment
|
||||||
|
|
||||||
Handle(StepAP214_HArray1OfGroupItem) aItems;
|
Handle(StepAP214_HArray1OfGroupItem) anItems;
|
||||||
Standard_Integer sub2 = 0;
|
Standard_Integer sub2 = 0;
|
||||||
if ( data->ReadSubList (num, 2, "items", ach, sub2) ) {
|
if ( data->ReadSubList (num, 2, "items", ach, sub2) ) {
|
||||||
Standard_Integer num2 = sub2;
|
Standard_Integer num2 = sub2;
|
||||||
Standard_Integer nb0 = data->NbParams(num2);
|
Standard_Integer nb0 = data->NbParams(num2);
|
||||||
aItems = new StepAP214_HArray1OfGroupItem (1, nb0);
|
if (nb0)
|
||||||
for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
|
{
|
||||||
StepAP214_GroupItem anIt0;
|
anItems = new StepAP214_HArray1OfGroupItem (1, nb0);
|
||||||
data->ReadEntity (num2, i0, "items", ach, anIt0);
|
for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) {
|
||||||
aItems->SetValue(i0, anIt0);
|
StepAP214_GroupItem anIt0;
|
||||||
|
data->ReadEntity (num2, i0, "items", ach, anIt0);
|
||||||
|
anItems->SetValue(i0, anIt0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize entity
|
// Initialize entity
|
||||||
ent->Init(aGroupAssignment_AssignedGroup,
|
ent->Init(aGroupAssignment_AssignedGroup, anItems);
|
||||||
aItems);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -107,9 +108,11 @@ void RWStepAP214_RWAppliedGroupAssignment::Share (const Handle(StepAP214_Applied
|
|||||||
iter.AddItem (ent->StepBasic_GroupAssignment::AssignedGroup());
|
iter.AddItem (ent->StepBasic_GroupAssignment::AssignedGroup());
|
||||||
|
|
||||||
// Own fields of AppliedGroupAssignment
|
// Own fields of AppliedGroupAssignment
|
||||||
|
if (!ent->Items().IsNull())
|
||||||
for (Standard_Integer i2=1; i2 <= ent->Items()->Length(); i2++ ) {
|
{
|
||||||
StepAP214_GroupItem Var0 = ent->Items()->Value(i2);
|
for (Standard_Integer i2=1; i2 <= ent->Items()->Length(); i2++ ) {
|
||||||
iter.AddItem (Var0.Value());
|
StepAP214_GroupItem Var0 = ent->Items()->Value(i2);
|
||||||
|
iter.AddItem (Var0.Value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,27 +36,41 @@
|
|||||||
|
|
||||||
const Standard_Integer Deg = BSCW->Degree();
|
const Standard_Integer Deg = BSCW->Degree();
|
||||||
const Standard_Integer NbPoles = BSCW->NbControlPointsList();
|
const Standard_Integer NbPoles = BSCW->NbControlPointsList();
|
||||||
//aControlPointsList = new StepGeom_HArray1OfCartesianPoint(1,NbPoles);
|
|
||||||
const Handle(StepGeom_HArray1OfCartesianPoint)& aControlPointsList = BSCW->ControlPointsList();
|
|
||||||
Array1OfPnt_gen Poles(1,NbPoles);
|
|
||||||
|
|
||||||
Standard_Integer i;
|
|
||||||
CartesianPoint_gen P;
|
|
||||||
for (i=1; i<=NbPoles; i++)
|
|
||||||
{
|
|
||||||
if (StepToGeom_MakeCartesianPoint_gen::Convert(aControlPointsList->Value(i),P))
|
|
||||||
Poles.SetValue(i,P->Pnt_fonc());
|
|
||||||
else
|
|
||||||
return Standard_False;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Standard_Integer NbKnots = BSCW->NbKnotMultiplicities();
|
const Standard_Integer NbKnots = BSCW->NbKnotMultiplicities();
|
||||||
|
|
||||||
//aKnotMultiplicities = new TColStd_HArray1OfInteger(1,NbKnots);
|
//aKnotMultiplicities = new TColStd_HArray1OfInteger(1,NbKnots);
|
||||||
const Handle(TColStd_HArray1OfInteger)& aKnotMultiplicities = BSCW->KnotMultiplicities();
|
const Handle(TColStd_HArray1OfInteger)& aKnotMultiplicities = BSCW->KnotMultiplicities();
|
||||||
|
|
||||||
|
Standard_Integer i;
|
||||||
|
Standard_Integer aFMulDiff = 0,aLMulDiff = 0;
|
||||||
TColStd_Array1OfInteger Mult(1,NbKnots);
|
TColStd_Array1OfInteger Mult(1,NbKnots);
|
||||||
for (i=1; i<=NbKnots; i++) {
|
for (i=1; i<=NbKnots; ++i) {
|
||||||
Mult.SetValue(i,aKnotMultiplicities->Value(i));
|
Standard_Integer aCurrentVal = aKnotMultiplicities->Value(i);
|
||||||
|
if (aCurrentVal > Deg + 1)
|
||||||
|
{
|
||||||
|
if (i == 1) aFMulDiff = aCurrentVal - Deg - 1;
|
||||||
|
if (i == NbKnots) aLMulDiff = aCurrentVal - Deg - 1;
|
||||||
|
#ifdef DEB
|
||||||
|
cout << "\nWrong multiplicity " << aCurrentVal << " on " << i
|
||||||
|
<< " knot!" << "\nChanged to " << Deg + 1 << endl;
|
||||||
|
#endif
|
||||||
|
aCurrentVal = Deg + 1;
|
||||||
|
}
|
||||||
|
Mult.SetValue(i,aCurrentVal);
|
||||||
|
}
|
||||||
|
|
||||||
|
//aControlPointsList = new StepGeom_HArray1OfCartesianPoint(1,NbPoles);
|
||||||
|
const Handle(StepGeom_HArray1OfCartesianPoint)& aControlPointsList = BSCW->ControlPointsList();
|
||||||
|
Standard_Integer aSumMulDiff = aFMulDiff + aLMulDiff;
|
||||||
|
Array1OfPnt_gen Poles(1,NbPoles - aSumMulDiff);
|
||||||
|
CartesianPoint_gen P;
|
||||||
|
|
||||||
|
for (i = 1 + aFMulDiff; i<= NbPoles - aLMulDiff; ++i)
|
||||||
|
{
|
||||||
|
if (StepToGeom_MakeCartesianPoint_gen::Convert(aControlPointsList->Value(i),P))
|
||||||
|
Poles.SetValue(i - aFMulDiff,P->Pnt_fonc());
|
||||||
|
else
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
//aKnots = new TColStd_HArray1OfReal(1,NbKnots);
|
//aKnots = new TColStd_HArray1OfReal(1,NbKnots);
|
||||||
@ -86,7 +100,7 @@
|
|||||||
shouldBePeriodic = Standard_False;
|
shouldBePeriodic = Standard_False;
|
||||||
//cout << "Strange BSpline Curve Descriptor" << endl;
|
//cout << "Strange BSpline Curve Descriptor" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) {
|
if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) {
|
||||||
const Handle(TColStd_HArray1OfReal)& aWeight = BSCWR->WeightsData();
|
const Handle(TColStd_HArray1OfReal)& aWeight = BSCWR->WeightsData();
|
||||||
TColStd_Array1OfReal W(1,NbPoles);
|
TColStd_Array1OfReal W(1,NbPoles);
|
||||||
|
@ -121,7 +121,7 @@ static Standard_Integer stepread (Draw_Interpretor& di/*theCommands*/, Standard_
|
|||||||
progress->Show();
|
progress->Show();
|
||||||
|
|
||||||
Standard_Boolean fromtcl = Standard_False;
|
Standard_Boolean fromtcl = Standard_False;
|
||||||
Standard_Boolean aFullMode = 0;
|
Standard_Boolean aFullMode = Standard_False;
|
||||||
Standard_Integer k = 3;
|
Standard_Integer k = 3;
|
||||||
if(argc > k )
|
if(argc > k )
|
||||||
{
|
{
|
||||||
|
27
tests/bugs/step/bug24135
Executable file
27
tests/bugs/step/bug24135
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC24135"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Result of reading step file is invalid.
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
set BugNumber OCC24135
|
||||||
|
|
||||||
|
stepread [locate_data_file bug24135_Drum.stp] a *
|
||||||
|
|
||||||
|
set exception_status 0
|
||||||
|
set msg [ tpstat c ]
|
||||||
|
set index [ lsearch $msg Exeption ]
|
||||||
|
|
||||||
|
if {$index > -1} {
|
||||||
|
set exception_status 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if { ${exception_status} != 0 } {
|
||||||
|
puts "Faulty ${BugNumber}"
|
||||||
|
} else {
|
||||||
|
puts "OK ${BugNumber}"
|
||||||
|
}
|
||||||
|
|
||||||
|
set 2dviewer 0
|
Loading…
x
Reference in New Issue
Block a user