mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
0025477: Boolean Operations with additional tolerance - Fuzzy Boolean operations
Implementation of Fuzzy Boolean operations. Such operations allow to perform Boolean operations on the shapes with near-coincidence between the entities of these shapes, i.e. between shapes in which some entities from one shape are intended to be coincide with some entities from the other, but the coincidence is not precise. API for Boolean operations has been improved to have a possibility to add new options. Modified entities: 1. New option of setting additional tolerance have been added to the following classes: class BOPAlgo_ArgumentAnalyzer class BOPAlgo_BOP class BOPAlgo_Builder class BOPAlgo_MakerVolume class BOPAlgo_PaveFiller class BOPDS_DS class BRepAlgoAPI_BooleanOperation class BRepAlgoAPI_Check class BRepAlgoAPI_Common class BRepAlgoAPI_Cut class BRepAlgoAPI_Fuse class BRepAlgoAPI_Section 2. Following draw commands have been modified to support new functionality: BOP commands: bop b1 b2 [tol] bcommon r b1 b2 [tol] bcut r b1 b2 [tol] bfuse r b1 b2 [tol] bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol] mkvolume r b1 b2 ... [-c] [-ni] [-s] [tol] bfillds [-s -t] [tol] Check commands: bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol] bopargcheck [-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] [-tol tol] 3. Two new classes have been added to API to provide the root interface for algorithms class BRepAlgoAPI_Algo class BRepAlgoAPI_BuilderAlgo Fix to eliminate the warning. Test-cases for issue #25477
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
//
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
@@ -95,24 +97,26 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
|
||||
const char* g = "BOP commands";
|
||||
// Commands
|
||||
|
||||
theCommands.Add("bop" , "use bop s1 s2" , __FILE__, bop, g);
|
||||
theCommands.Add("bopcommon" , "use bopcommon r" , __FILE__, bopcommon, g);
|
||||
theCommands.Add("bopfuse" , "use bopfuse r" , __FILE__,bopfuse, g);
|
||||
theCommands.Add("bopcut" , "use bopcut" , __FILE__,bopcut, g);
|
||||
theCommands.Add("boptuc" , "use boptuc" , __FILE__,boptuc, g);
|
||||
theCommands.Add("bopsection", "use bopsection" , __FILE__,bopsection, g);
|
||||
theCommands.Add("bop" , "use bop s1 s2 [tol]" , __FILE__, bop, g);
|
||||
theCommands.Add("bopcommon" , "use bopcommon r" , __FILE__, bopcommon, g);
|
||||
theCommands.Add("bopfuse" , "use bopfuse r" , __FILE__,bopfuse, g);
|
||||
theCommands.Add("bopcut" , "use bopcut r" , __FILE__,bopcut, g);
|
||||
theCommands.Add("boptuc" , "use boptuc r" , __FILE__,boptuc, g);
|
||||
theCommands.Add("bopsection", "use bopsection r" , __FILE__,bopsection, g);
|
||||
//
|
||||
theCommands.Add("bcommon" , "use bcommon r s1 s2" , __FILE__,bcommon, g);
|
||||
theCommands.Add("bfuse" , "use bfuse r s1 s2" , __FILE__,bfuse, g);
|
||||
theCommands.Add("bcut" , "use bcut r s1 s2" , __FILE__,bcut, g);
|
||||
theCommands.Add("btuc" , "use btuc r s1 s2" , __FILE__,btuc, g);
|
||||
theCommands.Add("bsection", "Use >bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na]",
|
||||
theCommands.Add("bcommon" , "use bcommon r s1 s2 [tol]" , __FILE__,bcommon, g);
|
||||
theCommands.Add("bfuse" , "use bfuse r s1 s2 [tol]" , __FILE__,bfuse, g);
|
||||
theCommands.Add("bcut" , "use bcut r s1 s2 [tol]" , __FILE__,bcut, g);
|
||||
theCommands.Add("btuc" , "use btuc r s1 s2 [tol]" , __FILE__,btuc, g);
|
||||
theCommands.Add("bsection", "Use >bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]",
|
||||
__FILE__, bsection, g);
|
||||
//
|
||||
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d]", __FILE__, bopcurves, g);
|
||||
theCommands.Add("bopnews", "use bopnews -v[e,f]" , __FILE__, bopnews, g);
|
||||
theCommands.Add("bparallelmode", "bparallelmode [1/0] : show / set parallel mode for boolean operations", __FILE__, bparallelmode, g);
|
||||
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-ni (do not intersect)] [-s (run in non parallel mode)]", __FILE__, mkvolume , g);
|
||||
theCommands.Add("bparallelmode", "bparallelmode [1/0] : show / set parallel mode for boolean operations",
|
||||
__FILE__, bparallelmode, g);
|
||||
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]",
|
||||
__FILE__, mkvolume , g);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -123,11 +127,12 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
char buf[32];
|
||||
Standard_Integer iErr;
|
||||
Standard_Real aTol;
|
||||
TopoDS_Shape aS1, aS2;
|
||||
BOPCol_ListOfShape aLC;
|
||||
//
|
||||
if (n!=3) {
|
||||
di << " use bop Shape1 Shape2\n";
|
||||
if (n < 3 || n > 4) {
|
||||
di << " use bop Shape1 Shape2 [tol]\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
@@ -139,6 +144,11 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
aTol = 0.;
|
||||
if (n == 4) {
|
||||
aTol = Draw::Atof(a[3]);
|
||||
}
|
||||
//
|
||||
aLC.Append(aS1);
|
||||
aLC.Append(aS2);
|
||||
//
|
||||
@@ -150,6 +160,7 @@ Standard_Integer bop (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
pPF=new BOPAlgo_PaveFiller(aAL);
|
||||
//
|
||||
pPF->SetArguments(aLC);
|
||||
pPF->SetFuzzyValue(aTol);
|
||||
//
|
||||
pPF->Perform();
|
||||
iErr=pPF->ErrorStatus();
|
||||
@@ -203,7 +214,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
|
||||
const BOPAlgo_Operation aOp)
|
||||
{
|
||||
if (n<2) {
|
||||
di << " use bopsmt r\n";
|
||||
di << " use bopsmt r\n [tol]";
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
@@ -349,104 +360,74 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na]\n";
|
||||
const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
|
||||
if (n < 4) {
|
||||
di << usage;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
TopoDS_Shape aS1 = DBRep::Get(a[2]);
|
||||
TopoDS_Shape aS2 = DBRep::Get(a[3]);
|
||||
|
||||
//
|
||||
if (aS1.IsNull() || aS2.IsNull()) {
|
||||
di << " Null shapes are not allowed \n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
//
|
||||
Standard_Boolean bApp, bPC1, bPC2;
|
||||
Standard_Integer i;
|
||||
Standard_Real aTol;
|
||||
//
|
||||
bApp = Standard_True;
|
||||
bPC1 = Standard_True;
|
||||
bPC2 = Standard_True;
|
||||
|
||||
Standard_Boolean isbadparameter = Standard_False;
|
||||
|
||||
if(n > 4) {
|
||||
const char* key1 = a[4];
|
||||
const char* key2 = (n > 5) ? a[5] : NULL;
|
||||
const char* pcurveconf = NULL;
|
||||
|
||||
if (key1 &&
|
||||
(!strcasecmp(key1,"-n2d") ||
|
||||
!strcasecmp(key1,"-n2d1") ||
|
||||
!strcasecmp(key1,"-n2d2"))) {
|
||||
pcurveconf = key1;
|
||||
aTol = 0.;
|
||||
//
|
||||
for (i = 4; i < n; ++i) {
|
||||
if (!strcmp(a[i], "-n2d")) {
|
||||
bPC1 = Standard_False;
|
||||
bPC2 = Standard_False;
|
||||
}
|
||||
else if (!strcmp(a[i], "-n2d1")) {
|
||||
bPC1 = Standard_False;
|
||||
}
|
||||
else if (!strcmp(a[i], "-n2d2")) {
|
||||
bPC2 = Standard_False;
|
||||
}
|
||||
else if (!strcmp(a[i], "-na")) {
|
||||
bApp = Standard_False;
|
||||
}
|
||||
else {
|
||||
if (!strcasecmp(key1,"-na")) {
|
||||
bApp = Standard_False;
|
||||
}
|
||||
else {
|
||||
isbadparameter = Standard_True;
|
||||
}
|
||||
}
|
||||
if (key2) {
|
||||
if(!strcasecmp(key2,"-na")) {
|
||||
bApp = Standard_False;
|
||||
}
|
||||
else {
|
||||
isbadparameter = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if(!isbadparameter && pcurveconf) {
|
||||
if (!strcasecmp(pcurveconf, "-n2d1")) {
|
||||
bPC1 = Standard_False;
|
||||
}
|
||||
else {
|
||||
if (!strcasecmp(pcurveconf, "-n2d2")) {
|
||||
bPC2 = Standard_False;
|
||||
}
|
||||
else {
|
||||
if (!strcasecmp(pcurveconf, "-n2d")) {
|
||||
bPC1 = Standard_False;
|
||||
bPC2 = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
aTol = Draw::Atof(a[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!isbadparameter) {
|
||||
Standard_Integer iErr;
|
||||
char buf[80];
|
||||
//
|
||||
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
|
||||
aSec.Approximation(bApp);
|
||||
aSec.ComputePCurveOn1(bPC1);
|
||||
aSec.ComputePCurveOn2(bPC2);
|
||||
//
|
||||
aSec.Build();
|
||||
iErr=aSec.ErrorStatus();
|
||||
if (!aSec.IsDone()) {
|
||||
Sprintf(buf, " ErrorStatus : %d\n", iErr);
|
||||
di << buf;
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aR=aSec.Shape();
|
||||
if (aR.IsNull()) {
|
||||
di << " null shape\n";
|
||||
return 0;
|
||||
}
|
||||
DBRep::Set(a[1], aR);
|
||||
//
|
||||
Standard_Integer iErr;
|
||||
char buf[80];
|
||||
//
|
||||
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
|
||||
aSec.Approximation(bApp);
|
||||
aSec.ComputePCurveOn1(bPC1);
|
||||
aSec.ComputePCurveOn2(bPC2);
|
||||
aSec.SetFuzzyValue(aTol);
|
||||
//
|
||||
aSec.Build();
|
||||
iErr=aSec.ErrorStatus();
|
||||
if (!aSec.IsDone()) {
|
||||
Sprintf(buf, " ErrorStatus : %d\n", iErr);
|
||||
di << buf;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
di << usage;
|
||||
return 1;
|
||||
//
|
||||
const TopoDS_Shape& aR=aSec.Shape();
|
||||
if (aR.IsNull()) {
|
||||
di << " null shape\n";
|
||||
return 0;
|
||||
}
|
||||
DBRep::Set(a[1], aR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : bsmt
|
||||
//purpose :
|
||||
@@ -460,9 +441,10 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
Standard_Integer iErr;
|
||||
TopoDS_Shape aS1, aS2;
|
||||
BOPCol_ListOfShape aLC;
|
||||
Standard_Real aTol;
|
||||
//
|
||||
if (n!=4) {
|
||||
di << " use bx r s1 s2\n";
|
||||
if (n < 4 || n > 5) {
|
||||
di << " use bx r s1 s2 [tol]\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
@@ -473,6 +455,12 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
di << " null shapes are not allowed \n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
aTol = 0.;
|
||||
if (n == 5) {
|
||||
aTol = Draw::Atof(a[4]);
|
||||
}
|
||||
//
|
||||
aLC.Append(aS1);
|
||||
aLC.Append(aS2);
|
||||
//
|
||||
@@ -480,6 +468,7 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
||||
BOPAlgo_PaveFiller aPF(aAL);
|
||||
//
|
||||
aPF.SetArguments(aLC);
|
||||
aPF.SetFuzzyValue(aTol);
|
||||
//
|
||||
aPF.Perform();
|
||||
iErr=aPF.ErrorStatus();
|
||||
@@ -781,63 +770,81 @@ Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const c
|
||||
//=======================================================================
|
||||
Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
const char* usage = "Usage: mkvolume r b1 b2 ... [-ni (do not intersect)] [-s (run in non parallel mode)]\n";
|
||||
if (n < 3) {
|
||||
di << usage;
|
||||
di << "Usage: mkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]\n";
|
||||
di << "Options:\n";
|
||||
di << " -c - use this option if the arguments are compounds\n";
|
||||
di << " containing shapes that should be interfered;\n";
|
||||
di << " -ni - use this option if the arguments should not be interfered;\n";
|
||||
di << " -s - use this option to run the operation in non parallel mode;\n";
|
||||
di << " tol - additional tolerance value (real).\n";
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bToIntersect, bRunParallel;
|
||||
Standard_Integer i, aNb;
|
||||
const char* usage = "Type mkvolume without arguments for the usage of the command.\n";
|
||||
//
|
||||
aNb = n;
|
||||
Standard_Boolean bToIntersect, bRunParallel, bCompounds;
|
||||
Standard_Integer i;
|
||||
Standard_Real aTol;
|
||||
TopoDS_Shape aS;
|
||||
BOPCol_ListOfShape aLS;
|
||||
//
|
||||
aTol = 0.;
|
||||
bToIntersect = Standard_True;
|
||||
bRunParallel = Standard_True;
|
||||
bCompounds = Standard_False;
|
||||
//
|
||||
if (!strcmp(a[n-1], "-ni")) {
|
||||
bToIntersect = Standard_False;
|
||||
aNb = n-1;
|
||||
}
|
||||
else if (!strcmp(a[n-1], "-s")) {
|
||||
bRunParallel = Standard_False;
|
||||
aNb = n-1;
|
||||
}
|
||||
if (n > 3) {
|
||||
if (!strcmp(a[n-2], "-ni")) {
|
||||
bToIntersect = Standard_False;
|
||||
aNb = n-2;
|
||||
}
|
||||
else if (!strcmp(a[n-2], "-s")) {
|
||||
bRunParallel = Standard_False;
|
||||
aNb = n-2;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aNb < 3) {
|
||||
di << "no shapes to process.\n";
|
||||
di << usage;
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPCol_ListOfShape aLS;
|
||||
TopoDS_Shape aS;
|
||||
for (i = 2; i < aNb; ++i) {
|
||||
for (i = 2; i < n; ++i) {
|
||||
aS = DBRep::Get(a[i]);
|
||||
if (!aS.IsNull()) {
|
||||
aLS.Append(aS);
|
||||
}
|
||||
else {
|
||||
if (!strcmp(a[i], "-c")) {
|
||||
bCompounds = Standard_True;
|
||||
}
|
||||
else if (!strcmp(a[i], "-ni")) {
|
||||
bToIntersect = Standard_False;
|
||||
}
|
||||
else if (!strcmp(a[i], "-s")) {
|
||||
bRunParallel = Standard_False;
|
||||
}
|
||||
else {
|
||||
aTol = Draw::Atof(a[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aLS.IsEmpty()) {
|
||||
di << "no shapes to process.\n";
|
||||
di << "No shapes to process.\n";
|
||||
di << usage;
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
// treat list of arguments for the case of compounds
|
||||
if (bToIntersect && bCompounds) {
|
||||
BOPCol_ListOfShape aLSx;
|
||||
BOPCol_ListIteratorOfListOfShape aItLS;
|
||||
//
|
||||
aItLS.Initialize(aLS);
|
||||
for (; aItLS.More(); aItLS.Next()) {
|
||||
const TopoDS_Shape& aSx = aItLS.Value();
|
||||
TopoDS_Iterator aItS(aSx);
|
||||
for (; aItS.More(); aItS.Next()) {
|
||||
const TopoDS_Shape& aSxS = aItS.Value();
|
||||
aLSx.Append(aSxS);
|
||||
}
|
||||
}
|
||||
//
|
||||
aLS.Clear();
|
||||
aLS.Assign(aLSx);
|
||||
}
|
||||
//
|
||||
BOPAlgo_MakerVolume aMV;
|
||||
aMV.SetArguments(aLS);
|
||||
aMV.SetIntersect(bToIntersect);
|
||||
aMV.SetRunParallel(bRunParallel);
|
||||
aMV.SetFuzzyValue(aTol);
|
||||
//
|
||||
aMV.Perform();
|
||||
if (aMV.ErrorStatus()) {
|
||||
@@ -851,4 +858,3 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -152,7 +152,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
const char** a )
|
||||
{
|
||||
if (n<2) {
|
||||
di << " Use > bopcheck Shape [level of check: 0 - 9] [-t -s]" << "\n";
|
||||
di << " Use > bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol]" << "\n";
|
||||
di << " The level of check defines ";
|
||||
di << " which interferences will be checked:\n";
|
||||
di << " 0 - V/V only\n";
|
||||
@@ -177,13 +177,16 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
//
|
||||
Standard_Boolean bRunParallel, bShowTime;
|
||||
Standard_Integer i, aLevel, aNbInterfTypes;
|
||||
Standard_Real aTolerance;
|
||||
//
|
||||
aNbInterfTypes=BOPDS_DS::NbInterfTypes();
|
||||
//
|
||||
aLevel=aNbInterfTypes-1;
|
||||
//
|
||||
if (n>2) {
|
||||
aLevel=Draw::Atoi(a[2]);
|
||||
if (a[2][0] != '-') {
|
||||
aLevel=Draw::Atoi(a[2]);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aLevel < 0 || aLevel > aNbInterfTypes-1) {
|
||||
@@ -191,15 +194,22 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
aTolerance = 0;
|
||||
bShowTime=Standard_False;
|
||||
bRunParallel=Standard_True;
|
||||
for (i=3; i<n; ++i) {
|
||||
for (i=2; i<n; ++i) {
|
||||
if (!strcmp(a[i], "-s")) {
|
||||
bRunParallel=Standard_False;
|
||||
}
|
||||
else if (!strcmp(a[i], "-t")) {
|
||||
bShowTime=Standard_True;
|
||||
}
|
||||
else if (!strcmp(a[i], "-tol")) {
|
||||
if (i+1 < n) {
|
||||
++i;
|
||||
aTolerance = Draw::Atof(a[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
//aLevel = (n==3) ? Draw::Atoi(a[2]) : aNbInterfTypes-1;
|
||||
@@ -233,6 +243,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
||||
aChecker.SetArguments(aLS);
|
||||
aChecker.SetLevelOfCheck(aLevel);
|
||||
aChecker.SetRunParallel(bRunParallel);
|
||||
aChecker.SetFuzzyValue(aTolerance);
|
||||
//
|
||||
aChrono.Start();
|
||||
//
|
||||
@@ -331,7 +342,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (n<2) {
|
||||
di << "\n";
|
||||
di << " Use >bopargcheck Shape1 [[Shape2] ";
|
||||
di << "[-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF]" << "\n" << "\n";
|
||||
di << "[-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] [-tol tol]" << "\n" << "\n";
|
||||
di << " -<Boolean Operation>" << "\n";
|
||||
di << " F (fuse)" << "\n";
|
||||
di << " O (common)" << "\n";
|
||||
@@ -385,11 +396,19 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
Standard_Integer indxAD = 0;
|
||||
Standard_Boolean isS2 = Standard_False;
|
||||
Standard_Integer indxS2 = 0;
|
||||
Standard_Real aTolerance = 0;
|
||||
|
||||
if(n >= 3) {
|
||||
Standard_Integer iIndex = 0;
|
||||
for(iIndex = 2; iIndex < n; iIndex++) {
|
||||
if(a[iIndex][0] == '-')
|
||||
if(!strcmp(a[iIndex], "-tol"))
|
||||
{
|
||||
if ((iIndex+1) < n) {
|
||||
++iIndex;
|
||||
aTolerance = Draw::Atof(a[iIndex]);
|
||||
}
|
||||
}
|
||||
else if(a[iIndex][0] == '-')
|
||||
{
|
||||
isBO = Standard_True;
|
||||
indxBO = iIndex;
|
||||
@@ -411,7 +430,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// set & test second shape
|
||||
TopoDS_Shape aS22, aS2;
|
||||
if(isS2) {
|
||||
@@ -429,9 +448,10 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// init checker
|
||||
BOPAlgo_ArgumentAnalyzer aChecker;
|
||||
aChecker.SetFuzzyValue(aTolerance);
|
||||
aChecker.SetShape1(aS1);
|
||||
|
||||
// set default options (always tested!) for single and couple shapes
|
||||
@@ -729,13 +749,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S1_BadType != 0)
|
||||
CString1="YES";
|
||||
else
|
||||
CString1="NO";
|
||||
CString1=aChecker.ArgumentTypeMode() ? "NO" : "DISABLED";
|
||||
di << "Shapes are not suppotrted by BOP: " << CString1 << "\n";
|
||||
Standard_CString CString2;
|
||||
if (S1_SelfInt != 0)
|
||||
CString2="YES";
|
||||
else
|
||||
CString2="NO";
|
||||
CString2=aChecker.SelfInterMode() ? "NO" : "DISABLED";
|
||||
di << "Self-Intersections : " << CString2;
|
||||
if(S1_SelfInt != 0)
|
||||
di << " Cases(" << S1_SelfInt << ") Total shapes(" << S1_SelfIntAll << ")" << "\n";
|
||||
@@ -745,13 +765,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S1_OpAb != 0)
|
||||
CString13="YES";
|
||||
else
|
||||
CString13="NO";
|
||||
CString13=aChecker.SelfInterMode() ? "NO" : "DISABLED";
|
||||
di << "Check for SI has been aborted : " << CString13 << "\n";
|
||||
Standard_CString CString3;
|
||||
if (S1_SmalE != 0)
|
||||
CString3="YES";
|
||||
else
|
||||
CString3="NO";
|
||||
CString3=aChecker.SmallEdgeMode() ? "NO" : "DISABLED";
|
||||
di << "Too small edges : " << CString3;
|
||||
if(S1_SmalE != 0)
|
||||
di << " Cases(" << S1_SmalE << ") Total shapes(" << S1_SmalEAll << ")" << "\n";
|
||||
@@ -761,7 +781,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S1_BadF != 0)
|
||||
CString4="YES";
|
||||
else
|
||||
CString4="NO";
|
||||
CString4=aChecker.RebuildFaceMode() ? "NO" : "DISABLED";
|
||||
di << "Bad faces : " << CString4;
|
||||
if(S1_BadF != 0)
|
||||
di << " Cases(" << S1_BadF << ") Total shapes(" << S1_BadFAll << ")" << "\n";
|
||||
@@ -771,7 +791,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S1_BadV != 0)
|
||||
CString5="YES";
|
||||
else
|
||||
CString5="NO";
|
||||
CString5=aChecker.MergeVertexMode() ? "NO" : "DISABLED";
|
||||
di << "Too close vertices : " << CString5;
|
||||
if(S1_BadV != 0)
|
||||
di << " Cases(" << S1_BadV << ") Total shapes(" << S1_BadVAll << ")" << "\n";
|
||||
@@ -781,7 +801,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S1_BadE != 0)
|
||||
CString6="YES";
|
||||
else
|
||||
CString6="NO";
|
||||
CString6=aChecker.MergeEdgeMode() ? "NO" : "DISABLED";
|
||||
di << "Too close edges : " << CString6;
|
||||
if(S1_BadE != 0)
|
||||
di << " Cases(" << S1_BadE << ") Total shapes(" << S1_BadEAll << ")" << "\n";
|
||||
@@ -791,7 +811,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S1_C0 != 0)
|
||||
CString15="YES";
|
||||
else
|
||||
CString15="NO";
|
||||
CString15=aChecker.ContinuityMode() ? "NO" : "DISABLED";
|
||||
di << "Shapes with Continuity C0 : " << CString15;
|
||||
if(S1_C0 != 0)
|
||||
di << " Cases(" << S1_C0 << ") Total shapes(" << S1_C0All << ")" << "\n";
|
||||
@@ -802,7 +822,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S1_COnS != 0)
|
||||
CString17="YES";
|
||||
else
|
||||
CString17="NO";
|
||||
CString17=aChecker.CurveOnSurfaceMode() ? "NO" : "DISABLED";
|
||||
di << "Invalid Curve on Surface : " << CString17;
|
||||
if(S1_COnS != 0)
|
||||
di << " Cases(" << S1_COnS << ") Total shapes(" << S1_COnSAll << ")" << "\n";
|
||||
@@ -819,13 +839,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S2_BadType != 0)
|
||||
CString7="YES";
|
||||
else
|
||||
CString7="NO";
|
||||
CString7=aChecker.ArgumentTypeMode() ? "NO" : "DISABLED";
|
||||
di << "Shapes are not suppotrted by BOP: " << CString7 << "\n";
|
||||
Standard_CString CString8;
|
||||
if (S2_SelfInt != 0)
|
||||
CString8="YES";
|
||||
else
|
||||
CString8="NO";
|
||||
CString8=aChecker.SelfInterMode() ? "NO" : "DISABLED";
|
||||
di << "Self-Intersections : " << CString8;
|
||||
if(S2_SelfInt != 0)
|
||||
di << " Cases(" << S2_SelfInt << ") Total shapes(" << S2_SelfIntAll << ")" << "\n";
|
||||
@@ -836,13 +856,13 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S2_OpAb != 0)
|
||||
CString14="YES";
|
||||
else
|
||||
CString14="NO";
|
||||
CString14=aChecker.SelfInterMode() ? "NO" : "DISABLED";
|
||||
di << "Check for SI has been aborted : " << CString14 << "\n";
|
||||
Standard_CString CString9;
|
||||
if (S2_SmalE != 0)
|
||||
CString9="YES";
|
||||
else
|
||||
CString9="NO";
|
||||
CString9=aChecker.SmallEdgeMode() ? "NO" : "DISABLED";
|
||||
di << "Too small edges : " << CString9;
|
||||
if(S2_SmalE != 0)
|
||||
di << " Cases(" << S2_SmalE << ") Total shapes(" << S2_SmalEAll << ")" << "\n";
|
||||
@@ -852,7 +872,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S2_BadF != 0)
|
||||
CString10="YES";
|
||||
else
|
||||
CString10="NO";
|
||||
CString10=aChecker.RebuildFaceMode() ? "NO" : "DISABLED";
|
||||
di << "Bad faces : " << CString10;
|
||||
if(S2_BadF != 0)
|
||||
di << " Cases(" << S2_BadF << ") Total shapes(" << S2_BadFAll << ")" << "\n";
|
||||
@@ -862,7 +882,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S2_BadV != 0)
|
||||
CString11="YES";
|
||||
else
|
||||
CString11="NO";
|
||||
CString11=aChecker.MergeVertexMode() ? "NO" : "DISABLED";
|
||||
di << "Too close vertices : " << CString11;
|
||||
if(S2_BadV != 0)
|
||||
di << " Cases(" << S2_BadV << ") Total shapes(" << S2_BadVAll << ")" << "\n";
|
||||
@@ -872,7 +892,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S2_BadE != 0)
|
||||
CString12="YES";
|
||||
else
|
||||
CString12="NO";
|
||||
CString12=aChecker.MergeEdgeMode() ? "NO" : "DISABLED";
|
||||
di << "Too close edges : " << CString12;
|
||||
if(S2_BadE != 0)
|
||||
di << " Cases(" << S2_BadE << ") Total shapes(" << S2_BadEAll << ")" << "\n";
|
||||
@@ -882,7 +902,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S2_C0 != 0)
|
||||
CString16="YES";
|
||||
else
|
||||
CString16="NO";
|
||||
CString16=aChecker.ContinuityMode() ? "NO" : "DISABLED";
|
||||
di << "Shapes with Continuity C0 : " << CString16;
|
||||
if(S2_C0 != 0)
|
||||
di << " Cases(" << S2_C0 << ") Total shapes(" << S2_C0All << ")" << "\n";
|
||||
@@ -893,7 +913,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
||||
if (S2_COnS != 0)
|
||||
CString18="YES";
|
||||
else
|
||||
CString18="NO";
|
||||
CString18=aChecker.CurveOnSurfaceMode() ? "NO" : "DISABLED";
|
||||
di << "Invalid Curve on Surface : " << CString18;
|
||||
if(S2_COnS != 0)
|
||||
di << " Cases(" << S2_COnS << ") Total shapes(" << S2_COnSAll << ")" << "\n";
|
||||
@@ -975,7 +995,7 @@ Standard_Integer checkcurveonsurf(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
Standard_Integer nE, nF, anECounter, aFCounter;
|
||||
Standard_Real aT, aTolE, aD, aDMax;
|
||||
Standard_Real aT, aTolE, aDMax;
|
||||
TopExp_Explorer aExpF, aExpE;
|
||||
char buf[200], aFName[10], anEName[10];
|
||||
NCollection_DataMap<TopoDS_Shape, Standard_Real, TopTools_ShapeMapHasher> aDMETol;
|
||||
@@ -1002,10 +1022,9 @@ Standard_Integer checkcurveonsurf(Draw_Interpretor& di,
|
||||
}
|
||||
//
|
||||
if (aDMETol.IsBound(aE)) {
|
||||
aD = aDMETol.Find(aE);
|
||||
Standard_Real& aD = aDMETol.ChangeFind(aE);
|
||||
if (aDMax > aD) {
|
||||
aDMETol.UnBind(aE);
|
||||
aDMETol.Bind(aE, aDMax);
|
||||
aD = aDMax;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -54,10 +54,10 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
|
||||
// Chapter's name
|
||||
const char* g = "Partition commands";
|
||||
// Commands
|
||||
theCommands.Add("bfillds", "use bfillds [-s -t]" , __FILE__, bfillds, g);
|
||||
theCommands.Add("bbuild" , "use bbuild r [-s -t]" , __FILE__, bbuild, g);
|
||||
theCommands.Add("bbop" , "use bbop r op [-s -t]", __FILE__, bbop, g);
|
||||
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
|
||||
theCommands.Add("bfillds", "use bfillds [-s -t] [tol]" , __FILE__, bfillds, g);
|
||||
theCommands.Add("bbuild" , "use bbuild r [-s -t]" , __FILE__, bbuild, g);
|
||||
theCommands.Add("bbop" , "use bbop r op [-s -t]" , __FILE__, bbop, g);
|
||||
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -84,14 +84,15 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n>3) {
|
||||
di << " use bfillds [-s -t]\n";
|
||||
if (n > 4) {
|
||||
di << " use bfillds [-s -t] [tol]\n";
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
char buf[32];
|
||||
Standard_Boolean bRunParallel, bShowTime;
|
||||
Standard_Integer i, aNbS, iErr;
|
||||
Standard_Real aTol;
|
||||
BOPCol_ListIteratorOfListOfShape aIt;
|
||||
BOPCol_ListOfShape aLC;
|
||||
BOPTime_Chronometer aChrono;
|
||||
@@ -103,8 +104,9 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
return 0;
|
||||
}
|
||||
//
|
||||
bShowTime=Standard_False;
|
||||
bRunParallel=Standard_True;
|
||||
bShowTime = Standard_False;
|
||||
bRunParallel = Standard_True;
|
||||
aTol = 0.;
|
||||
for (i=1; i<n; ++i) {
|
||||
if (!strcmp(a[i], "-s")) {
|
||||
bRunParallel=Standard_False;
|
||||
@@ -112,6 +114,9 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
else if (!strcmp(a[i], "-t")) {
|
||||
bShowTime=Standard_True;
|
||||
}
|
||||
else {
|
||||
aTol = Draw::Atof(a[i]);
|
||||
}
|
||||
}
|
||||
//
|
||||
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
|
||||
@@ -132,6 +137,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
||||
//
|
||||
aPF.SetArguments(aLC);
|
||||
aPF.SetRunParallel(bRunParallel);
|
||||
aPF.SetFuzzyValue(aTol);
|
||||
//
|
||||
aChrono.Start();
|
||||
//
|
||||
@@ -318,6 +324,14 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
||||
//
|
||||
pBOP->SetOperation(aOp);
|
||||
}
|
||||
else {
|
||||
BOPCol_ListOfShape& aLSTools=BOPTest_Objects::Tools();
|
||||
aIt.Initialize(aLSTools);
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aS=aIt.Value();
|
||||
pBuilder->AddArgument(aS);
|
||||
}
|
||||
}
|
||||
//
|
||||
pBuilder->SetRunParallel(bRunParallel);
|
||||
//
|
||||
|
Reference in New Issue
Block a user