mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0028964: Draw - need to have command to apply ShapeFix_FixSmallFace tool
DRAW command fixsmallfaces is added to fix (remove) small faces in the shape. Command OCC22586 is removed (replaced by fixsmallfaces). Test bug28112_2 using that command is added for the two last shapes in issue #28112; test bug28112 is renamed to bug28112_1. Test bug22586 is changed to use the new command.
This commit is contained in:
parent
956d63467f
commit
c3cca01534
@ -4608,26 +4608,6 @@ Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const ch
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#include <ShapeFix_FixSmallFace.hxx>
|
|
||||||
Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (argc != 3) {
|
|
||||||
di << "Usage : " << argv[0] << " shape resshape\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// try to read a shape:
|
|
||||||
TopoDS_Shape aShape=DBRep::Get(argv[1]);
|
|
||||||
ShapeFix_FixSmallFace aFixSmallFaces;
|
|
||||||
aFixSmallFaces.Init (aShape);
|
|
||||||
aFixSmallFaces.Perform();
|
|
||||||
TopoDS_Shape aResShape = aFixSmallFaces.Shape();
|
|
||||||
DBRep::Set(argv[2],aResShape);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <NCollection_DataMap.hxx>
|
#include <NCollection_DataMap.hxx>
|
||||||
Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||||
@ -4910,7 +4890,6 @@ void QABugs::Commands_11(Draw_Interpretor& theCommands) {
|
|||||||
theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
|
theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
|
||||||
theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
|
theCommands.Add("OCC17424", "OCC17424 shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
|
||||||
theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
|
theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
|
||||||
theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
|
|
||||||
theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
|
theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
|
||||||
theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
|
theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
|
||||||
theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
|
theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include <ShapeExtend_WireData.hxx>
|
#include <ShapeExtend_WireData.hxx>
|
||||||
#include <ShapeFix.hxx>
|
#include <ShapeFix.hxx>
|
||||||
#include <ShapeFix_Face.hxx>
|
#include <ShapeFix_Face.hxx>
|
||||||
|
#include <ShapeFix_FixSmallFace.hxx>
|
||||||
#include <ShapeFix_Shape.hxx>
|
#include <ShapeFix_Shape.hxx>
|
||||||
#include <ShapeFix_ShapeTolerance.hxx>
|
#include <ShapeFix_ShapeTolerance.hxx>
|
||||||
#include <ShapeFix_Wire.hxx>
|
#include <ShapeFix_Wire.hxx>
|
||||||
@ -633,6 +634,42 @@ static Standard_Integer fixsmalledges(Draw_Interpretor& di, Standard_Integer n,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : fixsmallfaces
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Integer fixsmallfaces (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
|
||||||
|
{
|
||||||
|
if (theArgc < 3)
|
||||||
|
{
|
||||||
|
std::cerr << "Use: " << theArgv[0] << " result shape [tolerance]" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TopoDS_Shape aShape = DBRep::Get(theArgv[2]);
|
||||||
|
if (aShape.IsNull()) {
|
||||||
|
theDI << "Error: Shape " << theArgv[2] << " is null\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Real aPrec = (theArgc < 4 ? 1. : Draw::Atof(theArgv[3]));
|
||||||
|
|
||||||
|
ShapeFix_FixSmallFace aFixSmallFaces;
|
||||||
|
aFixSmallFaces.Init (aShape);
|
||||||
|
aFixSmallFaces.SetPrecision(aPrec);
|
||||||
|
aFixSmallFaces.Perform();
|
||||||
|
if (! aFixSmallFaces.Shape().IsSame (aShape))
|
||||||
|
{
|
||||||
|
theDI << "Small faces are removed";
|
||||||
|
aShape = aFixSmallFaces.Shape();
|
||||||
|
}
|
||||||
|
|
||||||
|
DBRep::Set (theArgv[1], aShape);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : checkoverlapedges
|
//function : checkoverlapedges
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -823,6 +860,8 @@ static Standard_Integer connectedges(Draw_Interpretor& di, Standard_Integer n, c
|
|||||||
__FILE__,fixsmall,g);
|
__FILE__,fixsmall,g);
|
||||||
theCommands.Add ("fixsmalledges","result shape [toler mode amxangle]",
|
theCommands.Add ("fixsmalledges","result shape [toler mode amxangle]",
|
||||||
__FILE__,fixsmalledges,g);
|
__FILE__,fixsmalledges,g);
|
||||||
|
theCommands.Add ("fixsmallfaces","result shape [toler=1.]",
|
||||||
|
__FILE__,fixsmallfaces,g);
|
||||||
theCommands.Add ("checkoverlapedges","edge1 edge2 [toler domaindist]",
|
theCommands.Add ("checkoverlapedges","edge1 edge2 [toler domaindist]",
|
||||||
__FILE__,checkoverlapedges,g);
|
__FILE__,checkoverlapedges,g);
|
||||||
theCommands.Add ("checkfclass2d","face ucoord vcoord",
|
theCommands.Add ("checkfclass2d","face ucoord vcoord",
|
||||||
|
@ -1,22 +1,15 @@
|
|||||||
pload QAcommands
|
pload QAcommands
|
||||||
|
|
||||||
puts "==========="
|
puts "# ==================================================================="
|
||||||
puts "OCC22586"
|
puts "# 0022586: ShapeFix_FixSmallFace mistakenly removes a non-small pipe-like face with a seam edge"
|
||||||
puts "==========="
|
puts "# ==================================================================="
|
||||||
puts ""
|
puts ""
|
||||||
#######################################################################
|
|
||||||
# ShapeFix_FixSmallFace mistakenly removes a non-small pipe-like face with a seam edge
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
set BugNumber OCC22586
|
set BugNumber OCC22586
|
||||||
|
|
||||||
restore [locate_data_file OCC22586.brep] shape
|
restore [locate_data_file OCC22586.brep] shape
|
||||||
|
|
||||||
if { [catch { OCC22586 shape result } catch_result] } {
|
fixsmallfaces result shape 1.e-7
|
||||||
puts "Faulty ${BugNumber}"
|
|
||||||
} else {
|
|
||||||
puts "${BugNumber} OK"
|
|
||||||
}
|
|
||||||
|
|
||||||
checkprops result -s 10975
|
checkprops result -s 10975
|
||||||
checkview -display result -3d -path ${imagedir}/${test_image}.png
|
checkview -display result -3d -path ${imagedir}/${test_image}.png
|
||||||
|
21
tests/bugs/modalg_7/bug28112_2
Normal file
21
tests/bugs/modalg_7/bug28112_2
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
puts "# ================================================================="
|
||||||
|
puts "# 0028112: E x c e p t i o n during offset computation"
|
||||||
|
puts "# ================================================================="
|
||||||
|
|
||||||
|
puts ""
|
||||||
|
puts "# Fixing small faces on first shape..."
|
||||||
|
restore [locate_data_file bug28112_1.brep] shape1
|
||||||
|
fixsmallfaces fix1 shape1 -1
|
||||||
|
checknbshapes fix1 -face 4
|
||||||
|
|
||||||
|
puts ""
|
||||||
|
puts "# Fixing small faces on second shape..."
|
||||||
|
restore [locate_data_file bug28112_2.brep] shape2
|
||||||
|
fixsmallfaces fix2 shape2 -1
|
||||||
|
checknbshapes fix2 -face 4
|
||||||
|
|
||||||
|
puts ""
|
||||||
|
puts "# Trying offset on both shapes to ensure that it works after removal"
|
||||||
|
puts "# of small faces"
|
||||||
|
offsetshapesimple res1 fix1 10.
|
||||||
|
offsetshapesimple res2 fix2 10.
|
Loading…
x
Reference in New Issue
Block a user