mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
Add parameter for fence-sectioning.
This commit is contained in:
@@ -109,23 +109,24 @@ TopoDS_Shape BRepAlgoAPI_HullTransform::Perform()
|
|||||||
Handle(ShapeFix_Shape) aShapeFixTool = new ShapeFix_Shape;
|
Handle(ShapeFix_Shape) aShapeFixTool = new ShapeFix_Shape;
|
||||||
aShapeFixTool->Init(aHTrsf.Shape());
|
aShapeFixTool->Init(aHTrsf.Shape());
|
||||||
aShapeFixTool->Perform();
|
aShapeFixTool->Perform();
|
||||||
|
TopoDS_Shape aResShape = aShapeFixTool->Shape();
|
||||||
ShapeAnalysis_ShapeTolerance aSat;
|
ShapeAnalysis_ShapeTolerance aSat;
|
||||||
aSat.InitTolerance();
|
aSat.InitTolerance();
|
||||||
aSat.AddTolerance(aShapeFixTool->Shape());
|
aSat.AddTolerance(aResShape);
|
||||||
|
|
||||||
// Check the necessarity of the next step
|
// 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;
|
isToProceed = false;
|
||||||
mySections.pop_back();
|
mySections.pop_back();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aTolerances.push_back(aSat.GlobalTolerance(1));
|
aTolerances.push_back(aSat.GlobalTolerance(0));
|
||||||
aHullsList.push_back(aShapeFixTool->Shape());
|
aHullsList.push_back(aResShape);
|
||||||
aSectionsList.push_back(mySections);
|
aSectionsList.push_back(mySections);
|
||||||
if (myIsAutoSection)
|
if (myIsAutoSection)
|
||||||
addSection(aShapeFixTool->Shape());
|
addSection(aResShape);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (isToProceed);
|
} while (isToProceed);
|
||||||
|
@@ -1398,7 +1398,7 @@ static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const
|
|||||||
if (n < 3)
|
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 << "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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1415,6 +1415,12 @@ static Standard_Integer hulltrsf(Draw_Interpretor& di, Standard_Integer n, const
|
|||||||
|
|
||||||
std::list<double> aSections;
|
std::list<double> aSections;
|
||||||
bool isAutoSection = false;
|
bool isAutoSection = false;
|
||||||
|
bool isQuad = false;
|
||||||
|
double _aftlim = 0;
|
||||||
|
double _cca = 0;
|
||||||
|
double _ccf = 0;
|
||||||
|
double _forelim = 0;
|
||||||
|
double _lpp = 0;
|
||||||
int i = 3;
|
int i = 3;
|
||||||
while (i < n)
|
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 _cm = Atof(a[i + 1]);
|
||||||
double _cb_new = Atof(a[i + 2]);
|
double _cb_new = Atof(a[i + 2]);
|
||||||
double _cb_old = Atof(a[i + 3]);
|
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);
|
aHTrsf.InitLinear(_cm, _cb_new, _cb_old, _lpp);
|
||||||
i += 4;
|
i += 4;
|
||||||
continue;
|
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)
|
if (a[i][0] == '-' && a[i][1] == 'q' && n > i+8)
|
||||||
{
|
{
|
||||||
// init quad transformation parameters
|
// init quad transformation parameters
|
||||||
double _aftlim = Atof(a[i + 1]);
|
isQuad = true;
|
||||||
double _cca = Atof(a[i + 2]);
|
_aftlim = Atof(a[i + 1]);
|
||||||
double _ccf = Atof(a[i + 3]);
|
_cca = Atof(a[i + 2]);
|
||||||
double _forelim = Atof(a[i + 4]);
|
_ccf = Atof(a[i + 3]);
|
||||||
|
_forelim = Atof(a[i + 4]);
|
||||||
double _aft_coef = Atof(a[i + 5]);
|
double _aft_coef = Atof(a[i + 5]);
|
||||||
double _fore_coef = Atof(a[i + 6]);
|
double _fore_coef = Atof(a[i + 6]);
|
||||||
bool _modify_aft_zone = (Draw::Atoi(a[i + 7]) == 1);
|
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);
|
aHTrsf.SetAutoSections(true, aTol);
|
||||||
continue;
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1649,7 +1675,8 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
|||||||
"[-l cm cb_new cb_old lpp] for linear or "
|
"[-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 "
|
"[-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 "
|
"[-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__,
|
__FILE__,
|
||||||
hulltrsf, g);
|
hulltrsf, g);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user