diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_HullTransform.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_HullTransform.cxx index 7a0b233870..57b8626db6 100644 --- a/src/BRepAlgoAPI/BRepAlgoAPI_HullTransform.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_HullTransform.cxx @@ -109,23 +109,24 @@ TopoDS_Shape BRepAlgoAPI_HullTransform::Perform() Handle(ShapeFix_Shape) aShapeFixTool = new ShapeFix_Shape; aShapeFixTool->Init(aHTrsf.Shape()); aShapeFixTool->Perform(); + TopoDS_Shape aResShape = aShapeFixTool->Shape(); ShapeAnalysis_ShapeTolerance aSat; aSat.InitTolerance(); - aSat.AddTolerance(aShapeFixTool->Shape()); + aSat.AddTolerance(aResShape); // Check the necessarity of the next step - if (myIsAutoSection && aHullsList.size() > 0 && aSat.GlobalTolerance(1) >= aTolerances.back()) + if (myIsAutoSection && aHullsList.size() > 0 && aSat.GlobalTolerance(0) >= aTolerances.back()) { isToProceed = false; mySections.pop_back(); } else { - aTolerances.push_back(aSat.GlobalTolerance(1)); - aHullsList.push_back(aShapeFixTool->Shape()); + aTolerances.push_back(aSat.GlobalTolerance(0)); + aHullsList.push_back(aResShape); aSectionsList.push_back(mySections); if (myIsAutoSection) - addSection(aShapeFixTool->Shape()); + addSection(aResShape); } } } while (isToProceed); diff --git a/src/BRepTest/BRepTest_BasicCommands.cxx b/src/BRepTest/BRepTest_BasicCommands.cxx index 123c76b96e..580f722a4a 100644 --- a/src/BRepTest/BRepTest_BasicCommands.cxx +++ b/src/BRepTest/BRepTest_BasicCommands.cxx @@ -1398,7 +1398,7 @@ static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const if (n < 3) { di << "Usage result hull [-l cm cb_new cb_old lpp] or [-q aftlim cca ccf forelim aft_coef fore_coef modify_aft_zone modify_fore_zone] "; - di << "[-s XCoord_section1 ... XCoord_sectionN] or [-a minSectionTol]\n"; + di << "[-s XCoord_section1 ... XCoord_sectionN] or [-a minSectionTol] or [-f step]\n"; return 1; } @@ -1415,6 +1415,12 @@ static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const std::list aSections; bool isAutoSection = false; + bool isQuad = false; + double _aftlim = 0; + double _cca = 0; + double _ccf = 0; + double _forelim = 0; + double _lpp = 0; int i = 3; while (i < n) { @@ -1424,7 +1430,7 @@ static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const double _cm = Atof(a[i + 1]); double _cb_new = Atof(a[i + 2]); double _cb_old = Atof(a[i + 3]); - double _lpp = Atof(a[i + 4]); + _lpp = Atof(a[i + 4]); aHTrsf.InitLinear(_cm, _cb_new, _cb_old, _lpp); i += 4; continue; @@ -1432,10 +1438,11 @@ static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const if (a[i][0] == '-' && a[i][1] == 'q' && n > i+8) { // init quad transformation parameters - double _aftlim = Atof(a[i + 1]); - double _cca = Atof(a[i + 2]); - double _ccf = Atof(a[i + 3]); - double _forelim = Atof(a[i + 4]); + isQuad = true; + _aftlim = Atof(a[i + 1]); + _cca = Atof(a[i + 2]); + _ccf = Atof(a[i + 3]); + _forelim = Atof(a[i + 4]); double _aft_coef = Atof(a[i + 5]); double _fore_coef = Atof(a[i + 6]); bool _modify_aft_zone = (Draw::Atoi(a[i + 7]) == 1); @@ -1463,6 +1470,25 @@ static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const aHTrsf.SetAutoSections(true, aTol); continue; } + if (a[i][0] == '-' && a[i][1] == 'f') + { + double aStep = Atof(a[i + 1]); + i += 2; + if (isQuad) + { + aSections.push_back(_aftlim - aStep); + aSections.push_back(_aftlim + aStep); + aSections.push_back(_forelim - aStep); + aSections.push_back(_forelim + aStep); + } + else + { + aSections.push_back(_lpp / 2 - aStep); + aSections.push_back(_lpp / 2 + aStep); + } + aHTrsf.SetSections(aSections); + continue; + } i++; } @@ -1649,7 +1675,8 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands) "[-l cm cb_new cb_old lpp] for linear or " "[-q aftlim cca ccf forelim aft_coef fore_coef modify_aft_zone modify_fore_zone] for quad " "[-s XCoord_section1 ... XCoord_sectionN] to add sections or " - "[-a tol (min distance between sections)] for auto sectioning\n", + "[-f step (step in both sides) for making section fence around behavior-changing points ] and/or" + "[-a tol (min distance between sections)] for auto sectioning", __FILE__, hulltrsf, g);