diff --git a/src/STEPConstruct/STEPConstruct_Assembly.cxx b/src/STEPConstruct/STEPConstruct_Assembly.cxx index 74d212bbc4..9c511fb526 100644 --- a/src/STEPConstruct/STEPConstruct_Assembly.cxx +++ b/src/STEPConstruct/STEPConstruct_Assembly.cxx @@ -197,6 +197,8 @@ Standard_Boolean STEPConstruct_Assembly::CheckSRRReversesNAUO(const Interface_Gr Handle(StepBasic_ProductDefinition) pd1, pd2; Handle(StepRepr_Representation) rep1 = CDSR->RepresentationRelation()->Rep1(); Handle(StepRepr_Representation) rep2 = CDSR->RepresentationRelation()->Rep2(); + if( rep1.IsNull() || rep2.IsNull()) + return Standard_False; // find SDRs corresponding to Rep1 and Rep2 and remember their PDs Handle(Standard_Type) tSDR = STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation); diff --git a/src/STEPControl/STEPControl_ActorRead.cxx b/src/STEPControl/STEPControl_ActorRead.cxx index db1b503857..1dbbc2c226 100644 --- a/src/STEPControl/STEPControl_ActorRead.cxx +++ b/src/STEPControl/STEPControl_ActorRead.cxx @@ -679,6 +679,8 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han if (RR.IsNull()) continue; SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR ); Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() ); + if(rep.IsNull()) + continue; iatrsf = ComputeSRRWT ( RR, TP, Trsf ); // find real ProductDefinition used rep Interface_EntityIterator subs3 = TP->Graph().Sharings(rep); diff --git a/src/StepData/StepData_StepReaderData.cxx b/src/StepData/StepData_StepReaderData.cxx index bcfd329a9a..3634d55ef0 100644 --- a/src/StepData/StepData_StepReaderData.cxx +++ b/src/StepData/StepData_StepReaderData.cxx @@ -342,31 +342,6 @@ Standard_Integer StepData_StepReaderData::NextForComplex return next; } - -//======================================================================= -//function : stepstrcmp -//purpose : -//======================================================================= -static Standard_Boolean stepstrcmp(const Standard_CString type, - const Standard_CString name) -{ -// name peut etre d un tenant ou de deux : auquel cas il a une partie LONGUE -// et une partie COURTE separees par un blanc -// Attention : False pour dire OK, True sinon (car remplace strcmp) - Standard_Integer i,j = 0; Standard_Boolean res = Standard_False; - for (i = 0; name[i] != '\0' && type[i] != '\0' && !res ; i ++) { - if (name[i] == ' ' && type[i] == '\0') { j = i; break; } - if (type[i] != name[i]) res = Standard_True; - } - if (!res || (j == 0)) return res; -// Pas trouve et un blanc suit : on continue - for (i = j+1; name[i] != '\0'; i ++) { - if (type[i-j-1] != name[i]) return Standard_True; - } - return Standard_False; -} - - //======================================================================= //function : NamedForComplex //purpose : @@ -379,7 +354,7 @@ Standard_Boolean StepData_StepReaderData::NamedForComplex //Standard_Boolean stat = Standard_True; Standard_Integer n = (num <= 0 ? num0 : NextForComplex(num)); // sln 04,10.2001. BUC61003. if(n==0) the next function is not called in order to avoid exception - if ((n!=0) && (!stepstrcmp (RecordType(n).ToCString(),name))) + if ((n!=0) && (!strcmp( RecordType(n).ToCString(), name )) ) { num = n; return Standard_True; } if (n == 0) /*stat =*/ NamedForComplex (name,num0,n,ach); // on a rembobine @@ -387,7 +362,7 @@ Standard_Boolean StepData_StepReaderData::NamedForComplex Handle(String) errmess = new String("Parameter n0.%d (%s) not a LIST"); sprintf (txtmes,errmess->ToCString(),num0,name); for (n = num0; n > 0; n = NextForComplex(n)) { - if (!stepstrcmp (RecordType(n).ToCString(),name)) { + if (!strcmp( RecordType(n).ToCString(), name)) { num = n; errmess = new String("Complex Record n0.%d, member type %s not in alphabetic order"); sprintf (txtmes,errmess->ToCString(),num0,name); @@ -413,18 +388,22 @@ Standard_Boolean StepData_StepReaderData::NamedForComplex Handle(Interface_Check)& ach) const { Standard_Integer n = (num <= 0 ? num0 : NextForComplex(num)); - if ((n!=0) && !(stepstrcmp(RecordType(n).ToCString(),theName) && - stepstrcmp(RecordType(n).ToCString(), theShortName))) - { num = n; return Standard_True; } + + if ((n!=0) && (!strcmp( RecordType(n).ToCString(), theName) || + !strcmp(RecordType(n).ToCString(), theShortName)) ) + { + num = n; + return Standard_True; + } - if (n == 0) - NamedForComplex (theName, theShortName, num0, n, ach); //entities are not in alphabetical order Handle(String) errmess = new String("Parameter n0.%d (%s) not a LIST"); sprintf (txtmes,errmess->ToCString(), num0, theName); - for (n = num0; n > 0; n = NextForComplex(n)) { - if (!(stepstrcmp(RecordType(n).ToCString(),theName) && - stepstrcmp(RecordType(n).ToCString(), theShortName))) { + for (n = num0; n > 0; n = NextForComplex(n)) + { + if (!strcmp(RecordType(n).ToCString(),theName) || + !strcmp(RecordType(n).ToCString(), theShortName)) + { num = n; errmess = new String("Complex Record n0.%d, member type %s not in alphabetic order"); sprintf (txtmes,errmess->ToCString(), num0, theName); diff --git a/tests/bugs/step/bug29029 b/tests/bugs/step/bug29029 new file mode 100644 index 0000000000..5559422527 --- /dev/null +++ b/tests/bugs/step/bug29029 @@ -0,0 +1,15 @@ +puts "# =====================================================================" +puts "# 0029029: E x c e p t i o n Raised with no Result during reading file 2033zsh1_1.stp" +puts "# =====================================================================" +puts "" +puts "TODO 29029 ALL: Faulty shapes in variables faulty_1 to faulty_2" + +set filepath [locate_data_file bug29029_2033zsh1_1.stp] +stepread $filepath a * +tpcompound result + +checkshape result +checkprops result -s 10647.3 +checknbshapes result -wire 196 -face 196 -shell 1 -solid 1 -compound 2 + +# checkview -display result -2d -path ${imagedir}/${test_image}.png