From: szy Date: Fri, 23 Jan 2015 13:53:51 +0000 (+0300) Subject: Fix Import bug. X-Git-Tag: V_1.0.0~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd346fc70e9f82a4eaaaad0d623bd48c9bcbe996;p=modules%2Fshaper.git Fix Import bug. --- diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index 9ffa3bd3d..85a025f68 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -122,8 +122,8 @@ void ExchangePlugin_ImportFeature::loadNamingDS( int aTag(1); std::string aNameMS = "Shape"; theResultBody->loadFirstLevel(theGeomShape, aNameMS, aTag); - std::string aNameDE = "DiscEdges"; - theResultBody->loadDisconnectedEdges(theGeomShape, aNameDE, aTag); - std::string aNameDV = "DiscVertexes"; - theResultBody->loadDisconnectedVertexes(theGeomShape, aNameDV, aTag); + //std::string aNameDE = "DiscEdges"; + //theResultBody->loadDisconnectedEdges(theGeomShape, aNameDE, aTag); + //std::string aNameDV = "DiscVertexes"; + //theResultBody->loadDisconnectedVertexes(theGeomShape, aNameDV, aTag); } diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index ab3768d06..cda2ef0d3 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -52,6 +52,10 @@ #include #include using namespace std; +//#define DEB_NAMING 1 +#ifdef DEB_NAMING +#include +#endif /// adeed to the index in the packed map to signalize that the vertex of edge is seleted /// (multiplied by the index of the edge) static const int kSTART_VERTEX_DELTA = 1000000; @@ -601,6 +605,9 @@ std::string Model_AttributeSelection::namingName() if(!aSubSh.get() || aSubSh->isNull() || !aCont.get() || aCont->shape()->isNull()) return aName; TopoDS_Shape aSubShape = aSubSh->impl(); +#ifdef DEB_NAMING + BRepTools::Write(aSubShape, "Selection.brep"); +#endif TopoDS_Shape aContext = aCont->shape()->impl(); std::shared_ptr aDoc = std::dynamic_pointer_cast(aCont->document()); diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index 4a04dda1a..134a3f32d 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -27,11 +27,14 @@ #include #include #include +#include #include #include // DEB //#include //#include +#define DEB_IMPORT 1 + Model_ResultBody::Model_ResultBody() { setIsConcealed(false); @@ -371,6 +374,8 @@ void Model_ResultBody::loadNextLevels(std::shared_ptr theShape, { const TopTools_ListOfShape& aLL = anEdgeAndNeighbourFaces.FindFromIndex(i); if (aLL.Extent() < 2) { + if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeAndNeighbourFaces.FindKey(i)))) + continue; builder(theTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i)); TCollection_AsciiString aStr(theTag); aName = theName + aStr.ToCString(); @@ -491,7 +496,24 @@ void Model_ResultBody::loadDisconnectedEdges( edgeNaborFaces.ChangeFind(anEdge).Append(aFace); } } - + +/* TopTools_IndexedDataMapOfShapeListOfShape aDM; + TopExp::MapShapesAndAncestors(aShape, TopAbs_EDGE, TopAbs_FACE, aDM); + for(int i=1; i <= aDM.Extent(); i++) { + if(aDM.FindFromIndex(i).Extent() > 1) continue; + if (BRep_Tool::Degenerated(TopoDS::Edge(aDM.FindKey(i)))) + continue; + builder(theTag)->Generated(aDM.FindKey(i)); + TCollection_AsciiString aStr(theTag); + std::string aName = theName + aStr.ToCString(); + buildName(theTag, aName); +#ifdef DEB_IMPORT + aName += + ".brep"; + BRepTools::Write(aDM.FindKey(i), aName.c_str()); +#endif + theTag++; + } +*/ TopTools_MapOfShape anEdgesToDelete; TopExp_Explorer anEx(aShape,TopAbs_EDGE); std::string aName; @@ -536,7 +558,7 @@ void Model_ResultBody::loadDisconnectedEdges( buildName(theTag, aName); theTag++; } - } + } } void Model_ResultBody::loadDisconnectedVertexes(std::shared_ptr theShape, const std::string& theName, int& theTag)