mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0030497: [REGRESSION] Mesh - wrong Poly_Polygon3D within local selection of located shape
The previous code has a condition to avoid processing the same faces if the face has a location.
The similar condition should be applied during the edges processing.
If not doing this, in the previous implementation, IMeshData_Edge instances are created for all edges(even located), but edges of faces located are not filled with curves.
As a result we had wrong local selection of edges.
Limit addition of edges to data model by ones with unique TShape and location using edges map already available in BRepMesh_ShapeVisitor.
(cherry picked from commit 967d2f4f30
)
This commit is contained in:
@@ -57,8 +57,11 @@ BRepMesh_ShapeVisitor::~BRepMesh_ShapeVisitor ()
|
||||
//=======================================================================
|
||||
void BRepMesh_ShapeVisitor::Visit(const TopoDS_Edge& theEdge)
|
||||
{
|
||||
myModel->AddEdge(theEdge);
|
||||
myDEdgeMap.Bind(theEdge, myModel->EdgesNb() - 1);
|
||||
if (!myDEdgeMap.IsBound (theEdge))
|
||||
{
|
||||
myModel->AddEdge (theEdge);
|
||||
myDEdgeMap.Bind (theEdge, myModel->EdgesNb () - 1);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -25,6 +25,32 @@
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
//=======================================================================
|
||||
// Function: visitEdges
|
||||
// Purpose : Explodes the given shape on edges according to the specified
|
||||
// criteria and visits each one in order to add it to data model.
|
||||
//=======================================================================
|
||||
void visitEdges (const Handle (IMeshTools_ShapeVisitor)& theVisitor,
|
||||
const TopoDS_Shape& theShape,
|
||||
const TopAbs_ShapeEnum theToFind,
|
||||
const TopAbs_ShapeEnum theToAvoid = TopAbs_SHAPE)
|
||||
{
|
||||
TopExp_Explorer aEdgesIt (theShape, theToFind, theToAvoid);
|
||||
for (; aEdgesIt.More (); aEdgesIt.Next ())
|
||||
{
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge (aEdgesIt.Current ());
|
||||
if (!BRep_Tool::IsGeometric (aEdge))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
theVisitor->Visit (aEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Function: Constructor
|
||||
// Purpose :
|
||||
@@ -51,19 +77,10 @@ void IMeshTools_ShapeExplorer::Accept (
|
||||
const Handle (IMeshTools_ShapeVisitor)& theVisitor)
|
||||
{
|
||||
// Explore all free edges in shape.
|
||||
TopExp_Explorer aFreeEdgesIt (GetShape (), TopAbs_EDGE, TopAbs_FACE);
|
||||
for (; aFreeEdgesIt.More(); aFreeEdgesIt.Next())
|
||||
{
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge (aFreeEdgesIt.Current());
|
||||
if (!BRep_Tool::IsGeometric(aEdge))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
theVisitor->Visit (aEdge);
|
||||
}
|
||||
visitEdges (theVisitor, GetShape (), TopAbs_EDGE, TopAbs_FACE);
|
||||
|
||||
// Explore all related to some face edges in shape.
|
||||
// make array of faces suitable for processing (excluding faces without surface)
|
||||
TopTools_ListOfShape aFaceList;
|
||||
BRepLib::ReverseSortFaces (GetShape (), aFaceList);
|
||||
TopTools_MapOfShape aFaceMap;
|
||||
@@ -80,46 +97,15 @@ void IMeshTools_ShapeExplorer::Accept (
|
||||
continue; // already processed
|
||||
}
|
||||
|
||||
TopoDS_Face aFace = TopoDS::Face (aFaceIter.Value ());
|
||||
const TopoDS_Face& aFace = TopoDS::Face (aFaceIter.Value ());
|
||||
const Handle (Geom_Surface)& aSurf = BRep_Tool::Surface (aFace, aDummyLoc);
|
||||
if (aSurf.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TopExp_Explorer anEdgesExp (aFace, TopAbs_EDGE);
|
||||
for (; anEdgesExp.More(); anEdgesExp.Next())
|
||||
{
|
||||
const TopoDS_Edge& aEdge = TopoDS::Edge (anEdgesExp.Current());
|
||||
if (!BRep_Tool::IsGeometric(aEdge))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
theVisitor->Visit (aEdge);
|
||||
}
|
||||
}
|
||||
|
||||
// Explore faces
|
||||
aFaceMap.Clear();
|
||||
|
||||
// make array of faces suitable for processing (excluding faces without surface)
|
||||
aFaceIter.Init (aFaceList);
|
||||
for (; aFaceIter.More (); aFaceIter.Next ())
|
||||
{
|
||||
TopoDS_Shape aFaceNoLoc = aFaceIter.Value ();
|
||||
aFaceNoLoc.Location (aEmptyLoc);
|
||||
if (!aFaceMap.Add(aFaceNoLoc))
|
||||
{
|
||||
continue; // already processed
|
||||
}
|
||||
|
||||
TopoDS_Face aFace = TopoDS::Face (aFaceIter.Value ());
|
||||
const Handle (Geom_Surface)& aSurf = BRep_Tool::Surface (aFace, aDummyLoc);
|
||||
if (aSurf.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Explore all edges in face.
|
||||
visitEdges (theVisitor, aFace, TopAbs_EDGE);
|
||||
|
||||
// Store only forward faces in order to prevent inverse issue.
|
||||
theVisitor->Visit (TopoDS::Face (aFace.Oriented (TopAbs_FORWARD)));
|
||||
|
@@ -68,7 +68,7 @@ set mem_delta_private 200
|
||||
set mem_delta_swap 120
|
||||
set mem_delta_swappeak 250
|
||||
set mem_delta_wset 200
|
||||
set mem_delta_wsetpeak 220
|
||||
set mem_delta_wsetpeak 300
|
||||
set mem_delta_virt 220
|
||||
set mem_delta_heap 80
|
||||
|
||||
|
@@ -1,13 +1,10 @@
|
||||
puts "======="
|
||||
puts "0030497"
|
||||
puts "0030497 \[REGRESSION\] Mesh - wrong Poly_Polygon3D within local selection of located shape"
|
||||
puts "======="
|
||||
puts ""
|
||||
##################################################
|
||||
# [REGRESSION] Mesh - wrong Poly_Polygon3D within local selection of located shape
|
||||
##################################################
|
||||
|
||||
pload XDE VISUALIZATION
|
||||
testreadstep as1-oc-214-mat.stp s
|
||||
pload XDE
|
||||
testreadstep [locate_data_file as1-oc-214-mat.stp] s
|
||||
|
||||
vclear
|
||||
vinit View1
|
||||
@@ -16,3 +13,5 @@ vdisplay s -dispmode 1
|
||||
vfit
|
||||
vselmode 2 1
|
||||
vmoveto 150 201
|
||||
|
||||
vdump ${imagedir}/${casename}.png
|
||||
|
Reference in New Issue
Block a user