mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-08 18:40:55 +03:00
0025700: Ensuring uniform control of the functionalities of the Boolean operations algorithm at the level of DRAW application
Changes: 1. Class BOPTest_Chronometer The class definition that depends on TBB has been removed 2. For the following commands: >bop s1 s2 [tol] >bopcommon r s1 s2 [tol] >bfuse r s1 s2 [tol] >bcut s1 s2 [tol] >btuc r s1 s2 [tol] >bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol] >mkvolume r b1 b2 ... [-c] [-ni] [-s] [tol] >bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol] >bopargcheck Shape1 [[Shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] [-tol tol] >bfillds [-s -t] [tol] the syntax has been changed. Parameter [tol] has been removed. The value "tol" (i.e. Fuzzy Value) is option for the algorithm. If it is necessary, the value "tol" can be set by the command: >bfuzzyvalue value see http://tracker.dev.opencascade.org/view.php?id=25614 for more details 3. For the following commands: >bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol] >bfillds [-s -t] [tol] >bbuild r [-s -t] >bbop r op [-s -t] the syntax has been changed. Parameter [-s] has been removed. Parameter [-s] was to provide the sequential mode of the computations. The mode of the computations is option for the algorithm. The mode of the computations can be set by the command: >brunparallel [0/1] 1 -sets the parallel mode of the computations 0 -sets the sequential mode of the computations see http://tracker.dev.opencascade.org/view.php?id=25614 for more details
This commit is contained in:
parent
49297cb6bd
commit
43cb001124
@ -52,7 +52,7 @@ void BOPTest::APICommands(Draw_Interpretor& theCommands)
|
|||||||
if (done) return;
|
if (done) return;
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "Partition commands";
|
const char* g = "BOPTest commands";
|
||||||
// Commands
|
// Commands
|
||||||
theCommands.Add("bapibuild", "use bapibuild r" , __FILE__, bapibuild, g);
|
theCommands.Add("bapibuild", "use bapibuild r" , __FILE__, bapibuild, g);
|
||||||
theCommands.Add("bapibop", "use bapibop r type" , __FILE__, bapibop, g);
|
theCommands.Add("bapibop", "use bapibop r type" , __FILE__, bapibop, g);
|
||||||
@ -170,9 +170,11 @@ Standard_Integer bapibuild(Draw_Interpretor& di,
|
|||||||
BRepAlgoAPI_BuilderAlgo aBuilder;
|
BRepAlgoAPI_BuilderAlgo aBuilder;
|
||||||
//
|
//
|
||||||
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
|
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
|
||||||
|
BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
|
||||||
//
|
//
|
||||||
TopTools_ListOfShape aLS, aLT;
|
TopTools_ListOfShape aLS;
|
||||||
ConvertList(aLSB, aLS);
|
ConvertList(aLSB, aLS);
|
||||||
|
ConvertList(aLTB, aLS);
|
||||||
//
|
//
|
||||||
bRunParallel=BOPTest_Objects::RunParallel();
|
bRunParallel=BOPTest_Objects::RunParallel();
|
||||||
aFuzzyValue=BOPTest_Objects::FuzzyValue();
|
aFuzzyValue=BOPTest_Objects::FuzzyValue();
|
||||||
@ -207,7 +209,6 @@ void ConvertList(const BOPCol_ListOfShape& aLSB,
|
|||||||
{
|
{
|
||||||
BOPCol_ListIteratorOfListOfShape aItB;
|
BOPCol_ListIteratorOfListOfShape aItB;
|
||||||
//
|
//
|
||||||
aLS.Clear();
|
|
||||||
aItB.Initialize(aLSB);
|
aItB.Initialize(aLSB);
|
||||||
for (; aItB.More(); aItB.Next()) {
|
for (; aItB.More(); aItB.Next()) {
|
||||||
const TopoDS_Shape& aS=aItB.Value();
|
const TopoDS_Shape& aS=aItB.Value();
|
||||||
|
@ -64,6 +64,7 @@ static
|
|||||||
Standard_Integer n,
|
Standard_Integer n,
|
||||||
const char** a,
|
const char** a,
|
||||||
const BOPAlgo_Operation aOp);
|
const BOPAlgo_Operation aOp);
|
||||||
|
//
|
||||||
static
|
static
|
||||||
Standard_Integer bsmt (Draw_Interpretor& di,
|
Standard_Integer bsmt (Draw_Interpretor& di,
|
||||||
Standard_Integer n,
|
Standard_Integer n,
|
||||||
@ -85,9 +86,6 @@ static Standard_Integer bcommon (Draw_Interpretor&, Standard_Integer, const ch
|
|||||||
//
|
//
|
||||||
static Standard_Integer bopcurves (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer bopcurves (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
static Standard_Integer bopnews (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer bopnews (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
//
|
|
||||||
static Standard_Integer bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
|
|
||||||
//
|
|
||||||
static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -100,28 +98,26 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
|
|||||||
if (done) return;
|
if (done) return;
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "BOP commands";
|
const char* g = "BOPTest commands";
|
||||||
// Commands
|
// Commands
|
||||||
|
|
||||||
theCommands.Add("bop" , "use bop s1 s2 [tol]" , __FILE__, bop, g);
|
theCommands.Add("bop" , "use bop s1 s2" , __FILE__, bop, g);
|
||||||
theCommands.Add("bopcommon" , "use bopcommon r" , __FILE__, bopcommon, g);
|
theCommands.Add("bopcommon" , "use bopcommon r" , __FILE__, bopcommon, g);
|
||||||
theCommands.Add("bopfuse" , "use bopfuse r" , __FILE__,bopfuse, g);
|
theCommands.Add("bopfuse" , "use bopfuse r" , __FILE__,bopfuse, g);
|
||||||
theCommands.Add("bopcut" , "use bopcut r" , __FILE__,bopcut, g);
|
theCommands.Add("bopcut" , "use bopcut r" , __FILE__,bopcut, g);
|
||||||
theCommands.Add("boptuc" , "use boptuc r" , __FILE__,boptuc, g);
|
theCommands.Add("boptuc" , "use boptuc r" , __FILE__,boptuc, g);
|
||||||
theCommands.Add("bopsection", "use bopsection r" , __FILE__,bopsection, g);
|
theCommands.Add("bopsection", "use bopsection r" , __FILE__,bopsection, g);
|
||||||
//
|
//
|
||||||
theCommands.Add("bcommon" , "use bcommon r s1 s2 [tol]" , __FILE__,bcommon, g);
|
theCommands.Add("bcommon" , "use bcommon r s1 s2" , __FILE__,bcommon, g);
|
||||||
theCommands.Add("bfuse" , "use bfuse r s1 s2 [tol]" , __FILE__,bfuse, g);
|
theCommands.Add("bfuse" , "use bfuse r s1 s2" , __FILE__,bfuse, g);
|
||||||
theCommands.Add("bcut" , "use bcut r s1 s2 [tol]" , __FILE__,bcut, g);
|
theCommands.Add("bcut" , "use bcut r s1 s2" , __FILE__,bcut, g);
|
||||||
theCommands.Add("btuc" , "use btuc r s1 s2 [tol]" , __FILE__,btuc, g);
|
theCommands.Add("btuc" , "use btuc r s1 s2" , __FILE__,btuc, g);
|
||||||
theCommands.Add("bsection", "Use >bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]",
|
theCommands.Add("bsection", "use bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na]",
|
||||||
__FILE__, bsection, g);
|
__FILE__, bsection, g);
|
||||||
//
|
//
|
||||||
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d]", __FILE__, bopcurves, 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("bopnews" , "use bopnews -v[e,f]" , __FILE__, bopnews, g);
|
||||||
theCommands.Add("bparallelmode", "bparallelmode [1/0] : show / set parallel mode for boolean operations",
|
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni]",
|
||||||
__FILE__, bparallelmode, g);
|
|
||||||
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]",
|
|
||||||
__FILE__, mkvolume , g);
|
__FILE__, mkvolume , g);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +125,9 @@ static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const c
|
|||||||
//function : bop
|
//function : bop
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bop(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bop(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
char buf[32];
|
char buf[32];
|
||||||
Standard_Boolean bRunParallel;
|
Standard_Boolean bRunParallel;
|
||||||
@ -138,8 +136,8 @@ Standard_Integer bop(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
|||||||
TopoDS_Shape aS1, aS2;
|
TopoDS_Shape aS1, aS2;
|
||||||
BOPCol_ListOfShape aLC;
|
BOPCol_ListOfShape aLC;
|
||||||
//
|
//
|
||||||
if (n < 3 || n > 4) {
|
if (n != 3) {
|
||||||
di << " use bop Shape1 Shape2 [tol]\n";
|
di << " use bop s1 s2 \n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -152,10 +150,6 @@ Standard_Integer bop(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
aTol=BOPTest_Objects::FuzzyValue();
|
aTol=BOPTest_Objects::FuzzyValue();
|
||||||
if (n == 4) {
|
|
||||||
aTol = Draw::Atof(a[3]);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
bRunParallel=BOPTest_Objects::RunParallel();
|
bRunParallel=BOPTest_Objects::RunParallel();
|
||||||
//
|
//
|
||||||
aLC.Append(aS1);
|
aLC.Append(aS1);
|
||||||
@ -186,7 +180,9 @@ Standard_Integer bop(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
|||||||
//function : bopcommon
|
//function : bopcommon
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bopcommon (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bopcommon (Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bopsmt(di, n, a, BOPAlgo_COMMON);
|
return bopsmt(di, n, a, BOPAlgo_COMMON);
|
||||||
}
|
}
|
||||||
@ -194,7 +190,9 @@ Standard_Integer bopcommon (Draw_Interpretor& di, Standard_Integer n, const char
|
|||||||
//function : bopfuse
|
//function : bopfuse
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bopfuse(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bopfuse(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bopsmt(di, n, a, BOPAlgo_FUSE);
|
return bopsmt(di, n, a, BOPAlgo_FUSE);
|
||||||
}
|
}
|
||||||
@ -202,7 +200,9 @@ Standard_Integer bopfuse(Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
//function : bopcut
|
//function : bopcut
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bopcut(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bopcut(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bopsmt(di, n, a, BOPAlgo_CUT);
|
return bopsmt(di, n, a, BOPAlgo_CUT);
|
||||||
}
|
}
|
||||||
@ -210,7 +210,9 @@ Standard_Integer bopcut(Draw_Interpretor& di, Standard_Integer n, const char** a
|
|||||||
//function : boptuc
|
//function : boptuc
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer boptuc(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer boptuc(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bopsmt(di, n, a, BOPAlgo_CUT21);
|
return bopsmt(di, n, a, BOPAlgo_CUT21);
|
||||||
}
|
}
|
||||||
@ -224,7 +226,7 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
|
|||||||
const BOPAlgo_Operation aOp)
|
const BOPAlgo_Operation aOp)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << " use bopsmt r\n [tol]";
|
di << " use bopsmt r\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -282,10 +284,12 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
|
|||||||
//function : bopsection
|
//function : bopsection
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bopsection(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << " use bopsmt r\n";
|
di << " use bopsection r\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -342,7 +346,9 @@ Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char
|
|||||||
//function : bcommon
|
//function : bcommon
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bcommon (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bcommon (Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bsmt(di, n, a, BOPAlgo_COMMON);
|
return bsmt(di, n, a, BOPAlgo_COMMON);
|
||||||
}
|
}
|
||||||
@ -350,7 +356,9 @@ Standard_Integer bcommon (Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
//function : bfuse
|
//function : bfuse
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bfuse (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bfuse (Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bsmt(di, n, a, BOPAlgo_FUSE);
|
return bsmt(di, n, a, BOPAlgo_FUSE);
|
||||||
}
|
}
|
||||||
@ -358,7 +366,9 @@ Standard_Integer bfuse (Draw_Interpretor& di, Standard_Integer n, const char** a
|
|||||||
//function : bcut
|
//function : bcut
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bcut (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bcut (Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bsmt(di, n, a, BOPAlgo_CUT);
|
return bsmt(di, n, a, BOPAlgo_CUT);
|
||||||
}
|
}
|
||||||
@ -366,7 +376,9 @@ Standard_Integer bcut (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
|||||||
//function : btuc
|
//function : btuc
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer btuc (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer btuc (Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
return bsmt(di, n, a, BOPAlgo_CUT21);
|
return bsmt(di, n, a, BOPAlgo_CUT21);
|
||||||
}
|
}
|
||||||
@ -378,15 +390,15 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
|||||||
Standard_Integer n,
|
Standard_Integer n,
|
||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
|
|
||||||
if (n < 4) {
|
if (n < 4) {
|
||||||
di << usage;
|
di << "use bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
TopoDS_Shape aS1 = DBRep::Get(a[2]);
|
TopoDS_Shape aS1, aS2;
|
||||||
TopoDS_Shape aS2 = DBRep::Get(a[3]);
|
|
||||||
//
|
//
|
||||||
|
aS1=DBRep::Get(a[2]);
|
||||||
|
aS2=DBRep::Get(a[3]);
|
||||||
if (aS1.IsNull() || aS2.IsNull()) {
|
if (aS1.IsNull() || aS2.IsNull()) {
|
||||||
di << " Null shapes are not allowed \n";
|
di << " Null shapes are not allowed \n";
|
||||||
return 0;
|
return 0;
|
||||||
@ -417,9 +429,6 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
|||||||
else if (!strcmp(a[i], "-na")) {
|
else if (!strcmp(a[i], "-na")) {
|
||||||
bApp = Standard_False;
|
bApp = Standard_False;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
aTol = Draw::Atof(a[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
|
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
|
||||||
@ -427,6 +436,7 @@ Standard_Integer bsection(Draw_Interpretor& di,
|
|||||||
aSec.Approximation(bApp);
|
aSec.Approximation(bApp);
|
||||||
aSec.ComputePCurveOn1(bPC1);
|
aSec.ComputePCurveOn1(bPC1);
|
||||||
aSec.ComputePCurveOn2(bPC2);
|
aSec.ComputePCurveOn2(bPC2);
|
||||||
|
//
|
||||||
aSec.SetFuzzyValue(aTol);
|
aSec.SetFuzzyValue(aTol);
|
||||||
aSec.SetRunParallel(bRunParallel);
|
aSec.SetRunParallel(bRunParallel);
|
||||||
//
|
//
|
||||||
@ -462,8 +472,8 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
|||||||
BOPCol_ListOfShape aLC;
|
BOPCol_ListOfShape aLC;
|
||||||
Standard_Real aTol;
|
Standard_Real aTol;
|
||||||
//
|
//
|
||||||
if (n < 4 || n > 5) {
|
if (n != 4) {
|
||||||
di << " use bx r s1 s2 [tol]\n";
|
di << " use bx r s1 s2\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -478,10 +488,6 @@ Standard_Integer bsmt (Draw_Interpretor& di,
|
|||||||
aLC.Append(aS2);
|
aLC.Append(aS2);
|
||||||
//
|
//
|
||||||
aTol=BOPTest_Objects::FuzzyValue();
|
aTol=BOPTest_Objects::FuzzyValue();
|
||||||
if (n == 5) {
|
|
||||||
aTol = Draw::Atof(a[4]);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
bRunParallel = BOPTest_Objects::RunParallel();
|
bRunParallel = BOPTest_Objects::RunParallel();
|
||||||
//
|
//
|
||||||
Handle(NCollection_BaseAllocator)aAL=new NCollection_IncAllocator;
|
Handle(NCollection_BaseAllocator)aAL=new NCollection_IncAllocator;
|
||||||
@ -760,13 +766,11 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
|
|||||||
Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||||
{
|
{
|
||||||
if (n < 3) {
|
if (n < 3) {
|
||||||
di << "Usage: mkvolume r b1 b2 ... [-c] [-ni] [-s] [tol]\n";
|
di << "Usage: mkvolume r b1 b2 ... [-c] [-ni]\n";
|
||||||
di << "Options:\n";
|
di << "Options:\n";
|
||||||
di << " -c - use this option if the arguments are compounds\n";
|
di << " -c - use this option if the arguments are compounds\n";
|
||||||
di << " containing shapes that should be interfered;\n";
|
di << " containing shapes that should be interfered;\n";
|
||||||
di << " -ni - use this option if the arguments should not 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;
|
return 1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -779,8 +783,9 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
BOPCol_ListOfShape aLS;
|
BOPCol_ListOfShape aLS;
|
||||||
//
|
//
|
||||||
aTol = BOPTest_Objects::FuzzyValue();
|
aTol = BOPTest_Objects::FuzzyValue();
|
||||||
bToIntersect = Standard_True;
|
|
||||||
bRunParallel = BOPTest_Objects::RunParallel();
|
bRunParallel = BOPTest_Objects::RunParallel();
|
||||||
|
//
|
||||||
|
bToIntersect = Standard_True;
|
||||||
bCompounds = Standard_False;
|
bCompounds = Standard_False;
|
||||||
//
|
//
|
||||||
for (i = 2; i < n; ++i) {
|
for (i = 2; i < n; ++i) {
|
||||||
@ -795,12 +800,6 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
else if (!strcmp(a[i], "-ni")) {
|
else if (!strcmp(a[i], "-ni")) {
|
||||||
bToIntersect = Standard_False;
|
bToIntersect = Standard_False;
|
||||||
}
|
}
|
||||||
else if (!strcmp(a[i], "-s")) {
|
|
||||||
bRunParallel = Standard_False;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aTol = Draw::Atof(a[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -847,31 +846,3 @@ Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
//
|
//
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//=======================================================================
|
|
||||||
//function : bparallelmode
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer bparallelmode(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
|
||||||
{
|
|
||||||
if (n == 2)
|
|
||||||
{
|
|
||||||
Standard_Boolean isParallelOn = Draw::Atoi (a[1]) == 1;
|
|
||||||
if (isParallelOn == 1)
|
|
||||||
{
|
|
||||||
BOPAlgo_Algo::SetParallelMode(Standard_True);
|
|
||||||
di << "Parallel mode for boolean operations has been enabled";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BOPAlgo_Algo::SetParallelMode(Standard_False);
|
|
||||||
di << "Parallel mode for boolean operations has been disabled";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
di << "Parallel mode state for boolean operations: "
|
|
||||||
<< (BOPAlgo_Algo::GetParallelMode()? "enabled" : "disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@ -45,6 +45,8 @@
|
|||||||
#include <BOPTools_AlgoTools.hxx>
|
#include <BOPTools_AlgoTools.hxx>
|
||||||
|
|
||||||
#include <BOPTest_Chronometer.hxx>
|
#include <BOPTest_Chronometer.hxx>
|
||||||
|
#include <BOPTest_Objects.hxx>
|
||||||
|
|
||||||
//
|
//
|
||||||
static
|
static
|
||||||
void MakeShapeForFullOutput (const TCollection_AsciiString&,
|
void MakeShapeForFullOutput (const TCollection_AsciiString&,
|
||||||
@ -73,19 +75,19 @@ void BOPTest::CheckCommands(Draw_Interpretor& theCommands)
|
|||||||
|
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "CCR commands";
|
const char* g = "BOPTest commands";
|
||||||
//
|
//
|
||||||
theCommands.Add("bopcheck",
|
theCommands.Add("bopcheck",
|
||||||
"Use >bopcheck Shape [level of check: 0(V/V) - 5(all)]",
|
"use bopcheck Shape [level of check: 0 - 9] [-t]",
|
||||||
__FILE__, bopcheck, g);
|
__FILE__, bopcheck, g);
|
||||||
theCommands.Add("bopargcheck" ,
|
theCommands.Add("bopargcheck" ,
|
||||||
"Use bopargcheck without parameters to get ",
|
"use bopargcheck without parameters to get ",
|
||||||
__FILE__, bopargcheck, g);
|
__FILE__, bopargcheck, g);
|
||||||
theCommands.Add ("xdistef" ,
|
theCommands.Add ("xdistef" ,
|
||||||
"Use xdistef edge face",
|
"use xdistef edge face",
|
||||||
__FILE__, xdistef, g);
|
__FILE__, xdistef, g);
|
||||||
theCommands.Add("checkcurveonsurf",
|
theCommands.Add("checkcurveonsurf",
|
||||||
"checkcurveonsurf shape",
|
"use checkcurveonsurf shape",
|
||||||
__FILE__, checkcurveonsurf, g);
|
__FILE__, checkcurveonsurf, g);
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -152,7 +154,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
|||||||
const char** a )
|
const char** a )
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << " Use > bopcheck Shape [level of check: 0 - 9] [-t -s] [-tol tol]" << "\n";
|
di << " use bopcheck Shape [level of check: 0 - 9] [-t]\n";
|
||||||
di << " The level of check defines ";
|
di << " The level of check defines ";
|
||||||
di << " which interferences will be checked:\n";
|
di << " which interferences will be checked:\n";
|
||||||
di << " 0 - V/V only\n";
|
di << " 0 - V/V only\n";
|
||||||
@ -177,7 +179,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
|||||||
//
|
//
|
||||||
Standard_Boolean bRunParallel, bShowTime;
|
Standard_Boolean bRunParallel, bShowTime;
|
||||||
Standard_Integer i, aLevel, aNbInterfTypes;
|
Standard_Integer i, aLevel, aNbInterfTypes;
|
||||||
Standard_Real aTolerance;
|
Standard_Real aTol;
|
||||||
//
|
//
|
||||||
aNbInterfTypes=BOPDS_DS::NbInterfTypes();
|
aNbInterfTypes=BOPDS_DS::NbInterfTypes();
|
||||||
//
|
//
|
||||||
@ -194,22 +196,14 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
aTolerance = 0;
|
|
||||||
bShowTime=Standard_False;
|
bShowTime=Standard_False;
|
||||||
bRunParallel=Standard_True;
|
aTol=BOPTest_Objects::FuzzyValue();
|
||||||
|
bRunParallel=BOPTest_Objects::RunParallel();
|
||||||
|
//
|
||||||
for (i=2; i<n; ++i) {
|
for (i=2; i<n; ++i) {
|
||||||
if (!strcmp(a[i], "-s")) {
|
if (!strcmp(a[i], "-t")) {
|
||||||
bRunParallel=Standard_False;
|
|
||||||
}
|
|
||||||
else if (!strcmp(a[i], "-t")) {
|
|
||||||
bShowTime=Standard_True;
|
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;
|
//aLevel = (n==3) ? Draw::Atoi(a[2]) : aNbInterfTypes-1;
|
||||||
@ -224,7 +218,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
|||||||
BOPAlgo_CheckerSI aChecker;
|
BOPAlgo_CheckerSI aChecker;
|
||||||
BOPCol_ListOfShape aLS;
|
BOPCol_ListOfShape aLS;
|
||||||
BOPDS_MapIteratorMapOfPassKey aItMPK;
|
BOPDS_MapIteratorMapOfPassKey aItMPK;
|
||||||
BOPTime_Chronometer aChrono;
|
BOPTest_Chronometer aChrono;
|
||||||
//
|
//
|
||||||
if (aLevel < (aNbInterfTypes-1)) {
|
if (aLevel < (aNbInterfTypes-1)) {
|
||||||
di << "Info:\nThe level of check is set to "
|
di << "Info:\nThe level of check is set to "
|
||||||
@ -243,7 +237,7 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
|
|||||||
aChecker.SetArguments(aLS);
|
aChecker.SetArguments(aLS);
|
||||||
aChecker.SetLevelOfCheck(aLevel);
|
aChecker.SetLevelOfCheck(aLevel);
|
||||||
aChecker.SetRunParallel(bRunParallel);
|
aChecker.SetRunParallel(bRunParallel);
|
||||||
aChecker.SetFuzzyValue(aTolerance);
|
aChecker.SetFuzzyValue(aTol);
|
||||||
//
|
//
|
||||||
aChrono.Start();
|
aChrono.Start();
|
||||||
//
|
//
|
||||||
@ -342,7 +336,7 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
|||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << "\n";
|
di << "\n";
|
||||||
di << " Use >bopargcheck Shape1 [[Shape2] ";
|
di << " Use >bopargcheck Shape1 [[Shape2] ";
|
||||||
di << "[-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF] [-tol tol]" << "\n" << "\n";
|
di << "[-F/O/C/T/S/U] [/R|F|T|V|E|I|P|C|S]] [#BF]\n\n";
|
||||||
di << " -<Boolean Operation>" << "\n";
|
di << " -<Boolean Operation>" << "\n";
|
||||||
di << " F (fuse)" << "\n";
|
di << " F (fuse)" << "\n";
|
||||||
di << " O (common)" << "\n";
|
di << " O (common)" << "\n";
|
||||||
@ -398,29 +392,20 @@ Standard_Integer bopargcheck (Draw_Interpretor& di,
|
|||||||
Standard_Integer indxS2 = 0;
|
Standard_Integer indxS2 = 0;
|
||||||
Standard_Real aTolerance = 0;
|
Standard_Real aTolerance = 0;
|
||||||
|
|
||||||
|
aTolerance=BOPTest_Objects::FuzzyValue();
|
||||||
|
|
||||||
if(n >= 3) {
|
if(n >= 3) {
|
||||||
Standard_Integer iIndex = 0;
|
Standard_Integer iIndex = 0;
|
||||||
for(iIndex = 2; iIndex < n; iIndex++) {
|
for(iIndex = 2; iIndex < n; iIndex++) {
|
||||||
if(!strcmp(a[iIndex], "-tol"))
|
if(a[iIndex][0] == '-') {
|
||||||
{
|
|
||||||
if ((iIndex+1) < n) {
|
|
||||||
++iIndex;
|
|
||||||
aTolerance = Draw::Atof(a[iIndex]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(a[iIndex][0] == '-')
|
|
||||||
{
|
|
||||||
isBO = Standard_True;
|
isBO = Standard_True;
|
||||||
indxBO = iIndex;
|
indxBO = iIndex;
|
||||||
}
|
}
|
||||||
//else if(a[iIndex][0] == '+')
|
else if(a[iIndex][0] == '/') {
|
||||||
else if(a[iIndex][0] == '/')
|
|
||||||
{
|
|
||||||
isOP = Standard_True;
|
isOP = Standard_True;
|
||||||
indxOP = iIndex;
|
indxOP = iIndex;
|
||||||
}
|
}
|
||||||
else if(a[iIndex][0] == '#')
|
else if(a[iIndex][0] == '#') {
|
||||||
{
|
|
||||||
isAD = Standard_True;
|
isAD = Standard_True;
|
||||||
indxAD = iIndex;
|
indxAD = iIndex;
|
||||||
}
|
}
|
||||||
@ -940,7 +925,7 @@ Standard_Integer xdistef(Draw_Interpretor& di,
|
|||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
if(n < 3) {
|
if(n < 3) {
|
||||||
di << "Use efmaxdist edge face\n";
|
di << "use xdistef edge face\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -15,49 +15,17 @@
|
|||||||
#ifndef BOPTest_Chronometer_HeaderFile
|
#ifndef BOPTest_Chronometer_HeaderFile
|
||||||
#define BOPTest_Chronometer_HeaderFile
|
#define BOPTest_Chronometer_HeaderFile
|
||||||
//
|
//
|
||||||
#ifdef HAVE_TBB
|
|
||||||
#include <BOPCol_TBB.hxx>
|
|
||||||
//=======================================================================
|
|
||||||
//class : BOPTime_Chronometer
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
class BOPTime_Chronometer {
|
|
||||||
public:
|
|
||||||
BOPTime_Chronometer() {
|
|
||||||
}
|
|
||||||
//
|
|
||||||
~BOPTime_Chronometer() {
|
|
||||||
}
|
|
||||||
//
|
|
||||||
void Start() {
|
|
||||||
myT0 = tick_count::now();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
void Stop() {
|
|
||||||
myTime=(tick_count::now() - myT0).seconds();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
double Time() const{
|
|
||||||
return myTime;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
protected:
|
|
||||||
tick_count myT0;
|
|
||||||
double myTime;
|
|
||||||
};
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
#else
|
|
||||||
#include <OSD_Chronometer.hxx>
|
#include <OSD_Chronometer.hxx>
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//class : BOPTime_Chronometer
|
//class : BOPTest_Chronometer
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
class BOPTime_Chronometer {
|
class BOPTest_Chronometer {
|
||||||
public:
|
public:
|
||||||
BOPTime_Chronometer() {
|
BOPTest_Chronometer() {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
~BOPTime_Chronometer() {
|
~BOPTest_Chronometer() {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
void Start() {
|
void Start() {
|
||||||
@ -78,6 +46,5 @@ class BOPTime_Chronometer {
|
|||||||
OSD_Chronometer myChronometer;
|
OSD_Chronometer myChronometer;
|
||||||
double myTime;
|
double myTime;
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
//
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
-- Alternatively, this file may be used under the terms of Open CASCADE
|
-- Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
-- commercial license or contractual agreement.
|
-- commercial license or contractual agreement.
|
||||||
|
|
||||||
class DrawableShape from BOPTest inherits DrawableShape from DBRep
|
class DrawableShape from BOPTest
|
||||||
|
inherits DrawableShape from DBRep
|
||||||
|
|
||||||
---Purpose:
|
---Purpose:
|
||||||
|
|
||||||
@ -28,33 +29,31 @@ uses
|
|||||||
Pnt from gp
|
Pnt from gp
|
||||||
|
|
||||||
is
|
is
|
||||||
|
Create (S : Shape from TopoDS;
|
||||||
|
FreeCol : Color from Draw; -- color for free edges
|
||||||
|
ConnCol : Color from Draw; -- color for shared edges
|
||||||
|
EdgeCol : Color from Draw; -- color for other edges
|
||||||
|
IsosCol : Color from Draw; -- color for Isos
|
||||||
|
size : Real; -- size for infinite isos
|
||||||
|
nbisos : Integer; -- # of isos on each face
|
||||||
|
discret : Integer; -- # of points on curves
|
||||||
|
Text : CString from Standard;
|
||||||
|
TextColor : Color from Draw)
|
||||||
|
returns DrawableShape from BOPTest;
|
||||||
|
|
||||||
Create (S : Shape from TopoDS;
|
Create (S : Shape from TopoDS;
|
||||||
FreeCol : Color from Draw; -- color for free edges
|
Text : CString from Standard;
|
||||||
ConnCol : Color from Draw; -- color for shared edges
|
TextColor : Color from Draw)
|
||||||
EdgeCol : Color from Draw; -- color for other edges
|
returns DrawableShape from BOPTest;
|
||||||
IsosCol : Color from Draw; -- color for Isos
|
|
||||||
size : Real; -- size for infinite isos
|
|
||||||
nbisos : Integer; -- # of isos on each face
|
|
||||||
discret : Integer; -- # of points on curves
|
|
||||||
Text : CString from Standard;
|
|
||||||
TextColor : Color from Draw
|
|
||||||
)
|
|
||||||
returns DrawableShape from BOPTest;
|
|
||||||
|
|
||||||
Create (S : Shape from TopoDS;
|
Pnt(me)
|
||||||
Text : CString from Standard;
|
returns Pnt from gp
|
||||||
TextColor : Color from Draw
|
is private;
|
||||||
)
|
|
||||||
returns DrawableShape from BOPTest;
|
|
||||||
|
|
||||||
Pnt(me) returns Pnt from gp is private;
|
|
||||||
|
|
||||||
DrawOn(me; dis : in out Display from Draw)
|
DrawOn(me; dis : in out Display from Draw)
|
||||||
is redefined;
|
is redefined;
|
||||||
|
|
||||||
fields
|
fields
|
||||||
|
|
||||||
myText : Text3D from Draw;
|
myText : Text3D from Draw;
|
||||||
myTextColor : Color from Draw;
|
myTextColor : Color from Draw;
|
||||||
|
|
||||||
|
@ -56,40 +56,40 @@
|
|||||||
//function :
|
//function :
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
|
BOPTest_DrawableShape::BOPTest_DrawableShape
|
||||||
const Draw_Color& FreeCol,
|
(const TopoDS_Shape& aShape,
|
||||||
const Draw_Color& ConnCol,
|
const Draw_Color& FreeCol,
|
||||||
const Draw_Color& EdgeCol,
|
const Draw_Color& ConnCol,
|
||||||
const Draw_Color& IsosCol,
|
const Draw_Color& EdgeCol,
|
||||||
const Standard_Real size,
|
const Draw_Color& IsosCol,
|
||||||
const Standard_Integer nbisos,
|
const Standard_Real size,
|
||||||
const Standard_Integer discret,
|
const Standard_Integer nbisos,
|
||||||
const Standard_CString Text,
|
const Standard_Integer discret,
|
||||||
const Draw_Color& TextColor)
|
const Standard_CString Text,
|
||||||
|
const Draw_Color& TextColor)
|
||||||
:
|
:
|
||||||
DBRep_DrawableShape(aShape,FreeCol,ConnCol,EdgeCol,IsosCol,size,nbisos,discret)
|
DBRep_DrawableShape(aShape,FreeCol,ConnCol,
|
||||||
|
EdgeCol,IsosCol,size,nbisos,discret)
|
||||||
{
|
{
|
||||||
myText = new Draw_Text3D(Pnt(),Text,TextColor);
|
myText = new Draw_Text3D(Pnt(),Text,TextColor);
|
||||||
myTextColor = TextColor;
|
myTextColor = TextColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :
|
//function :
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
|
BOPTest_DrawableShape::BOPTest_DrawableShape
|
||||||
const Standard_CString Text,
|
(const TopoDS_Shape& aShape,
|
||||||
const Draw_Color& TextColor)
|
const Standard_CString Text,
|
||||||
: DBRep_DrawableShape(
|
const Draw_Color& TextColor)
|
||||||
aShape,
|
: DBRep_DrawableShape(aShape,
|
||||||
Draw_vert,
|
Draw_vert,
|
||||||
Draw_jaune,
|
Draw_jaune,
|
||||||
Draw_rouge,
|
Draw_rouge,
|
||||||
Draw_bleu,
|
Draw_bleu,
|
||||||
100., //size
|
100., //size
|
||||||
2, //nbIsos
|
2, //nbIsos
|
||||||
30 //discret
|
30) //discret
|
||||||
)
|
|
||||||
{
|
{
|
||||||
myText = new Draw_Text3D(Pnt(),Text,TextColor);
|
myText = new Draw_Text3D(Pnt(),Text,TextColor);
|
||||||
myTextColor = TextColor;
|
myTextColor = TextColor;
|
||||||
@ -99,7 +99,7 @@ BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
|
|||||||
//function : Pnt
|
//function : Pnt
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
gp_Pnt BOPTest_DrawableShape::Pnt() const
|
gp_Pnt BOPTest_DrawableShape::Pnt() const
|
||||||
{
|
{
|
||||||
gp_Pnt P(0,0,0);
|
gp_Pnt P(0,0,0);
|
||||||
Standard_Real u, v, u1, u2, v1, v2, p;
|
Standard_Real u, v, u1, u2, v1, v2, p;
|
||||||
@ -121,77 +121,70 @@ BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
|
|||||||
}
|
}
|
||||||
// si S final = compound --> P = 0 0 0
|
// si S final = compound --> P = 0 0 0
|
||||||
|
|
||||||
switch (T)
|
switch (T) {
|
||||||
{
|
case TopAbs_VERTEX :
|
||||||
case TopAbs_VERTEX :
|
P = BRep_Tool::Pnt(TopoDS::Vertex(S));
|
||||||
P = BRep_Tool::Pnt(TopoDS::Vertex(S));
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_EDGE :
|
case TopAbs_EDGE : {
|
||||||
{
|
BRepAdaptor_Curve CU(TopoDS::Edge(S));
|
||||||
BRepAdaptor_Curve CU(TopoDS::Edge(S));
|
u1 = CU.FirstParameter();
|
||||||
u1 = CU.FirstParameter();
|
u2 = CU.LastParameter();
|
||||||
u2 = CU.LastParameter();
|
if (facpar == 0.) facpar = 0.20;
|
||||||
if (facpar == 0.) facpar = 0.20;
|
p = u1 + (u2-u1)*facpar;
|
||||||
p = u1 + (u2-u1)*facpar;
|
P = CU.Value(p);
|
||||||
P = CU.Value(p);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_WIRE :
|
case TopAbs_WIRE : {
|
||||||
{
|
TopTools_IndexedMapOfShape aME;
|
||||||
TopTools_IndexedMapOfShape aME;
|
TopExp::MapShapes(S, TopAbs_EDGE, aME);
|
||||||
TopExp::MapShapes(S, TopAbs_EDGE, aME);
|
const TopoDS_Edge& anEdge=TopoDS::Edge(aME(1));
|
||||||
const TopoDS_Edge& anEdge=TopoDS::Edge(aME(1));
|
BRepAdaptor_Curve CU(anEdge);
|
||||||
BRepAdaptor_Curve CU(anEdge);
|
u1 = CU.FirstParameter();
|
||||||
u1 = CU.FirstParameter();
|
u2 = CU.LastParameter();
|
||||||
u2 = CU.LastParameter();
|
if (facpar == 0.) facpar = 0.40;
|
||||||
if (facpar == 0.) facpar = 0.40;
|
p = u1 + (u2-u1)*facpar;
|
||||||
p = u1 + (u2-u1)*facpar;
|
P = CU.Value(p);
|
||||||
P = CU.Value(p);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_FACE :
|
case TopAbs_FACE : {
|
||||||
{
|
BRepAdaptor_Surface SU(TopoDS::Face(S));
|
||||||
BRepAdaptor_Surface SU(TopoDS::Face(S));
|
BRepTools::UVBounds(TopoDS::Face(S),u1,u2,v1,v2);
|
||||||
BRepTools::UVBounds(TopoDS::Face(S),u1,u2,v1,v2);
|
//
|
||||||
//
|
facpar = .2;
|
||||||
facpar = .2;
|
u = u1 + (u2-u1)*facpar;
|
||||||
u = u1 + (u2-u1)*facpar;
|
v = v1 + (v2-v1)*facpar;
|
||||||
v = v1 + (v2-v1)*facpar;
|
P = SU.Value(u,v);
|
||||||
P = SU.Value(u,v);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case TopAbs_SHELL :
|
case TopAbs_SHELL :
|
||||||
case TopAbs_SOLID :
|
case TopAbs_SOLID : {
|
||||||
{
|
TopTools_IndexedMapOfShape aMF;
|
||||||
TopTools_IndexedMapOfShape aMF;
|
TopExp::MapShapes(S, TopAbs_FACE, aMF);
|
||||||
TopExp::MapShapes(S, TopAbs_FACE, aMF);
|
const TopoDS_Face& aF=TopoDS::Face(aMF(1));
|
||||||
const TopoDS_Face& aF=TopoDS::Face(aMF(1));
|
|
||||||
|
|
||||||
BRepAdaptor_Surface SU(TopoDS::Face(aF));
|
BRepAdaptor_Surface SU(TopoDS::Face(aF));
|
||||||
BRepTools::UVBounds(aF,u1,u2,v1,v2);
|
BRepTools::UVBounds(aF,u1,u2,v1,v2);
|
||||||
facpar = .4;
|
facpar = .4;
|
||||||
u = u1 + (u2-u1)*facpar;
|
u = u1 + (u2-u1)*facpar;
|
||||||
v = v1 + (v2-v1)*facpar;
|
v = v1 + (v2-v1)*facpar;
|
||||||
P = SU.Value(u,v);
|
P = SU.Value(u,v);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return P;
|
return P;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : DrawOn
|
//function : DrawOn
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void BOPTest_DrawableShape::DrawOn(Draw_Display& dis) const
|
void BOPTest_DrawableShape::DrawOn(Draw_Display& dis) const
|
||||||
{
|
{
|
||||||
DBRep_DrawableShape::DrawOn(dis);
|
DBRep_DrawableShape::DrawOn(dis);
|
||||||
myText->SetPnt(Pnt());
|
myText->SetPnt(Pnt());
|
||||||
|
@ -70,12 +70,12 @@ static Standard_Integer bhaspc (Draw_Interpretor& , Standard_Integer , con
|
|||||||
if (done) return;
|
if (done) return;
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "CCR commands";
|
const char* g = "BOPTest commands";
|
||||||
theCommands.Add("bclassify" , "Use >bclassify Solid Point [Tolerance=1.e-7]",
|
theCommands.Add("bclassify" , "use bclassify Solid Point [Tolerance=1.e-7]",
|
||||||
__FILE__, bclassify , g);
|
__FILE__, bclassify , g);
|
||||||
theCommands.Add("b2dclassify" , "Use >bclassify Face Point2d [Tol2D=Tol(Face)] ",
|
theCommands.Add("b2dclassify" , "use bclassify Face Point2d [Tol2D=Tol(Face)] ",
|
||||||
__FILE__, b2dclassify , g);
|
__FILE__, b2dclassify , g);
|
||||||
theCommands.Add("bhaspc" , "Use >bhaspc Edge Face [do]",
|
theCommands.Add("bhaspc" , "use bhaspc Edge Face [do]",
|
||||||
__FILE__, bhaspc , g);
|
__FILE__, bhaspc , g);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,27 +87,25 @@ Standard_Integer bclassify (Draw_Interpretor& theDI,
|
|||||||
Standard_Integer theArgNb,
|
Standard_Integer theArgNb,
|
||||||
const char** theArgVec)
|
const char** theArgVec)
|
||||||
{
|
{
|
||||||
if (theArgNb < 3)
|
if (theArgNb < 3) {
|
||||||
{
|
theDI << " use bclassify Solid Point [Tolerance=1.e-7]\n";
|
||||||
theDI << " Use >bclassify Solid Point [Tolerance=1.e-7]\n";
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
|
TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
|
||||||
if (aS.IsNull())
|
if (aS.IsNull()) {
|
||||||
{
|
theDI << " Null Shape is not allowed\n";
|
||||||
theDI << " Null Shape is not allowed here\n";
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (aS.ShapeType() != TopAbs_SOLID)
|
else if (aS.ShapeType() != TopAbs_SOLID) {
|
||||||
{
|
|
||||||
theDI << " Shape type must be SOLID\n";
|
theDI << " Shape type must be SOLID\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
gp_Pnt aP (8., 9., 10.);
|
gp_Pnt aP (8., 9., 10.);
|
||||||
DrawTrSurf::GetPoint (theArgVec[2], aP);
|
DrawTrSurf::GetPoint (theArgVec[2], aP);
|
||||||
const Standard_Real aTol = (theArgNb == 4) ? Draw::Atof (theArgVec[3]) : 1.e-7; //Precision::Confusion();
|
const Standard_Real aTol = (theArgNb == 4) ?
|
||||||
|
Draw::Atof (theArgVec[3]) : 1.e-7;
|
||||||
|
|
||||||
BRepClass3d_SolidClassifier aSC (aS);
|
BRepClass3d_SolidClassifier aSC (aS);
|
||||||
aSC.Perform (aP,aTol);
|
aSC.Perform (aP,aTol);
|
||||||
@ -124,20 +122,17 @@ Standard_Integer b2dclassify (Draw_Interpretor& theDI,
|
|||||||
Standard_Integer theArgNb,
|
Standard_Integer theArgNb,
|
||||||
const char** theArgVec)
|
const char** theArgVec)
|
||||||
{
|
{
|
||||||
if (theArgNb < 3)
|
if (theArgNb < 3) {
|
||||||
{
|
theDI << " use bclassify Face Point2d [Tol2D=Tol(Face)]\n";
|
||||||
theDI << " Use >bclassify Face Point2d [Tol2D=Tol(Face)]\n";
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
|
TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
|
||||||
if (aS.IsNull())
|
if (aS.IsNull()) {
|
||||||
{
|
|
||||||
theDI << " Null Shape is not allowed here\n";
|
theDI << " Null Shape is not allowed here\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (aS.ShapeType() != TopAbs_FACE)
|
else if (aS.ShapeType() != TopAbs_FACE) {
|
||||||
{
|
|
||||||
theDI << " Shape type must be FACE\n";
|
theDI << " Shape type must be FACE\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -145,7 +140,8 @@ Standard_Integer b2dclassify (Draw_Interpretor& theDI,
|
|||||||
gp_Pnt2d aP (8., 9.);
|
gp_Pnt2d aP (8., 9.);
|
||||||
DrawTrSurf::GetPoint2d (theArgVec[2], aP);
|
DrawTrSurf::GetPoint2d (theArgVec[2], aP);
|
||||||
const TopoDS_Face& aF = TopoDS::Face(aS);
|
const TopoDS_Face& aF = TopoDS::Face(aS);
|
||||||
const Standard_Real aTol = (theArgNb == 4) ? Draw::Atof (theArgVec[3]) : BRep_Tool::Tolerance (aF);
|
const Standard_Real aTol = (theArgNb == 4) ?
|
||||||
|
Draw::Atof (theArgVec[3]) : BRep_Tool::Tolerance (aF);
|
||||||
|
|
||||||
BRepClass_FaceClassifier aClassifier;
|
BRepClass_FaceClassifier aClassifier;
|
||||||
aClassifier.Perform(aF, aP, aTol);
|
aClassifier.Perform(aF, aP, aTol);
|
||||||
@ -158,10 +154,12 @@ Standard_Integer b2dclassify (Draw_Interpretor& theDI,
|
|||||||
//function : bhaspc
|
//function : bhaspc
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bhaspc (Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bhaspc (Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<3) {
|
if (n<3) {
|
||||||
di << " Use bhaspc> Edge Face [do]\n";
|
di << " use bhaspc Edge Face [do]\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +196,6 @@ Standard_Integer bhaspc (Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : PrintState
|
//function : PrintState
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -206,16 +203,22 @@ Standard_Integer bhaspc (Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
void PrintState (Draw_Interpretor& theDI,
|
void PrintState (Draw_Interpretor& theDI,
|
||||||
const TopAbs_State& theState)
|
const TopAbs_State& theState)
|
||||||
{
|
{
|
||||||
switch (theState)
|
switch (theState) {
|
||||||
{
|
case TopAbs_IN:
|
||||||
case TopAbs_IN: theDI << "The point is IN shape\n"; return;
|
theDI << "The point is IN shape\n";
|
||||||
case TopAbs_OUT: theDI << "The point is OUT of shape\n"; return;
|
break;
|
||||||
case TopAbs_ON: theDI << "The point is ON shape\n"; return;
|
case TopAbs_OUT:
|
||||||
case TopAbs_UNKNOWN:
|
theDI << "The point is OUT of shape\n";
|
||||||
default: theDI << "The point is UNKNOWN shape\n"; return;
|
break;
|
||||||
|
case TopAbs_ON:
|
||||||
|
theDI << "The point is ON shape\n";
|
||||||
|
break;
|
||||||
|
case TopAbs_UNKNOWN:
|
||||||
|
default:
|
||||||
|
theDI << "The point is UNKNOWN shape\n";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : CurveOnSurface
|
//function : CurveOnSurface
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -25,12 +25,14 @@
|
|||||||
//
|
//
|
||||||
#include <BOPTest_Objects.hxx>
|
#include <BOPTest_Objects.hxx>
|
||||||
|
|
||||||
static Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer , const char** );
|
static Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer , const char** );
|
||||||
static Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer , const char** );
|
static Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer , const char** );
|
||||||
static Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer , const char** );
|
static Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer , const char** );
|
||||||
static Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer , const char** );
|
static Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer , const char** );
|
||||||
static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , const char** );
|
static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , const char** );
|
||||||
static Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer , const char** );
|
static Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer , const char** );
|
||||||
|
static Standard_Integer bclear (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
|
|
||||||
//
|
//
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function :ObjCommands
|
//function :ObjCommands
|
||||||
@ -42,23 +44,26 @@ static Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer , cons
|
|||||||
if (done) return;
|
if (done) return;
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "BOP commands";
|
const char* g = "BOPTest commands";
|
||||||
// Commands
|
// Commands
|
||||||
theCommands.Add("baddobjects" , "baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
|
theCommands.Add("baddobjects" , "use baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
|
||||||
theCommands.Add("bclearobjects" , "bclearobjects" , __FILE__, bclearobjects, g);
|
theCommands.Add("bclearobjects" , "use bclearobjects" , __FILE__, bclearobjects, g);
|
||||||
theCommands.Add("baddtools" , "baddtools s1 s2 ..." , __FILE__, baddtools, g);
|
theCommands.Add("baddtools" , "use baddtools s1 s2 ..." , __FILE__, baddtools, g);
|
||||||
theCommands.Add("bcleartools" , "bcleartools" , __FILE__, bcleartools, g);
|
theCommands.Add("bcleartools" , "use bcleartools" , __FILE__, bcleartools, g);
|
||||||
theCommands.Add("baddcompound" , "baddcompound c" , __FILE__, baddcompound, g);
|
theCommands.Add("baddcompound" , "use baddcompound c" , __FILE__, baddcompound, g);
|
||||||
theCommands.Add("baddctools" , "baddctools c" , __FILE__, baddctools, g);
|
theCommands.Add("baddctools" , "use baddctools c" , __FILE__, baddctools, g);
|
||||||
|
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : baddcompound
|
//function : baddcompound
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer baddcompound (Draw_Interpretor& , Standard_Integer n, const char** a)
|
Standard_Integer baddcompound (Draw_Interpretor& ,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
printf(" Use baddcompound c\n");
|
printf(" use baddcompound c\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -80,10 +85,12 @@ Standard_Integer baddcompound (Draw_Interpretor& , Standard_Integer n, const cha
|
|||||||
//function : baddctools
|
//function : baddctools
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer n, const char** a)
|
Standard_Integer baddctools (Draw_Interpretor& ,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
printf(" Use baddctools c\n");
|
printf(" use baddctools c\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -106,10 +113,12 @@ Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer n, const char*
|
|||||||
//function :baddobjects
|
//function :baddobjects
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer n, const char** a)
|
Standard_Integer baddobjects (Draw_Interpretor& ,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
printf(" Use baddobjects s1 s2 ...\n");
|
printf(" use baddobjects s1 s2 ...\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -128,10 +137,12 @@ Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer n, const char
|
|||||||
//function : bclearobjects
|
//function : bclearobjects
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer n, const char** )
|
Standard_Integer bclearobjects (Draw_Interpretor& ,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** )
|
||||||
{
|
{
|
||||||
if (n!=1) {
|
if (n!=1) {
|
||||||
printf(" Use bclearobjects\n");
|
printf(" use bclearobjects\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
|
BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
|
||||||
@ -143,10 +154,12 @@ Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer n, const ch
|
|||||||
//function : baddtools
|
//function : baddtools
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer n, const char** a)
|
Standard_Integer baddtools (Draw_Interpretor& ,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
printf(" Use baddtools s1 s2 ...\n");
|
printf(" use baddtools s1 s2 ...\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -165,10 +178,12 @@ Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer n, const char**
|
|||||||
//function : bcleartools
|
//function : bcleartools
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer n, const char** )
|
Standard_Integer bcleartools (Draw_Interpretor& ,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** )
|
||||||
{
|
{
|
||||||
if (n!=1) {
|
if (n!=1) {
|
||||||
printf(" Use bcleartools\n");
|
printf(" use bcleartools\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BOPCol_ListOfShape& aLS=BOPTest_Objects::Tools();
|
BOPCol_ListOfShape& aLS=BOPTest_Objects::Tools();
|
||||||
@ -176,3 +191,19 @@ Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer n, const char
|
|||||||
//
|
//
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : bclear
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Integer bclear(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** )
|
||||||
|
{
|
||||||
|
if (n!=1) {
|
||||||
|
di << " use bclear\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
BOPTest_Objects::Clear();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer bfuzzyvalue (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
|
static Standard_Integer bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : OptionCommands
|
//function : OptionCommands
|
||||||
@ -36,11 +37,15 @@ void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
|
|||||||
if (done) return;
|
if (done) return;
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "Partition commands";
|
const char* g = "BOPTest commands";
|
||||||
// Commands
|
// Commands
|
||||||
theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
|
theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
|
||||||
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
|
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
|
||||||
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
|
theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value" , __FILE__, bfuzzyvalue, g);
|
||||||
|
theCommands.Add("bparallelmode",
|
||||||
|
"bparallelmode [1/0] : show / set parallel mode for boolean operations",
|
||||||
|
__FILE__, bparallelmode, g);
|
||||||
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : boptions
|
//function : boptions
|
||||||
@ -121,3 +126,30 @@ Standard_Integer brunparallel(Draw_Interpretor& di,
|
|||||||
//
|
//
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : bparallelmode
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Integer bparallelmode(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
|
{
|
||||||
|
Standard_Boolean bRunParallel;
|
||||||
|
//
|
||||||
|
if (n == 2) {
|
||||||
|
bRunParallel=(Standard_Boolean)Draw::Atoi(a[1]);
|
||||||
|
BOPTest_Objects::SetRunParallel(bRunParallel);
|
||||||
|
if (bRunParallel) {
|
||||||
|
di << "Parallel mode for boolean operations has been enabled";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
di << "Parallel mode for boolean operations has been disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bRunParallel=BOPTest_Objects::RunParallel();
|
||||||
|
di << "Parallel mode state for boolean operations: "
|
||||||
|
<< (bRunParallel? "enabled" : "disabled");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
static Standard_Integer bfillds (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer bfillds (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
static Standard_Integer bbuild (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer bbuild (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
static Standard_Integer bbop (Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer bbop (Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
static Standard_Integer bclear (Draw_Interpretor&, Standard_Integer, const char**);
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : PartitionCommands
|
//function : PartitionCommands
|
||||||
@ -52,28 +51,11 @@ void BOPTest::PartitionCommands(Draw_Interpretor& theCommands)
|
|||||||
if (done) return;
|
if (done) return;
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "Partition commands";
|
const char* g = "BOPTest commands";
|
||||||
// Commands
|
// Commands
|
||||||
theCommands.Add("bfillds", "use bfillds [-s -t] [tol]" , __FILE__, bfillds, g);
|
theCommands.Add("bfillds", "use bfillds [-t]" , __FILE__, bfillds, g);
|
||||||
theCommands.Add("bbuild" , "use bbuild r [-s -t]" , __FILE__, bbuild, g);
|
theCommands.Add("bbuild" , "use bbuild r [-t]" , __FILE__, bbuild, g);
|
||||||
theCommands.Add("bbop" , "use bbop r op [-s -t]" , __FILE__, bbop, g);
|
theCommands.Add("bbop" , "use bbop r op [-t]", __FILE__, bbop, g);
|
||||||
theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
|
|
||||||
}
|
|
||||||
//=======================================================================
|
|
||||||
//function : bclear
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
Standard_Integer bclear(Draw_Interpretor& di,
|
|
||||||
Standard_Integer n,
|
|
||||||
const char** )
|
|
||||||
{
|
|
||||||
if (n!=1) {
|
|
||||||
di << " use bclear\n";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
BOPTest_Objects::Clear();
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : bfillds
|
//function : bfillds
|
||||||
@ -83,8 +65,8 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
|||||||
Standard_Integer n,
|
Standard_Integer n,
|
||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n > 4) {
|
if (n > 2) {
|
||||||
di << " use bfillds [-s -t] [tol]\n";
|
di << " use bfillds [-t]\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -94,7 +76,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
|||||||
Standard_Real aTol;
|
Standard_Real aTol;
|
||||||
BOPCol_ListIteratorOfListOfShape aIt;
|
BOPCol_ListIteratorOfListOfShape aIt;
|
||||||
BOPCol_ListOfShape aLC;
|
BOPCol_ListOfShape aLC;
|
||||||
BOPTime_Chronometer aChrono;
|
BOPTest_Chronometer aChrono;
|
||||||
|
|
||||||
BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
|
BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
|
||||||
aNbS=aLS.Extent();
|
aNbS=aLS.Extent();
|
||||||
@ -109,15 +91,9 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
|||||||
aTol=BOPTest_Objects::FuzzyValue();
|
aTol=BOPTest_Objects::FuzzyValue();
|
||||||
//
|
//
|
||||||
for (i=1; i<n; ++i) {
|
for (i=1; i<n; ++i) {
|
||||||
if (!strcmp(a[i], "-s")) {
|
if (!strcmp(a[i], "-t")) {
|
||||||
bRunParallel=Standard_False;
|
|
||||||
}
|
|
||||||
else if (!strcmp(a[i], "-t")) {
|
|
||||||
bShowTime=Standard_True;
|
bShowTime=Standard_True;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
aTol = Draw::Atof(a[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
|
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
|
||||||
@ -131,7 +107,7 @@ Standard_Integer bfillds(Draw_Interpretor& di,
|
|||||||
aIt.Initialize(aLT);
|
aIt.Initialize(aLT);
|
||||||
for (; aIt.More(); aIt.Next()) {
|
for (; aIt.More(); aIt.Next()) {
|
||||||
const TopoDS_Shape& aS=aIt.Value();
|
const TopoDS_Shape& aS=aIt.Value();
|
||||||
aLC.Append(aS);
|
aLC.Append(aS);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
|
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
|
||||||
@ -171,7 +147,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
|
|||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << " use bbuild r [-s -t]\n";
|
di << " use bbuild r [-t]\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -185,7 +161,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
|
|||||||
Standard_Boolean bRunParallel, bShowTime;
|
Standard_Boolean bRunParallel, bShowTime;
|
||||||
Standard_Integer i, iErr;
|
Standard_Integer i, iErr;
|
||||||
|
|
||||||
BOPTime_Chronometer aChrono;
|
BOPTest_Chronometer aChrono;
|
||||||
BOPCol_ListIteratorOfListOfShape aIt;
|
BOPCol_ListIteratorOfListOfShape aIt;
|
||||||
//
|
//
|
||||||
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
|
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
|
||||||
@ -210,10 +186,7 @@ Standard_Integer bbuild(Draw_Interpretor& di,
|
|||||||
bShowTime=Standard_False;
|
bShowTime=Standard_False;
|
||||||
bRunParallel=BOPTest_Objects::RunParallel();
|
bRunParallel=BOPTest_Objects::RunParallel();
|
||||||
for (i=2; i<n; ++i) {
|
for (i=2; i<n; ++i) {
|
||||||
if (!strcmp(a[i], "-s")) {
|
if (!strcmp(a[i], "-t")) {
|
||||||
bRunParallel=Standard_False;
|
|
||||||
}
|
|
||||||
else if (!strcmp(a[i], "-t")) {
|
|
||||||
bShowTime=Standard_True;
|
bShowTime=Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,7 +231,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
|||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<3) {
|
if (n<3) {
|
||||||
di << " use bbop r op [-s -t]\n";
|
di << " use bbop r op [-t]\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -273,7 +246,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
|||||||
Standard_Integer iErr, iOp, i;
|
Standard_Integer iErr, iOp, i;
|
||||||
BOPAlgo_Operation aOp;
|
BOPAlgo_Operation aOp;
|
||||||
BOPCol_ListIteratorOfListOfShape aIt;
|
BOPCol_ListIteratorOfListOfShape aIt;
|
||||||
BOPTime_Chronometer aChrono;
|
BOPTest_Chronometer aChrono;
|
||||||
//
|
//
|
||||||
iOp=Draw::Atoi(a[2]);
|
iOp=Draw::Atoi(a[2]);
|
||||||
if (iOp<0 || iOp>4) {
|
if (iOp<0 || iOp>4) {
|
||||||
@ -285,10 +258,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
|
|||||||
bShowTime=Standard_False;
|
bShowTime=Standard_False;
|
||||||
bRunParallel=BOPTest_Objects::RunParallel();
|
bRunParallel=BOPTest_Objects::RunParallel();
|
||||||
for (i=3; i<n; ++i) {
|
for (i=3; i<n; ++i) {
|
||||||
if (!strcmp(a[i], "-s")) {
|
if (!strcmp(a[i], "-t")) {
|
||||||
bRunParallel=Standard_False;
|
|
||||||
}
|
|
||||||
else if (!strcmp(a[i], "-t")) {
|
|
||||||
bShowTime=Standard_True;
|
bShowTime=Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,7 @@
|
|||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
|
|
||||||
static
|
|
||||||
Standard_Integer breducetolerance (Draw_Interpretor&, Standard_Integer, const char** );
|
|
||||||
static
|
|
||||||
Standard_Integer btolx (Draw_Interpretor&, Standard_Integer, const char** );
|
|
||||||
static
|
|
||||||
Standard_Integer bopaddpcs (Draw_Interpretor&, Standard_Integer, const char** );
|
|
||||||
//
|
//
|
||||||
static
|
static
|
||||||
void ProcessVertex(const TopoDS_Vertex&,
|
void ProcessVertex(const TopoDS_Vertex&,
|
||||||
@ -76,9 +71,16 @@ static
|
|||||||
void ReduceFaceTolerance (const TopoDS_Shape&);
|
void ReduceFaceTolerance (const TopoDS_Shape&);
|
||||||
|
|
||||||
static
|
static
|
||||||
void ReduceEdgeTolerance (const TopoDS_Shape&, const Standard_Real);
|
void ReduceEdgeTolerance (const TopoDS_Shape&,
|
||||||
|
const Standard_Real);
|
||||||
|
|
||||||
|
static
|
||||||
|
void PreparePCurves(const TopoDS_Shape& ,
|
||||||
|
Draw_Interpretor& di);
|
||||||
|
//
|
||||||
|
static Standard_Integer breducetolerance (Draw_Interpretor&, Standard_Integer, const char** );
|
||||||
|
static Standard_Integer btolx (Draw_Interpretor&, Standard_Integer, const char** );
|
||||||
|
static Standard_Integer bopaddpcs (Draw_Interpretor&, Standard_Integer, const char** );
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : TolerCommands
|
//function : TolerCommands
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -91,28 +93,32 @@ static
|
|||||||
|
|
||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
// Chapter's name
|
// Chapter's name
|
||||||
const char* g = "CCR commands";
|
const char* g = "BOPTest commands";
|
||||||
//
|
//
|
||||||
theCommands.Add("breducetolerance" , "Use >breducetolerance Shape [maxTol=0.01]", __FILE__, breducetolerance, g);
|
theCommands.Add("breducetolerance" , "use breducetolerance Shape",
|
||||||
theCommands.Add("btolx" , "Use >btolx Shape [minTol=1.e-7]", __FILE__, btolx, g);
|
__FILE__, breducetolerance, g);
|
||||||
theCommands.Add("bopaddpcs" , "Use >bopaddpcs Shape" , __FILE__, bopaddpcs, g);
|
theCommands.Add("btolx" , "use btolx Shape [minTol=1.e-7]",
|
||||||
|
__FILE__, btolx, g);
|
||||||
|
theCommands.Add("bopaddpcs" , "Use >bopaddpcs Shape",
|
||||||
|
__FILE__, bopaddpcs, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : btolx
|
//function : btolx
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer btolx(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer btolx(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << " Use >btolx Shape [minTol=1.e-7]\n";
|
di << " use btolx Shape [minTol=1.e-7]\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Shape aS = DBRep::Get(a[1]);
|
TopoDS_Shape aS = DBRep::Get(a[1]);
|
||||||
|
|
||||||
if (aS.IsNull()) {
|
if (aS.IsNull()) {
|
||||||
di << " Null shape is not allowed \n";
|
di << " Null shape is not allowed\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -139,7 +145,8 @@ Standard_Integer btolx(Draw_Interpretor& di, Standard_Integer n, const char**
|
|||||||
//function : ReduceEdgeTolerance
|
//function : ReduceEdgeTolerance
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void ReduceEdgeTolerance (const TopoDS_Shape& aS, const Standard_Real aTolTreshold)
|
void ReduceEdgeTolerance (const TopoDS_Shape& aS,
|
||||||
|
const Standard_Real aTolTreshold)
|
||||||
{
|
{
|
||||||
Standard_Integer i, aNbE;
|
Standard_Integer i, aNbE;
|
||||||
TopTools_IndexedMapOfShape aEMap;
|
TopTools_IndexedMapOfShape aEMap;
|
||||||
@ -178,7 +185,7 @@ void ReduceFaceTolerance (const TopoDS_Shape& aS)
|
|||||||
const TopoDS_Edge& aE= TopoDS::Edge(aEMap(j));
|
const TopoDS_Edge& aE= TopoDS::Edge(aEMap(j));
|
||||||
aTolE =BRep_Tool::Tolerance(aE);
|
aTolE =BRep_Tool::Tolerance(aE);
|
||||||
if (aTolE<aTolx) {
|
if (aTolE<aTolx) {
|
||||||
aTolx=aTolE;
|
aTolx=aTolE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aTolE=(aTolx>aTolEMin) ? aTolx : aTolEMin;
|
aTolE=(aTolx>aTolEMin) ? aTolx : aTolEMin;
|
||||||
@ -248,25 +255,25 @@ void ProcessEdge(const TopoDS_Edge& aE, const Standard_Real aTolTreshold)
|
|||||||
else if (cr->IsCurveOnSurface()) {
|
else if (cr->IsCurveOnSurface()) {
|
||||||
const Handle(Geom2d_Curve)& aC2D = cr->PCurve();
|
const Handle(Geom2d_Curve)& aC2D = cr->PCurve();
|
||||||
if (aC2D.IsNull()) {
|
if (aC2D.IsNull()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Surface
|
// Surface
|
||||||
const Handle(Geom_Surface)& aS=cr->Surface();
|
const Handle(Geom_Surface)& aS=cr->Surface();
|
||||||
//
|
//
|
||||||
// 2D-point treatment
|
// 2D-point treatment
|
||||||
for (i=0; i<=aNb; ++i) {
|
for (i=0; i<=aNb; ++i) {
|
||||||
aT=aT1+i*dT;
|
aT=aT1+i*dT;
|
||||||
if (i==aNb) {
|
if (i==aNb) {
|
||||||
aT=aT2;
|
aT=aT2;
|
||||||
}
|
}
|
||||||
aPC3D=aC3D->Value(aT);
|
aPC3D=aC3D->Value(aT);
|
||||||
aPC2D=aC2D->Value(aT);
|
aPC2D=aC2D->Value(aT);
|
||||||
aS->D0(aPC2D.X(), aPC2D.Y(), aP3D);
|
aS->D0(aPC2D.X(), aPC2D.Y(), aP3D);
|
||||||
aP3D.Transform(L.Transformation());
|
aP3D.Transform(L.Transformation());
|
||||||
aD2=aPC3D.SquareDistance(aP3D);
|
aD2=aPC3D.SquareDistance(aP3D);
|
||||||
if (aD2 > aTolMax2) {
|
if (aD2 > aTolMax2) {
|
||||||
aTolMax2=aD2;
|
aTolMax2=aD2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //if (cr->IsCurveOnSurface())
|
} //if (cr->IsCurveOnSurface())
|
||||||
}//for (; itcr.More(); itcr.Next())
|
}//for (; itcr.More(); itcr.Next())
|
||||||
@ -292,8 +299,8 @@ void ProcessEdge(const TopoDS_Edge& aE, const Standard_Real aTolTreshold)
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void ProcessVertex(const TopoDS_Vertex& aV,
|
void ProcessVertex(const TopoDS_Vertex& aV,
|
||||||
const TopTools_ListOfShape& aLE,
|
const TopTools_ListOfShape& aLE,
|
||||||
const TopTools_ListOfShape& aLF)
|
const TopTools_ListOfShape& aLF)
|
||||||
{
|
{
|
||||||
Standard_Real aTol, aD2, aTolMax2, aTolE, aParam;
|
Standard_Real aTol, aD2, aTolMax2, aTolE, aParam;
|
||||||
gp_Pnt aPC3D;
|
gp_Pnt aPC3D;
|
||||||
@ -329,58 +336,58 @@ void ProcessVertex(const TopoDS_Vertex& aV,
|
|||||||
const TopoDS_Vertex& aVx=TopoDS::Vertex(aVExp.Current());
|
const TopoDS_Vertex& aVx=TopoDS::Vertex(aVExp.Current());
|
||||||
//
|
//
|
||||||
if (!aVx.IsSame(aV)) {
|
if (!aVx.IsSame(aV)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
anOrV=aVx.Orientation();
|
anOrV=aVx.Orientation();
|
||||||
if (!(anOrV==TopAbs_FORWARD || anOrV==TopAbs_REVERSED)) {
|
if (!(anOrV==TopAbs_FORWARD || anOrV==TopAbs_REVERSED)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
const BRep_ListOfCurveRepresentation& aLCR=TE->Curves();
|
const BRep_ListOfCurveRepresentation& aLCR=TE->Curves();
|
||||||
itcr.Initialize(aLCR);
|
itcr.Initialize(aLCR);
|
||||||
for (; itcr.More(); itcr.Next()) {
|
for (; itcr.More(); itcr.Next()) {
|
||||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||||
const TopLoc_Location& loc = cr->Location();
|
const TopLoc_Location& loc = cr->Location();
|
||||||
TopLoc_Location L = (Eloc * loc).Predivided(aV.Location());
|
TopLoc_Location L = (Eloc * loc).Predivided(aV.Location());
|
||||||
//
|
//
|
||||||
// 3D-Curve
|
// 3D-Curve
|
||||||
if (cr->IsCurve3D()) {
|
if (cr->IsCurve3D()) {
|
||||||
const Handle(Geom_Curve)& aC3D = cr->Curve3D();
|
const Handle(Geom_Curve)& aC3D = cr->Curve3D();
|
||||||
//
|
//
|
||||||
if (aC3D.IsNull()) {
|
if (aC3D.IsNull()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 3D-point treatment
|
// 3D-point treatment
|
||||||
aParam=BRep_Tool::Parameter(aVx, aE);
|
aParam=BRep_Tool::Parameter(aVx, aE);
|
||||||
aPC3D= aC3D->Value(aParam);
|
aPC3D= aC3D->Value(aParam);
|
||||||
aPC3D.Transform(L.Transformation());
|
aPC3D.Transform(L.Transformation());
|
||||||
aD2=aPV3D.SquareDistance(aPC3D);
|
aD2=aPV3D.SquareDistance(aPC3D);
|
||||||
if (aD2 > aTolMax2) {
|
if (aD2 > aTolMax2) {
|
||||||
aTolMax2=aD2;
|
aTolMax2=aD2;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
}//if (cr->IsCurve3D())
|
}//if (cr->IsCurve3D())
|
||||||
//
|
//
|
||||||
// 2D-Curve
|
// 2D-Curve
|
||||||
else if (cr->IsCurveOnSurface()) {
|
else if (cr->IsCurveOnSurface()) {
|
||||||
const Handle(Geom2d_Curve)& aC2D = cr->PCurve();
|
const Handle(Geom2d_Curve)& aC2D = cr->PCurve();
|
||||||
if (aC2D.IsNull()) {
|
if (aC2D.IsNull()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Surface
|
// Surface
|
||||||
const Handle(Geom_Surface)& aS=cr->Surface();
|
const Handle(Geom_Surface)& aS=cr->Surface();
|
||||||
//
|
//
|
||||||
// 2D-point treatment
|
// 2D-point treatment
|
||||||
aParam=BRep_Tool::Parameter(aVx, aE, aS, L);
|
aParam=BRep_Tool::Parameter(aVx, aE, aS, L);
|
||||||
aPC2D=aC2D->Value(aParam);
|
aPC2D=aC2D->Value(aParam);
|
||||||
aS->D0(aPC2D.X(), aPC2D.Y(), aPC3D);
|
aS->D0(aPC2D.X(), aPC2D.Y(), aPC3D);
|
||||||
aPC3D.Transform(L.Transformation());
|
aPC3D.Transform(L.Transformation());
|
||||||
aD2=aPV3D.SquareDistance(aPC3D);
|
aD2=aPV3D.SquareDistance(aPC3D);
|
||||||
if (aD2 > aTolMax2) {
|
if (aD2 > aTolMax2) {
|
||||||
aTolMax2=aD2;
|
aTolMax2=aD2;
|
||||||
}
|
}
|
||||||
} //if (cr->IsCurveOnSurface())
|
} //if (cr->IsCurveOnSurface())
|
||||||
|
|
||||||
}//for (; itcr.More(); itcr.Next())
|
}//for (; itcr.More(); itcr.Next())
|
||||||
}//for (; aVExp.More(); aVExp.Next())
|
}//for (; aVExp.More(); aVExp.Next())
|
||||||
@ -441,11 +448,11 @@ void ProcessVertex(const TopoDS_Vertex& aV,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer breducetolerance(Draw_Interpretor& di,
|
Standard_Integer breducetolerance(Draw_Interpretor& di,
|
||||||
Standard_Integer n,
|
Standard_Integer n,
|
||||||
const char** a)
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << " Use >bupdatetolerance Shape\n";
|
di << " use bupdatetolerance Shape\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,18 +468,17 @@ Standard_Integer breducetolerance(Draw_Interpretor& di,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//
|
|
||||||
static
|
|
||||||
void PreparePCurves(const TopoDS_Shape& aShape, Draw_Interpretor& di);
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : bopaddpcs
|
//function : bopaddpcs
|
||||||
//purpose : Some Edgesdo not contain P-Curveson Faces to which they belong to.
|
//purpose : Some Edges do not contain P-Curves on Faces to which
|
||||||
|
// they belong to.
|
||||||
// These faces usually based on Geom_Plane surface.
|
// These faces usually based on Geom_Plane surface.
|
||||||
// To prevent sophisticated treatment the Command "bopaddpcs:
|
// To prevent sophisticated treatment the Command "bopaddpcs:
|
||||||
// adds P-Curves for the edges .
|
// adds P-Curves for the edges .
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_Integer bopaddpcs(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
Standard_Integer bopaddpcs(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n,
|
||||||
|
const char** a)
|
||||||
{
|
{
|
||||||
if (n<2) {
|
if (n<2) {
|
||||||
di << " Use >bopaddpcs Shape\n";
|
di << " Use >bopaddpcs Shape\n";
|
||||||
@ -491,7 +497,6 @@ Standard_Integer bopaddpcs(Draw_Interpretor& di, Standard_Integer n, const cha
|
|||||||
DBRep::Set (a[1], aS);
|
DBRep::Set (a[1], aS);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : PreparePCurves
|
//function : PreparePCurves
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -534,26 +539,26 @@ void PreparePCurves(const TopoDS_Shape& aShape, Draw_Interpretor& di)
|
|||||||
BRep_ListIteratorOfListOfCurveRepresentation itcr;
|
BRep_ListIteratorOfListOfCurveRepresentation itcr;
|
||||||
itcr.Initialize(aLCR);
|
itcr.Initialize(aLCR);
|
||||||
for (; itcr.More(); itcr.Next()) {
|
for (; itcr.More(); itcr.Next()) {
|
||||||
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
|
||||||
//
|
//
|
||||||
if (cr->IsCurveOnSurface()) {
|
if (cr->IsCurveOnSurface()) {
|
||||||
const Handle(Geom_Surface)& aSCR=cr->Surface();
|
const Handle(Geom_Surface)& aSCR=cr->Surface();
|
||||||
aSCRMap.Add(aSCR);
|
aSCRMap.Add(aSCR);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF, aLoc);
|
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF, aLoc);
|
||||||
if (!aSCRMap.Contains(aS)) {
|
if (!aSCRMap.Contains(aS)) {
|
||||||
// try to obtain 2D curve
|
// try to obtain 2D curve
|
||||||
aC2D=BRep_Tool::CurveOnSurface(aE, aS, aLoc, aT1, aT2);
|
aC2D=BRep_Tool::CurveOnSurface(aE, aS, aLoc, aT1, aT2);
|
||||||
if (aC2D.IsNull()) {
|
if (aC2D.IsNull()) {
|
||||||
di << " Warning: Can not obtain P-Curve\n";
|
di << " Warning: Can not obtain P-Curve\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aBB.UpdateEdge(aE, aC2D, aF, aTolE);
|
aBB.UpdateEdge(aE, aC2D, aF, aTolE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@ puts ""
|
|||||||
box b1 10 10 10
|
box b1 10 10 10
|
||||||
box b2 10.00001 0 0 10 10 10
|
box b2 10.00001 0 0 10 10 10
|
||||||
|
|
||||||
bop b1 b2 0.00002
|
bfuzzyvalue 0.00002
|
||||||
|
bop b1 b2
|
||||||
bopfuse result
|
bopfuse result
|
||||||
|
|
||||||
set nb_v_good 12
|
set nb_v_good 12
|
||||||
|
@ -15,6 +15,7 @@ bclearobjects
|
|||||||
bcleartools
|
bcleartools
|
||||||
baddobjects b1
|
baddobjects b1
|
||||||
baddtools b2
|
baddtools b2
|
||||||
bfillds 5.e-5
|
bfuzzyvalue 5.e-5
|
||||||
|
bfillds
|
||||||
bbop res 2
|
bbop res 2
|
||||||
checkshape res
|
checkshape res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user