1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-05 11:24:17 +03:00
occt/src/BOPTest/BOPTest_OptionCommands.cxx
pkv 43cb001124 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
2015-01-15 15:15:47 +03:00

156 lines
4.8 KiB
C++

// Created by: Peter KURNEV
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPTest.ixx>
#include <stdio.h>
#include <string.h>
#include <DBRep.hxx>
#include <Draw.hxx>
#include <BOPTest_Objects.hxx>
static Standard_Integer boptions (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 bparallelmode(Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : OptionCommands
//purpose :
//=======================================================================
void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* g = "BOPTest commands";
// Commands
theCommands.Add("boptions", "use boptions" , __FILE__, boptions, g);
theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, 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
//purpose :
//=======================================================================
Standard_Integer boptions(Draw_Interpretor& di,
Standard_Integer n,
const char** )
{
if (n!=1) {
di << " use boptions\n";
return 0;
}
//
char buf[128];
Standard_Boolean bRunParallel;
Standard_Real aFuzzyValue;
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
Sprintf(buf, " RunParallel: %d\n", bRunParallel);
di << buf;
Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
di << buf;
//
return 0;
}
//=======================================================================
//function : bfuzzyvalue
//purpose :
//=======================================================================
Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use bfuzzyvalue value\n";
return 0;
}
//
Standard_Real aFuzzyValue;
//
aFuzzyValue=Draw::Atof(a[1]);
if (aFuzzyValue<0.) {
di << " Wrong value.\n";
return 0;
}
//
BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
//
return 0;
}
//=======================================================================
//function : brunparallel
//purpose :
//=======================================================================
Standard_Integer brunparallel(Draw_Interpretor& di,
Standard_Integer n,
const char** a)
{
if (n!=2) {
di << " use brunparallel [0/1]\n";
return 0;
}
//
Standard_Integer iX;
Standard_Boolean bRunParallel;
//
iX=Draw::Atoi(a[1]);
if (iX<0 || iX>1) {
di << " Wrong value.\n";
return 0;
}
//
bRunParallel=(Standard_Boolean)(iX);
BOPTest_Objects::SetRunParallel(bRunParallel);
//
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;
}