mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0025634: Checking of compliance of vertices and pcurve fails
A fix + a checkedge draw-command to check the fix. Test case for issue CR25634
This commit is contained in:
parent
6a38ff486c
commit
c31e0defd7
@ -900,6 +900,81 @@ static Standard_Integer checkselfintersection
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Standard_Integer checkedge(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
|
{
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
di<<"Call please \"checkedge edge [face]\""<<"\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get edge.
|
||||||
|
const char* arg1 = argv[1];
|
||||||
|
TopoDS_Shape edge = DBRep::Get(arg1);
|
||||||
|
if (edge.IsNull() || edge.ShapeType() != TopAbs_EDGE)
|
||||||
|
{
|
||||||
|
di<<"A null shape or not an edge is used."<<"\n";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get face.
|
||||||
|
TopoDS_Shape face;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
const char* arg2 = argv[2];
|
||||||
|
face = DBRep::Get(arg2);
|
||||||
|
if (face.IsNull() || face.ShapeType() != TopAbs_FACE)
|
||||||
|
{
|
||||||
|
di<<"A null shape or not a face is used."<<"\n";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Analysis of the edge.
|
||||||
|
ShapeAnalysis_Edge analyser;
|
||||||
|
Standard_Boolean isOk(Standard_True);
|
||||||
|
|
||||||
|
// Curve 3D.
|
||||||
|
if (analyser.HasCurve3d(TopoDS::Edge(edge)))
|
||||||
|
{
|
||||||
|
// Check vertices.
|
||||||
|
if (analyser.CheckVerticesWithCurve3d(TopoDS::Edge(edge)))
|
||||||
|
{
|
||||||
|
isOk = Standard_False;
|
||||||
|
di<<"Vertices of the edge don't coincide with start/end points of 3d-curve (using tolerance of the vertices).\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOk = Standard_False;
|
||||||
|
di<<"Edge doesn't have a 3d-curve\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!face.IsNull())
|
||||||
|
{
|
||||||
|
// Curve 2D.
|
||||||
|
if (analyser.HasPCurve(TopoDS::Edge(edge), TopoDS::Face(face)))
|
||||||
|
{
|
||||||
|
// Check vertices.
|
||||||
|
if (analyser.CheckVerticesWithPCurve(TopoDS::Edge(edge), TopoDS::Face(face)))
|
||||||
|
{
|
||||||
|
isOk = Standard_False;
|
||||||
|
di<<"Vertices of the edge don't coincide with start/end points of 2d-curve (using tolerance of the vertices).\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOk = Standard_False;
|
||||||
|
di<<"Edge doesn't have a 2d-curve on this face\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOk)
|
||||||
|
di<<"Edge seems OK.\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : InitCommands
|
//function : InitCommands
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -937,4 +1012,5 @@ static Standard_Integer checkselfintersection
|
|||||||
|
|
||||||
theCommands.Add("getareacontour","wire ",__FILE__, getareacontour, groupold);
|
theCommands.Add("getareacontour","wire ",__FILE__, getareacontour, groupold);
|
||||||
theCommands.Add ("checkselfintersection","wire [face]", __FILE__,checkselfintersection,g);
|
theCommands.Add ("checkselfintersection","wire [face]", __FILE__,checkselfintersection,g);
|
||||||
|
theCommands.Add ("checkedge","edge [face]", __FILE__,checkedge,g);
|
||||||
}
|
}
|
||||||
|
@ -565,6 +565,8 @@ Standard_Boolean ShapeAnalysis_Edge::CheckVerticesWithPCurve (const TopoDS_Edge&
|
|||||||
if (vtx != 2) { // 1er VTX
|
if (vtx != 2) { // 1er VTX
|
||||||
gp_Pnt2d p1uv = c2d->Value (cf);
|
gp_Pnt2d p1uv = c2d->Value (cf);
|
||||||
gp_Pnt p12d = surf->Value (p1uv.X(), p1uv.Y());
|
gp_Pnt p12d = surf->Value (p1uv.X(), p1uv.Y());
|
||||||
|
if (!loc.IsIdentity())
|
||||||
|
p12d.Transform(loc.Transformation());
|
||||||
// szv#4:S4163:12Mar99 optimized
|
// szv#4:S4163:12Mar99 optimized
|
||||||
if ( p1v.Distance(p12d) > (preci < 0 ? BRep_Tool::Tolerance (V1) : preci) )
|
if ( p1v.Distance(p12d) > (preci < 0 ? BRep_Tool::Tolerance (V1) : preci) )
|
||||||
myStatus |= ShapeExtend_DONE1;
|
myStatus |= ShapeExtend_DONE1;
|
||||||
@ -573,6 +575,8 @@ Standard_Boolean ShapeAnalysis_Edge::CheckVerticesWithPCurve (const TopoDS_Edge&
|
|||||||
if (vtx != 1) { // 2me VTX
|
if (vtx != 1) { // 2me VTX
|
||||||
gp_Pnt2d p2uv = c2d->Value (cl);
|
gp_Pnt2d p2uv = c2d->Value (cl);
|
||||||
gp_Pnt p22d = surf->Value (p2uv.X(), p2uv.Y());
|
gp_Pnt p22d = surf->Value (p2uv.X(), p2uv.Y());
|
||||||
|
if (!loc.IsIdentity())
|
||||||
|
p22d.Transform(loc.Transformation());
|
||||||
// szv#4:S4163:12Mar99 optimized
|
// szv#4:S4163:12Mar99 optimized
|
||||||
if ( p2v.Distance(p22d) > (preci < 0 ? BRep_Tool::Tolerance (V2) : preci) )
|
if ( p2v.Distance(p22d) > (preci < 0 ? BRep_Tool::Tolerance (V2) : preci) )
|
||||||
myStatus |= ShapeExtend_DONE2;
|
myStatus |= ShapeExtend_DONE2;
|
||||||
|
21
tests/bugs/heal/bug25634
Normal file
21
tests/bugs/heal/bug25634
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25634"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
######################################################
|
||||||
|
# Checking of compliance of vertices and pcurve fails
|
||||||
|
######################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25634_shape3.brep] s
|
||||||
|
|
||||||
|
explode s e
|
||||||
|
|
||||||
|
set info [checkedge s_1 s]
|
||||||
|
|
||||||
|
# Resume
|
||||||
|
puts ""
|
||||||
|
if { [regexp {Edge seems OK.} ${info}] } {
|
||||||
|
puts "OK: Checking is good"
|
||||||
|
} else {
|
||||||
|
puts "Error: Checking is bad"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user