From: bugmaster Date: Mon, 15 Sep 2014 12:23:07 +0000 (+0400) Subject: Fix for query 11-005 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=088182f70a99bc7980be919f0220efbdd7abfa7e;p=occt-copy.git Fix for query 11-005 --- diff --git a/src/MgtBRep/MgtBRep_TranslateTool.cxx b/src/MgtBRep/MgtBRep_TranslateTool.cxx index cba7fc2c14..f61e109fb5 100755 --- a/src/MgtBRep/MgtBRep_TranslateTool.cxx +++ b/src/MgtBRep/MgtBRep_TranslateTool.cxx @@ -910,7 +910,8 @@ MgtBRep_TranslateTool::UpdateEdge(const Handle(PTopoDS_HShape)& S1, } else if (PCR->IsCurve3D()) { Handle(PBRep_Curve3D)& PC3D = (Handle(PBRep_Curve3D)&) PCR; - if (! PC3D->Curve3D().IsNull()) { + +// szy: correction for edge which has null 3d curve representation. Handle(BRep_Curve3D) C3D = new BRep_Curve3D(MgtBRep_TranslateTool::Translate(PC3D->Curve3D(), aMap), MgtTopLoc::Translate(PC3D->Location(), aMap)); @@ -918,7 +919,7 @@ MgtBRep_TranslateTool::UpdateEdge(const Handle(PTopoDS_HShape)& S1, CR = C3D; } } - } + else if (PCR->IsRegularity()) { Handle(PBRep_CurveOn2Surfaces)& PR = (Handle(PBRep_CurveOn2Surfaces)&) PCR; @@ -1001,9 +1002,8 @@ MgtBRep_TranslateTool::UpdateEdge(const Handle(PTopoDS_HShape)& S1, Standard_NullObject_Raise_if (CR.IsNull(), "Persistant CurveRep is Null"); - if(!CR.IsNull()) { lcr.Prepend(CR); - } + PCR = PCR->Next(); } diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index 7a49d90098..d521a9c4b6 100755 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -94,6 +94,18 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #if ! defined(WNT) @@ -5335,6 +5347,123 @@ Standard_Integer CR23234 (Draw_Interpretor& di, Standard_Integer argc, const cha return 0; //TCL_OK } +//============================================================================ +Standard_Boolean GetShape(Handle(Storage_Data) d, TopoDS_Compound& aComp) +{ + // Read all the root objects + // Get the root list + char* label; + Handle(Storage_HSeqOfRoot) roots = d->Roots(); + Handle(Standard_Persistent) p; + Handle(Storage_Root) r; + Handle(PTopoDS_HShape) aPShape; + PTColStd_PersistentTransientMap aMap; + BRep_Builder aB; + aB.MakeCompound(aComp); + Standard_Boolean isOK(Standard_True); + for (int i = 1; i <= roots->Length(); i++ ) + { + // Get the root + try + { + r = roots->Value(i); + // Get the persistent application object from the root + p = r->Object(); + aPShape = Handle(PTopoDS_HShape)::DownCast(p); + // Get the root + int labelLen = (r->Name()).Length(); + label = new char[labelLen+1]; + strcpy(label, r->Name().ToCString()); + char *entId = strtok(label,"_"); + char *entType = strtok(NULL,"_"); + long id = atol(entId); + int iType = atoi(entType); + //Entity *ent = NULL; + if (!aPShape.IsNull()) + { + // Get the persistent SHAPE + TopoDS_Shape aTShape; + MgtBRep::Translate(aPShape,aMap,aTShape,MgtBRep_WithTriangle); + if (iType == 103) { + //ent = new Entity(aTShape); + } + else if ((iType == 81) || (iType == 100) + || (iType == 102) + || (iType == 21) + || (iType == 105) + || (iType == 108) + || (iType == 109) + || (iType == 110)) + { + // Shape Analyzer check added + BRepCheck_Analyzer bAnalyzer(aTShape, Standard_True); + if (!bAnalyzer.IsValid()) + { + cout << "Selected shape " << i << " is Faulty" << endl; + isOK = Standard_False; + } else + aB.Add(aComp, aTShape); + } + } + } + catch(Standard_Failure) + { + cout<<"error "<Read( f ); // It hangs here + err = d->ErrorStatus() ; + if ( err != Storage_VSOk ) { + f.Close(); + exit; + } + TopoDS_Compound aComp; + if(GetShape(d, aComp)) + cout << "Test is OK" << endl; +#ifdef DEB + if(!aComp.IsNull()) { + DBRep::Set("result", aComp); + Standard_Integer aLen = filename.Length() -3; // 'occ' + TCollection_AsciiString aName = filename; + aName.Trunc(aLen); + aName = aName + "brep"; + BRepTools::Write(aComp, aName.ToCString()); + } +#endif + // Close the file driver + f.Close(); +} + +//=============================== Draw Command ================================= +static Standard_Integer TataMotors_Tata (Draw_Interpretor& di, + Standard_Integer nb, + const char** a) +{ + if (nb == 2) { + TCollection_AsciiString filename (a[1]); + read_occ_binary(filename); + return 0; + + } + cout <<"Wrong arguments " <