mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0026261: Create a tool to remove tails from any wire
A tool to remove tails from the wires of a shape was created. The tool is based on mechanism 'ShapeFix', is located in types 'ShapeFix_Wire' and 'ShapeAnalysis_Wire', is enabled through method 'ShapeFix_Wire::FixTailMode' and is initialized by methods 'ShapeFix_Wire::SetMaxTailAngle' and 'ShapeFix_Wire::SetMaxTailWidth' and is called through method 'ShapeFix_Wire::FixTails'. The status of any performing of the last method is accessible through method 'ShapeFix_Wire::StatusFixTails'. The tail angle is checked only at the tail start. Mechanism 'ShapeFix' was modified: - the tool is disabled by default; - algorithm 'Fix notched edges' is disabled then the tool is enabled; - the tool and the last algorithm work in turns then the tool works on the request. 'Draw' command 'fixshape' was extended by options '-maxtaila' and '-maxtailw' to test the tool. 'Draw' tests to test the tool were created. Algorithm 'fixshape' was changed in type 'ShapeProcess_OperLibrary' to - use new parameters named 'FixTailMode', 'MaxTailAngle' (in degrees) and 'MaxTailWidth' from the algorithm context; - apply the tool after the shape will be fully fixed if the tool was enabled. Place holders for the new parameters were created in the resource file of mechsnism 'STEPControl_Reader'. Test cases for issue CR26261
This commit is contained in:
@@ -413,8 +413,11 @@ static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, c
|
||||
|
||||
Standard_CString res = 0;
|
||||
Standard_Integer par = 0, mess=0;
|
||||
for ( Standard_Integer i=1; i < argc; i++ ) {
|
||||
if ( argv[i][0] == '-' || argv[i][0] == '+' || argv[i][0] == '*' ) {
|
||||
for ( Standard_Integer i=1; i < argc; i++ )
|
||||
{
|
||||
if (strlen(argv[i]) == 2 &&
|
||||
(argv[i][0] == '-' || argv[i][0] == '+' || argv[i][0] == '*'))
|
||||
{
|
||||
Standard_Integer val = ( argv[i][0] == '-' ? 0 : argv[i][0] == '+' ? 1 : -1 );
|
||||
switch ( argv[i][1] ) {
|
||||
case 'l': sfs->FixWireTool()->FixLackingMode() = val; break;
|
||||
@@ -429,7 +432,27 @@ static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, c
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
else if (!strcmp(argv[i], "-maxtaila"))
|
||||
{
|
||||
if (++i >= argc)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sfs->FixWireTool()->SetMaxTailAngle(Draw::Atof(argv[i]) * (M_PI / 180));
|
||||
}
|
||||
else if (!strcmp(argv[i], "-maxtailw"))
|
||||
{
|
||||
if (++i >= argc)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sfs->FixWireTool()->SetMaxTailWidth(Draw::Atof(argv[i]));
|
||||
sfs->FixWireTool()->FixTailMode() = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( par ) {
|
||||
case 0: res = argv[i]; break;
|
||||
case 1: {
|
||||
@@ -445,7 +468,8 @@ static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, c
|
||||
}
|
||||
|
||||
if ( par <2 ) {
|
||||
di << "Use: " << argv[0] << " result shape [tolerance [max_tolerance]] [switches]" << "\n";
|
||||
di << "Use: " << argv[0] << " result shape [tolerance [max_tolerance]] [switches]\n"
|
||||
"[-maxtaila <degrees>] [-maxtailw <width>]" << "\n";
|
||||
di << "Switches allow to tune parameters of ShapeFix" << "\n";
|
||||
di << "The following syntax is used: <symbol><parameter>" << "\n";
|
||||
di << "- symbol may be - to set parameter off, + to set on or * to set default" << "\n";
|
||||
@@ -787,7 +811,9 @@ static Standard_Integer connectedges(Draw_Interpretor& di, Standard_Integer n, c
|
||||
__FILE__,stwire,g);
|
||||
theCommands.Add ("reface","shape result : controle sens wire",
|
||||
__FILE__,reface,g);
|
||||
theCommands.Add ("fixshape","res shape [preci [maxpreci]] [{switches}]",
|
||||
theCommands.Add ("fixshape",
|
||||
"res shape [preci [maxpreci]] [{switches}]\n"
|
||||
" [-maxtaila <degrees>] [-maxtailw <width>]",
|
||||
__FILE__,fixshape,g);
|
||||
// theCommands.Add ("testfill","result edge1 edge2",
|
||||
// __FILE__,XSHAPE_testfill,g);
|
||||
|
Reference in New Issue
Block a user