mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0026573: IGES file with one entity 128 is not read
Add some workaround to read IGES files with lines, which lengths are less than standard 80. Test case for issue CR26573 Correction of test cases for issue CR26573 Correction of test case for issue CR26573
This commit is contained in:
parent
4b0cab06c1
commit
a849d42d32
@ -70,7 +70,7 @@ int igesread (char* nomfic, int lesect[6], int modefnes)
|
|||||||
for(;;) {
|
for(;;) {
|
||||||
numl ++;
|
numl ++;
|
||||||
i = iges_lire(lefic,&numsec,ligne,modefnes);
|
i = iges_lire(lefic,&numsec,ligne,modefnes);
|
||||||
if (i <= 0) {
|
if (i <= 0 || i < i0) {
|
||||||
if (i == 0) break;
|
if (i == 0) break;
|
||||||
/* Sending of message : Syntax error */
|
/* Sending of message : Syntax error */
|
||||||
{
|
{
|
||||||
|
@ -67,10 +67,7 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
|
|||||||
while ( fgets ( ligne, 2, lefic ) && ( ligne[0] == '\r' || ligne[0] == '\n' ) )
|
while ( fgets ( ligne, 2, lefic ) && ( ligne[0] == '\r' || ligne[0] == '\n' ) )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fgets(&ligne[1],80,lefic);
|
fgets(&ligne[1],80,lefic);
|
||||||
/* fgets(ligne,81,lefic); */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,9 +93,8 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
|
|||||||
iges_fautrelire = 0;
|
iges_fautrelire = 0;
|
||||||
if (ligne[0] == '\0' || ligne[0] == '\n' || ligne[0] == '\r')
|
if (ligne[0] == '\0' || ligne[0] == '\n' || ligne[0] == '\r')
|
||||||
return iges_lire(lefic,numsec,ligne,modefnes); /* 0 */
|
return iges_lire(lefic,numsec,ligne,modefnes); /* 0 */
|
||||||
if (sscanf(&ligne[73],"%d",&result) == 0)
|
|
||||||
return -1;
|
if (!sscanf(&ligne[73],"%d",&result) == 0) {
|
||||||
/* { printf("Erreur, ligne n0.%d :\n%s\n",*numl,ligne); return (*numsec > 0 ? -1 : -2); } */
|
|
||||||
*numsec = result;
|
*numsec = result;
|
||||||
typesec = ligne[72];
|
typesec = ligne[72];
|
||||||
switch (typesec) {
|
switch (typesec) {
|
||||||
@ -107,9 +103,9 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
|
|||||||
case 'D' : ligne[72] = '\0'; return (3);
|
case 'D' : ligne[72] = '\0'; return (3);
|
||||||
case 'P' : ligne[72] = '\0'; return (4);
|
case 'P' : ligne[72] = '\0'; return (4);
|
||||||
case 'T' : ligne[72] = '\0'; return (5);
|
case 'T' : ligne[72] = '\0'; return (5);
|
||||||
default :; /* printf("Ligne incorrecte, ignoree n0.%d :\n%s\n",*numl,ligne); */
|
default :;
|
||||||
}
|
}
|
||||||
/* the column 72 is empty, try to check the neghbour*/
|
/* the column 72 is empty, try to check the neighbour*/
|
||||||
if(strlen(ligne)==80
|
if(strlen(ligne)==80
|
||||||
&& (ligne[79]=='\n' || ligne[79]=='\r') && (ligne[0]<='9' && ligne[0]>='0')) {
|
&& (ligne[79]=='\n' || ligne[79]=='\r') && (ligne[0]<='9' && ligne[0]>='0')) {
|
||||||
/*check if the case of losted .*/
|
/*check if the case of losted .*/
|
||||||
@ -120,7 +116,6 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
|
|||||||
ligne[index] = ligne[index-1];
|
ligne[index] = ligne[index-1];
|
||||||
ligne[0]='.';
|
ligne[0]='.';
|
||||||
}
|
}
|
||||||
|
|
||||||
typesec = ligne[72];
|
typesec = ligne[72];
|
||||||
switch (typesec) {
|
switch (typesec) {
|
||||||
case 'S' : ligne[72] = '\0'; return (1);
|
case 'S' : ligne[72] = '\0'; return (1);
|
||||||
@ -128,10 +123,36 @@ int iges_lire (FILE* lefic, int *numsec, char ligne[100], int modefnes)
|
|||||||
case 'D' : ligne[72] = '\0'; return (3);
|
case 'D' : ligne[72] = '\0'; return (3);
|
||||||
case 'P' : ligne[72] = '\0'; return (4);
|
case 'P' : ligne[72] = '\0'; return (4);
|
||||||
case 'T' : ligne[72] = '\0'; return (5);
|
case 'T' : ligne[72] = '\0'; return (5);
|
||||||
default :; /* printf("Ligne incorrecte, ignoree n0.%d :\n%s\n",*numl,ligne); */
|
default :;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the line is not conform to standard, try to read it (if there are some missing spaces)
|
||||||
|
// find the number end
|
||||||
|
i = (int)strlen(ligne);
|
||||||
|
while ((ligne[i] == '\0' || ligne[i] == '\n' || ligne[i] == '\r' || ligne[i] == ' ') && i > 0)
|
||||||
|
i--;
|
||||||
|
if (i != (int)strlen(ligne))
|
||||||
|
ligne[i + 1] = '\0';
|
||||||
|
// find the number start
|
||||||
|
while (ligne[i] >= '0' && ligne[i] <= '9' && i > 0)
|
||||||
|
i--;
|
||||||
|
if (sscanf(&ligne[i + 1],"%d",&result) == 0)
|
||||||
|
return -1;
|
||||||
|
*numsec = result;
|
||||||
|
// find type of line
|
||||||
|
while (ligne[i] == ' ' && i > 0)
|
||||||
|
i--;
|
||||||
|
typesec = ligne[i];
|
||||||
|
switch (typesec) {
|
||||||
|
case 'S' : ligne[i] = '\0'; return (1);
|
||||||
|
case 'G' : ligne[i] = '\0'; return (2);
|
||||||
|
case 'D' : ligne[i] = '\0'; return (3);
|
||||||
|
case 'P' : ligne[i] = '\0'; return (4);
|
||||||
|
case 'T' : ligne[i] = '\0'; return (5);
|
||||||
|
default :; /* printf("Ligne incorrecte, ignoree n0.%d :\n%s\n",*numl,ligne); */
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
tests/bugs/iges/bug26573
Normal file
28
tests/bugs/iges/bug26573
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC26573"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
##########################################################################
|
||||||
|
# IGES file with one entity 128 is not read
|
||||||
|
##########################################################################
|
||||||
|
|
||||||
|
igesbrep [locate_data_file bug26573_loft.igs] a *
|
||||||
|
tpcompound result
|
||||||
|
|
||||||
|
set square 240.546
|
||||||
|
|
||||||
|
set nbshapes_expected "
|
||||||
|
Number of shapes in shape
|
||||||
|
VERTEX : 4
|
||||||
|
EDGE : 4
|
||||||
|
WIRE : 1
|
||||||
|
FACE : 1
|
||||||
|
SHELL : 0
|
||||||
|
SOLID : 0
|
||||||
|
COMPSOLID : 0
|
||||||
|
COMPOUND : 1
|
||||||
|
SHAPE : 11
|
||||||
|
"
|
||||||
|
checknbshapes result -ref ${nbshapes_expected} -t -m "importing file"
|
||||||
|
|
||||||
|
set 3dviewer 1
|
@ -23,7 +23,7 @@ if { ${LogLength} < 21 } {
|
|||||||
puts "Faulty ${BugNumber}"
|
puts "Faulty ${BugNumber}"
|
||||||
} else {
|
} else {
|
||||||
regexp -all {1[ \t]*F: Syntax error in IGES file at line ([-0-9.+eE]+) in section ([A-Z]).} $Log full word1 word2
|
regexp -all {1[ \t]*F: Syntax error in IGES file at line ([-0-9.+eE]+) in section ([A-Z]).} $Log full word1 word2
|
||||||
if { ${word1} != "206" || ${word2} != "P" } {
|
if { ${word1} != "204" || ${word2} != "P" } {
|
||||||
puts "Faulty ${BugNumber}"
|
puts "Faulty ${BugNumber}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
tests/de/iges_1/G7
Normal file → Executable file
16
tests/de/iges_1/G7
Normal file → Executable file
@ -1,14 +1,18 @@
|
|||||||
# !!!! This file is generated automatically, do not edit manually! See end script
|
# !!!! This file is generated automatically, do not edit manually! See end script
|
||||||
|
puts "TODO CR23096 ALL: TPSTAT : Faulty"
|
||||||
|
puts "TODO CR23096 ALL: LABELS : Faulty"
|
||||||
|
|
||||||
|
|
||||||
set filename frame.igs
|
set filename frame.igs
|
||||||
|
|
||||||
set ref_data {
|
set ref_data {
|
||||||
DATA : Faulties = 0 ( 9879 ) Warnings = 0 ( 2629 ) Summary = 0 ( 12508 )
|
DATA : Faulties = 0 ( 5005 ) Warnings = 0 ( 1 ) Summary = 0 ( 5006 )
|
||||||
TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
|
TPSTAT : Faulties = 0 ( 0 ) Warnings = 6 ( 0 ) Summary = 6 ( 0 )
|
||||||
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
|
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
|
||||||
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) Summary = 2830 ( 2830 )
|
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 410 ( 410 ) Summary = 11585 ( 11585 )
|
||||||
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 ) FreeEdge = 944 ( 944 ) SharedEdge = 944 ( 944 )
|
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 410 ( 410 ) FreeWire = 410 ( 410 ) FreeEdge = 2910 ( 2910 ) SharedEdge = 4569 ( 4569 )
|
||||||
TOLERANCE : MaxTol = 1e-07 ( 1e-07 ) AvgTol = 1e-07 ( 1e-07 )
|
TOLERANCE : MaxTol = 0.6309534605 ( 0.6309534603 ) AvgTol = 0.01007170672 ( 0.0100718085 )
|
||||||
LABELS : N0Labels = 944 ( 944 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 944 ( 944 ) NameLabels = 944 ( 944 ) ColorLabels = 944 ( 944 ) LayerLabels = 0 ( 0 )
|
LABELS : N0Labels = 1 ( 1 ) N1Labels = 1651 ( 2074 ) N2Labels = 0 ( 0 ) TotalLabels = 1652 ( 2075 ) NameLabels = 1652 ( 2053 ) ColorLabels = 1651 ( 2074 ) LayerLabels = 0 ( 0 )
|
||||||
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
|
||||||
NCOLORS : NColors = 1 ( 1 )
|
NCOLORS : NColors = 1 ( 1 )
|
||||||
COLORS : Colors = WHITE ( WHITE )
|
COLORS : Colors = WHITE ( WHITE )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user