if (done) return;
done = Standard_True;
// Chapter's name
- const char* g = "Partition commands";
+ const char* g = "BOPTest commands";
// Commands
theCommands.Add("bapibuild", "use bapibuild r" , __FILE__, bapibuild, g);
theCommands.Add("bapibop", "use bapibop r type" , __FILE__, bapibop, g);
BRepAlgoAPI_BuilderAlgo aBuilder;
//
BOPCol_ListOfShape& aLSB=BOPTest_Objects::Shapes();
+ BOPCol_ListOfShape& aLTB=BOPTest_Objects::Tools();
//
- TopTools_ListOfShape aLS, aLT;
+ TopTools_ListOfShape aLS;
ConvertList(aLSB, aLS);
+ ConvertList(aLTB, aLS);
//
bRunParallel=BOPTest_Objects::RunParallel();
aFuzzyValue=BOPTest_Objects::FuzzyValue();
{
BOPCol_ListIteratorOfListOfShape aItB;
//
- aLS.Clear();
aItB.Initialize(aLSB);
for (; aItB.More(); aItB.Next()) {
const TopoDS_Shape& aS=aItB.Value();
Standard_Integer n,
const char** a,
const BOPAlgo_Operation aOp);
+//
static
Standard_Integer bsmt (Draw_Interpretor& di,
Standard_Integer n,
//
static Standard_Integer bopcurves (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**);
//=======================================================================
if (done) return;
done = Standard_True;
// Chapter's name
- const char* g = "BOP commands";
+ const char* g = "BOPTest 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("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 [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]",
+ 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]",
__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 ... [-c] [-ni] [-s] [tol]",
+ theCommands.Add("bopnews" , "use bopnews -v[e,f]" , __FILE__, bopnews, g);
+ theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-c] [-ni]",
__FILE__, mkvolume , g);
}
//function : bop
//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];
Standard_Boolean bRunParallel;
TopoDS_Shape aS1, aS2;
BOPCol_ListOfShape aLC;
//
- if (n < 3 || n > 4) {
- di << " use bop Shape1 Shape2 [tol]\n";
+ if (n != 3) {
+ di << " use bop s1 s2 \n";
return 0;
}
//
}
//
aTol=BOPTest_Objects::FuzzyValue();
- if (n == 4) {
- aTol = Draw::Atof(a[3]);
- }
- //
bRunParallel=BOPTest_Objects::RunParallel();
//
aLC.Append(aS1);
//function : bopcommon
//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);
}
//function : bopfuse
//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);
}
//function : bopcut
//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);
}
//function : boptuc
//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);
}
const BOPAlgo_Operation aOp)
{
if (n<2) {
- di << " use bopsmt r\n [tol]";
+ di << " use bopsmt r\n";
return 0;
}
//
//function : bopsection
//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) {
- di << " use bopsmt r\n";
+ di << " use bopsection r\n";
return 0;
}
//
//function : bcommon
//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);
}
//function : bfuse
//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);
}
//function : bcut
//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);
}
//function : btuc
//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);
}
Standard_Integer n,
const char** a)
{
- const char* usage = " Usage: bsection Result s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
if (n < 4) {
- di << usage;
+ di << "use bsection r s1 s2 [-n2d/-n2d1/-n2d2] [-na] [tol]\n";
return 0;
}
//
- TopoDS_Shape aS1 = DBRep::Get(a[2]);
- TopoDS_Shape aS2 = DBRep::Get(a[3]);
+ TopoDS_Shape aS1, aS2;
//
+ aS1=DBRep::Get(a[2]);
+ aS2=DBRep::Get(a[3]);
if (aS1.IsNull() || aS2.IsNull()) {
di << " Null shapes are not allowed \n";
return 0;
else if (!strcmp(a[i], "-na")) {
bApp = Standard_False;
}
- else {
- aTol = Draw::Atof(a[i]);
- }
}
//
BRepAlgoAPI_Section aSec(aS1, aS2, Standard_False);
aSec.Approximation(bApp);
aSec.ComputePCurveOn1(bPC1);
aSec.ComputePCurveOn2(bPC2);
+ //
aSec.SetFuzzyValue(aTol);
aSec.SetRunParallel(bRunParallel);
//
BOPCol_ListOfShape aLC;
Standard_Real aTol;
//
- if (n < 4 || n > 5) {
- di << " use bx r s1 s2 [tol]\n";
+ if (n != 4) {
+ di << " use bx r s1 s2\n";
return 0;
}
//
aLC.Append(aS2);
//
aTol=BOPTest_Objects::FuzzyValue();
- if (n == 5) {
- aTol = Draw::Atof(a[4]);
- }
- //
bRunParallel = BOPTest_Objects::RunParallel();
//
Handle(NCollection_BaseAllocator)aAL=new NCollection_IncAllocator;
Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** a)
{
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 << " -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;
}
//
BOPCol_ListOfShape aLS;
//
aTol = BOPTest_Objects::FuzzyValue();
- bToIntersect = Standard_True;
bRunParallel = BOPTest_Objects::RunParallel();
+ //
+ bToIntersect = Standard_True;
bCompounds = Standard_False;
//
for (i = 2; i < n; ++i) {
else if (!strcmp(a[i], "-ni")) {
bToIntersect = Standard_False;
}
- else if (!strcmp(a[i], "-s")) {
- bRunParallel = Standard_False;
- }
- else {
- aTol = Draw::Atof(a[i]);
- }
}
}
//
//
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;
-}
#include <BOPTools_AlgoTools.hxx>
#include <BOPTest_Chronometer.hxx>
+#include <BOPTest_Objects.hxx>
+
//
static
void MakeShapeForFullOutput (const TCollection_AsciiString&,
done = Standard_True;
// Chapter's name
- const char* g = "CCR commands";
+ const char* g = "BOPTest commands";
//
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);
theCommands.Add("bopargcheck" ,
- "Use bopargcheck without parameters to get ",
+ "use bopargcheck without parameters to get ",
__FILE__, bopargcheck, g);
theCommands.Add ("xdistef" ,
- "Use xdistef edge face",
+ "use xdistef edge face",
__FILE__, xdistef, g);
theCommands.Add("checkcurveonsurf",
- "checkcurveonsurf shape",
+ "use checkcurveonsurf shape",
__FILE__, checkcurveonsurf, g);
}
//=======================================================================
const char** a )
{
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 << " which interferences will be checked:\n";
di << " 0 - V/V only\n";
//
Standard_Boolean bRunParallel, bShowTime;
Standard_Integer i, aLevel, aNbInterfTypes;
- Standard_Real aTolerance;
+ Standard_Real aTol;
//
aNbInterfTypes=BOPDS_DS::NbInterfTypes();
//
return 1;
}
//
- aTolerance = 0;
bShowTime=Standard_False;
- bRunParallel=Standard_True;
+ aTol=BOPTest_Objects::FuzzyValue();
+ bRunParallel=BOPTest_Objects::RunParallel();
+ //
for (i=2; i<n; ++i) {
- if (!strcmp(a[i], "-s")) {
- bRunParallel=Standard_False;
- }
- else if (!strcmp(a[i], "-t")) {
+ 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;
BOPAlgo_CheckerSI aChecker;
BOPCol_ListOfShape aLS;
BOPDS_MapIteratorMapOfPassKey aItMPK;
- BOPTime_Chronometer aChrono;
+ BOPTest_Chronometer aChrono;
//
if (aLevel < (aNbInterfTypes-1)) {
di << "Info:\nThe level of check is set to "
aChecker.SetArguments(aLS);
aChecker.SetLevelOfCheck(aLevel);
aChecker.SetRunParallel(bRunParallel);
- aChecker.SetFuzzyValue(aTolerance);
+ aChecker.SetFuzzyValue(aTol);
//
aChrono.Start();
//
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] [-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 << " F (fuse)" << "\n";
di << " O (common)" << "\n";
Standard_Integer indxS2 = 0;
Standard_Real aTolerance = 0;
+ aTolerance=BOPTest_Objects::FuzzyValue();
+
if(n >= 3) {
Standard_Integer iIndex = 0;
for(iIndex = 2; iIndex < n; iIndex++) {
- if(!strcmp(a[iIndex], "-tol"))
- {
- if ((iIndex+1) < n) {
- ++iIndex;
- aTolerance = Draw::Atof(a[iIndex]);
- }
- }
- else if(a[iIndex][0] == '-')
- {
+ if(a[iIndex][0] == '-') {
isBO = Standard_True;
indxBO = iIndex;
}
- //else if(a[iIndex][0] == '+')
- else if(a[iIndex][0] == '/')
- {
+ else if(a[iIndex][0] == '/') {
isOP = Standard_True;
indxOP = iIndex;
}
- else if(a[iIndex][0] == '#')
- {
+ else if(a[iIndex][0] == '#') {
isAD = Standard_True;
indxAD = iIndex;
}
Standard_Integer n,
const char** a)
{
- if(n < 3) {
- di << "Use efmaxdist edge face\n";
+ if(n < 3) {
+ di << "use xdistef edge face\n";
return 1;
}
//
#ifndef 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>
//=======================================================================
-//class : BOPTime_Chronometer
+//class : BOPTest_Chronometer
//purpose :
//=======================================================================
-class BOPTime_Chronometer {
+class BOPTest_Chronometer {
public:
- BOPTime_Chronometer() {
+ BOPTest_Chronometer() {
}
//
- ~BOPTime_Chronometer() {
+ ~BOPTest_Chronometer() {
}
//
void Start() {
OSD_Chronometer myChronometer;
double myTime;
};
-#endif
-//
+
#endif
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-class DrawableShape from BOPTest inherits DrawableShape from DBRep
+class DrawableShape from BOPTest
+ inherits DrawableShape from DBRep
---Purpose:
Pnt from gp
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;
- 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;
- Text : CString from Standard;
- TextColor : Color from Draw
- )
- returns DrawableShape from BOPTest;
-
- Pnt(me) returns Pnt from gp is private;
+ Text : CString from Standard;
+ TextColor : Color from Draw)
+ returns DrawableShape from BOPTest;
+
+ Pnt(me)
+ returns Pnt from gp
+ is private;
DrawOn(me; dis : in out Display from Draw)
- is redefined;
+ is redefined;
fields
-
myText : Text3D from Draw;
myTextColor : Color from Draw;
//function :
//purpose :
//=======================================================================
-BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
- const Draw_Color& FreeCol,
- const Draw_Color& ConnCol,
- const Draw_Color& EdgeCol,
- const Draw_Color& IsosCol,
- const Standard_Real size,
- const Standard_Integer nbisos,
- const Standard_Integer discret,
- const Standard_CString Text,
- const Draw_Color& TextColor)
+BOPTest_DrawableShape::BOPTest_DrawableShape
+ (const TopoDS_Shape& aShape,
+ const Draw_Color& FreeCol,
+ const Draw_Color& ConnCol,
+ const Draw_Color& EdgeCol,
+ const Draw_Color& IsosCol,
+ const Standard_Real size,
+ const Standard_Integer nbisos,
+ const Standard_Integer discret,
+ 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);
myTextColor = TextColor;
}
-
//=======================================================================
//function :
//purpose :
//=======================================================================
- BOPTest_DrawableShape::BOPTest_DrawableShape (const TopoDS_Shape& aShape,
- const Standard_CString Text,
- const Draw_Color& TextColor)
-: DBRep_DrawableShape(
- aShape,
- Draw_vert,
- Draw_jaune,
- Draw_rouge,
- Draw_bleu,
- 100., //size
- 2, //nbIsos
- 30 //discret
- )
+BOPTest_DrawableShape::BOPTest_DrawableShape
+ (const TopoDS_Shape& aShape,
+ const Standard_CString Text,
+ const Draw_Color& TextColor)
+: DBRep_DrawableShape(aShape,
+ Draw_vert,
+ Draw_jaune,
+ Draw_rouge,
+ Draw_bleu,
+ 100., //size
+ 2, //nbIsos
+ 30) //discret
{
myText = new Draw_Text3D(Pnt(),Text,TextColor);
myTextColor = TextColor;
//function : Pnt
//purpose :
//=======================================================================
- gp_Pnt BOPTest_DrawableShape::Pnt() const
+gp_Pnt BOPTest_DrawableShape::Pnt() const
{
gp_Pnt P(0,0,0);
Standard_Real u, v, u1, u2, v1, v2, p;
TopExp_Explorer ex;
-
+
TopoDS_Shape S = Shape();
TopAbs_ShapeEnum T = S.ShapeType();
Standard_Real facpar = 0.;
-
+
while ( T == TopAbs_COMPOUND ) {
TopoDS_Iterator ti(S);
if ( ti.More() ) {
}
// si S final = compound --> P = 0 0 0
- switch (T)
- {
- case TopAbs_VERTEX :
- P = BRep_Tool::Pnt(TopoDS::Vertex(S));
- break;
-
- case TopAbs_EDGE :
- {
- BRepAdaptor_Curve CU(TopoDS::Edge(S));
- u1 = CU.FirstParameter();
- u2 = CU.LastParameter();
- if (facpar == 0.) facpar = 0.20;
- p = u1 + (u2-u1)*facpar;
- P = CU.Value(p);
- }
- break;
-
- case TopAbs_WIRE :
- {
- TopTools_IndexedMapOfShape aME;
- TopExp::MapShapes(S, TopAbs_EDGE, aME);
- const TopoDS_Edge& anEdge=TopoDS::Edge(aME(1));
- BRepAdaptor_Curve CU(anEdge);
- u1 = CU.FirstParameter();
- u2 = CU.LastParameter();
- if (facpar == 0.) facpar = 0.40;
- p = u1 + (u2-u1)*facpar;
- P = CU.Value(p);
- }
- break;
-
- case TopAbs_FACE :
- {
- BRepAdaptor_Surface SU(TopoDS::Face(S));
- BRepTools::UVBounds(TopoDS::Face(S),u1,u2,v1,v2);
- //
- facpar = .2;
- u = u1 + (u2-u1)*facpar;
- v = v1 + (v2-v1)*facpar;
- P = SU.Value(u,v);
- }
- break;
-
- case TopAbs_SHELL :
- case TopAbs_SOLID :
- {
- TopTools_IndexedMapOfShape aMF;
- TopExp::MapShapes(S, TopAbs_FACE, aMF);
- const TopoDS_Face& aF=TopoDS::Face(aMF(1));
-
- BRepAdaptor_Surface SU(TopoDS::Face(aF));
- BRepTools::UVBounds(aF,u1,u2,v1,v2);
- facpar = .4;
- u = u1 + (u2-u1)*facpar;
- v = v1 + (v2-v1)*facpar;
- P = SU.Value(u,v);
- }
- break;
-
- default:
- break;
- }
+ switch (T) {
+ case TopAbs_VERTEX :
+ P = BRep_Tool::Pnt(TopoDS::Vertex(S));
+ break;
+
+ case TopAbs_EDGE : {
+ BRepAdaptor_Curve CU(TopoDS::Edge(S));
+ u1 = CU.FirstParameter();
+ u2 = CU.LastParameter();
+ if (facpar == 0.) facpar = 0.20;
+ p = u1 + (u2-u1)*facpar;
+ P = CU.Value(p);
+ }
+ break;
+
+ case TopAbs_WIRE : {
+ TopTools_IndexedMapOfShape aME;
+ TopExp::MapShapes(S, TopAbs_EDGE, aME);
+ const TopoDS_Edge& anEdge=TopoDS::Edge(aME(1));
+ BRepAdaptor_Curve CU(anEdge);
+ u1 = CU.FirstParameter();
+ u2 = CU.LastParameter();
+ if (facpar == 0.) facpar = 0.40;
+ p = u1 + (u2-u1)*facpar;
+ P = CU.Value(p);
+ }
+ break;
+
+ case TopAbs_FACE : {
+ BRepAdaptor_Surface SU(TopoDS::Face(S));
+ BRepTools::UVBounds(TopoDS::Face(S),u1,u2,v1,v2);
+ //
+ facpar = .2;
+ u = u1 + (u2-u1)*facpar;
+ v = v1 + (v2-v1)*facpar;
+ P = SU.Value(u,v);
+ }
+ break;
+
+ case TopAbs_SHELL :
+ case TopAbs_SOLID : {
+ TopTools_IndexedMapOfShape aMF;
+ TopExp::MapShapes(S, TopAbs_FACE, aMF);
+ const TopoDS_Face& aF=TopoDS::Face(aMF(1));
+
+ BRepAdaptor_Surface SU(TopoDS::Face(aF));
+ BRepTools::UVBounds(aF,u1,u2,v1,v2);
+ facpar = .4;
+ u = u1 + (u2-u1)*facpar;
+ v = v1 + (v2-v1)*facpar;
+ P = SU.Value(u,v);
+ }
+ break;
+
+ default:
+ break;
+ }
return P;
}
-
-
//=======================================================================
//function : DrawOn
//purpose :
//=======================================================================
- void BOPTest_DrawableShape::DrawOn(Draw_Display& dis) const
+void BOPTest_DrawableShape::DrawOn(Draw_Display& dis) const
{
DBRep_DrawableShape::DrawOn(dis);
myText->SetPnt(Pnt());
if (done) return;
done = Standard_True;
// Chapter's name
- const char* g = "CCR commands";
- theCommands.Add("bclassify" , "Use >bclassify Solid Point [Tolerance=1.e-7]",
+ const char* g = "BOPTest commands";
+ theCommands.Add("bclassify" , "use bclassify Solid Point [Tolerance=1.e-7]",
__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);
- theCommands.Add("bhaspc" , "Use >bhaspc Edge Face [do]",
+ theCommands.Add("bhaspc" , "use bhaspc Edge Face [do]",
__FILE__, bhaspc , g);
}
Standard_Integer theArgNb,
const char** theArgVec)
{
- if (theArgNb < 3)
- {
- theDI << " Use >bclassify Solid Point [Tolerance=1.e-7]\n";
+ if (theArgNb < 3) {
+ theDI << " use bclassify Solid Point [Tolerance=1.e-7]\n";
return 1;
}
TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
- if (aS.IsNull())
- {
- theDI << " Null Shape is not allowed here\n";
+ if (aS.IsNull()) {
+ theDI << " Null Shape is not allowed\n";
return 1;
}
- else if (aS.ShapeType() != TopAbs_SOLID)
- {
+ else if (aS.ShapeType() != TopAbs_SOLID) {
theDI << " Shape type must be SOLID\n";
return 1;
}
gp_Pnt aP (8., 9., 10.);
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);
aSC.Perform (aP,aTol);
Standard_Integer theArgNb,
const char** theArgVec)
{
- if (theArgNb < 3)
- {
- theDI << " Use >bclassify Face Point2d [Tol2D=Tol(Face)]\n";
+ if (theArgNb < 3) {
+ theDI << " use bclassify Face Point2d [Tol2D=Tol(Face)]\n";
return 1;
}
TopoDS_Shape aS = DBRep::Get (theArgVec[1]);
- if (aS.IsNull())
- {
+ if (aS.IsNull()) {
theDI << " Null Shape is not allowed here\n";
return 1;
}
- else if (aS.ShapeType() != TopAbs_FACE)
- {
+ else if (aS.ShapeType() != TopAbs_FACE) {
theDI << " Shape type must be FACE\n";
return 1;
}
gp_Pnt2d aP (8., 9.);
DrawTrSurf::GetPoint2d (theArgVec[2], aP);
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;
aClassifier.Perform(aF, aP, aTol);
//function : bhaspc
//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) {
- di << " Use bhaspc> Edge Face [do]\n";
+ di << " use bhaspc Edge Face [do]\n";
return 1;
}
return 0;
}
-
//=======================================================================
//function : PrintState
//purpose :
void PrintState (Draw_Interpretor& theDI,
const TopAbs_State& theState)
{
- switch (theState)
- {
- case TopAbs_IN: theDI << "The point is IN shape\n"; return;
- case TopAbs_OUT: theDI << "The point is OUT of shape\n"; return;
- case TopAbs_ON: theDI << "The point is ON shape\n"; return;
- case TopAbs_UNKNOWN:
- default: theDI << "The point is UNKNOWN shape\n"; return;
+ switch (theState) {
+ case TopAbs_IN:
+ theDI << "The point is IN shape\n";
+ break;
+ case TopAbs_OUT:
+ theDI << "The point is OUT of shape\n";
+ 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
//purpose :
//
#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 baddtools (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 baddctools (Draw_Interpretor& , Standard_Integer , const char** );
+static Standard_Integer bclear (Draw_Interpretor&, Standard_Integer, const char**);
+
//
//=======================================================================
//function :ObjCommands
if (done) return;
done = Standard_True;
// Chapter's name
- const char* g = "BOP commands";
+ const char* g = "BOPTest commands";
// Commands
- theCommands.Add("baddobjects" , "baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
- theCommands.Add("bclearobjects" , "bclearobjects" , __FILE__, bclearobjects, g);
- theCommands.Add("baddtools" , "baddtools s1 s2 ..." , __FILE__, baddtools, g);
- theCommands.Add("bcleartools" , "bcleartools" , __FILE__, bcleartools, g);
- theCommands.Add("baddcompound" , "baddcompound c" , __FILE__, baddcompound, g);
- theCommands.Add("baddctools" , "baddctools c" , __FILE__, baddctools, g);
+ theCommands.Add("baddobjects" , "use baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
+ theCommands.Add("bclearobjects" , "use bclearobjects" , __FILE__, bclearobjects, g);
+ theCommands.Add("baddtools" , "use baddtools s1 s2 ..." , __FILE__, baddtools, g);
+ theCommands.Add("bcleartools" , "use bcleartools" , __FILE__, bcleartools, g);
+ theCommands.Add("baddcompound" , "use baddcompound c" , __FILE__, baddcompound, g);
+ theCommands.Add("baddctools" , "use baddctools c" , __FILE__, baddctools, g);
+ theCommands.Add("bclear" , "use bclear" , __FILE__, bclear, g);
}
//=======================================================================
//function : baddcompound
//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) {
- printf(" Use baddcompound c\n");
+ printf(" use baddcompound c\n");
return 0;
}
//
//function : baddctools
//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) {
- printf(" Use baddctools c\n");
+ printf(" use baddctools c\n");
return 0;
}
//
//function :baddobjects
//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) {
- printf(" Use baddobjects s1 s2 ...\n");
+ printf(" use baddobjects s1 s2 ...\n");
return 0;
}
//
//function : bclearobjects
//purpose :
//=======================================================================
-Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer n, const char** )
+Standard_Integer bclearobjects (Draw_Interpretor& ,
+ Standard_Integer n,
+ const char** )
{
if (n!=1) {
- printf(" Use bclearobjects\n");
+ printf(" use bclearobjects\n");
return 0;
}
BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
//function : baddtools
//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) {
- printf(" Use baddtools s1 s2 ...\n");
+ printf(" use baddtools s1 s2 ...\n");
return 0;
}
//
//function : bcleartools
//purpose :
//=======================================================================
-Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer n, const char** )
+Standard_Integer bcleartools (Draw_Interpretor& ,
+ Standard_Integer n,
+ const char** )
{
if (n!=1) {
- printf(" Use bcleartools\n");
+ printf(" use bcleartools\n");
return 0;
}
BOPCol_ListOfShape& aLS=BOPTest_Objects::Tools();
//
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;
+}
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
if (done) return;
done = Standard_True;
// Chapter's name
- const char* g = "Partition commands";
+ 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
//
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;
+}
static Standard_Integer bfillds (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 bclear (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : PartitionCommands
if (done) return;
done = Standard_True;
// Chapter's name
- const char* g = "Partition commands";
+ const char* g = "BOPTest commands";
// Commands
- 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);
-}
-//=======================================================================
-//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;
+ theCommands.Add("bfillds", "use bfillds [-t]" , __FILE__, bfillds, g);
+ theCommands.Add("bbuild" , "use bbuild r [-t]" , __FILE__, bbuild, g);
+ theCommands.Add("bbop" , "use bbop r op [-t]", __FILE__, bbop, g);
}
//=======================================================================
//function : bfillds
Standard_Integer n,
const char** a)
{
- if (n > 4) {
- di << " use bfillds [-s -t] [tol]\n";
+ if (n > 2) {
+ di << " use bfillds [-t]\n";
return 0;
}
//
Standard_Real aTol;
BOPCol_ListIteratorOfListOfShape aIt;
BOPCol_ListOfShape aLC;
- BOPTime_Chronometer aChrono;
+ BOPTest_Chronometer aChrono;
BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
aNbS=aLS.Extent();
aTol=BOPTest_Objects::FuzzyValue();
//
for (i=1; i<n; ++i) {
- if (!strcmp(a[i], "-s")) {
- bRunParallel=Standard_False;
- }
- else if (!strcmp(a[i], "-t")) {
+ if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
- else {
- aTol = Draw::Atof(a[i]);
- }
}
//
BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
aIt.Initialize(aLT);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
- aLC.Append(aS);
+ aLC.Append(aS);
}
//
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
const char** a)
{
if (n<2) {
- di << " use bbuild r [-s -t]\n";
+ di << " use bbuild r [-t]\n";
return 0;
}
//
Standard_Boolean bRunParallel, bShowTime;
Standard_Integer i, iErr;
- BOPTime_Chronometer aChrono;
+ BOPTest_Chronometer aChrono;
BOPCol_ListIteratorOfListOfShape aIt;
//
BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
bShowTime=Standard_False;
bRunParallel=BOPTest_Objects::RunParallel();
for (i=2; i<n; ++i) {
- if (!strcmp(a[i], "-s")) {
- bRunParallel=Standard_False;
- }
- else if (!strcmp(a[i], "-t")) {
+ if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
}
const char** a)
{
if (n<3) {
- di << " use bbop r op [-s -t]\n";
+ di << " use bbop r op [-t]\n";
return 0;
}
//
Standard_Integer iErr, iOp, i;
BOPAlgo_Operation aOp;
BOPCol_ListIteratorOfListOfShape aIt;
- BOPTime_Chronometer aChrono;
+ BOPTest_Chronometer aChrono;
//
iOp=Draw::Atoi(a[2]);
if (iOp<0 || iOp>4) {
bShowTime=Standard_False;
bRunParallel=BOPTest_Objects::RunParallel();
for (i=3; i<n; ++i) {
- if (!strcmp(a[i], "-s")) {
- bRunParallel=Standard_False;
- }
- else if (!strcmp(a[i], "-t")) {
+ if (!strcmp(a[i], "-t")) {
bShowTime=Standard_True;
}
}
#include <TopExp.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
void ProcessVertex(const TopoDS_Vertex&,
void ReduceFaceTolerance (const TopoDS_Shape&);
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
//purpose :
done = Standard_True;
// Chapter's name
- const char* g = "CCR commands";
- //
- theCommands.Add("breducetolerance" , "Use >breducetolerance Shape [maxTol=0.01]", __FILE__, breducetolerance, g);
- theCommands.Add("btolx" , "Use >btolx Shape [minTol=1.e-7]", __FILE__, btolx, g);
- theCommands.Add("bopaddpcs" , "Use >bopaddpcs Shape" , __FILE__, bopaddpcs, g);
+ const char* g = "BOPTest commands";
+ //
+ theCommands.Add("breducetolerance" , "use breducetolerance Shape",
+ __FILE__, breducetolerance, 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
//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) {
- di << " Use >btolx Shape [minTol=1.e-7]\n";
+ di << " use btolx Shape [minTol=1.e-7]\n";
return 1;
}
TopoDS_Shape aS = DBRep::Get(a[1]);
if (aS.IsNull()) {
- di << " Null shape is not allowed \n";
+ di << " Null shape is not allowed\n";
return 1;
}
//
//function : ReduceEdgeTolerance
//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;
TopTools_IndexedMapOfShape aEMap;
const TopoDS_Edge& aE= TopoDS::Edge(aEMap(j));
aTolE =BRep_Tool::Tolerance(aE);
if (aTolE<aTolx) {
- aTolx=aTolE;
+ aTolx=aTolE;
}
}
aTolE=(aTolx>aTolEMin) ? aTolx : aTolEMin;
{
Standard_Integer i, aNbV;
TopTools_IndexedDataMapOfShapeListOfShape aVEMap, aVFMap;
-
+
TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_EDGE, aVEMap);
TopExp::MapShapesAndAncestors(aS, TopAbs_VERTEX, TopAbs_FACE, aVFMap);
else if (cr->IsCurveOnSurface()) {
const Handle(Geom2d_Curve)& aC2D = cr->PCurve();
if (aC2D.IsNull()) {
- continue;
+ continue;
}
// Surface
const Handle(Geom_Surface)& aS=cr->Surface();
//
// 2D-point treatment
for (i=0; i<=aNb; ++i) {
- aT=aT1+i*dT;
- if (i==aNb) {
- aT=aT2;
- }
- aPC3D=aC3D->Value(aT);
- aPC2D=aC2D->Value(aT);
- aS->D0(aPC2D.X(), aPC2D.Y(), aP3D);
- aP3D.Transform(L.Transformation());
- aD2=aPC3D.SquareDistance(aP3D);
- if (aD2 > aTolMax2) {
- aTolMax2=aD2;
- }
+ aT=aT1+i*dT;
+ if (i==aNb) {
+ aT=aT2;
+ }
+ aPC3D=aC3D->Value(aT);
+ aPC2D=aC2D->Value(aT);
+ aS->D0(aPC2D.X(), aPC2D.Y(), aP3D);
+ aP3D.Transform(L.Transformation());
+ aD2=aPC3D.SquareDistance(aP3D);
+ if (aD2 > aTolMax2) {
+ aTolMax2=aD2;
+ }
}
} //if (cr->IsCurveOnSurface())
}//for (; itcr.More(); itcr.Next())
//purpose :
//=======================================================================
void ProcessVertex(const TopoDS_Vertex& aV,
- const TopTools_ListOfShape& aLE,
- const TopTools_ListOfShape& aLF)
+ const TopTools_ListOfShape& aLE,
+ const TopTools_ListOfShape& aLF)
{
Standard_Real aTol, aD2, aTolMax2, aTolE, aParam;
gp_Pnt aPC3D;
if (aProcessedEdges.Contains(aE)) {
continue;
}
- aProcessedEdges.Add(aE);
+ aProcessedEdges.Add(aE);
//
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&aE.TShape());
const TopLoc_Location& Eloc = aE.Location();
const TopoDS_Vertex& aVx=TopoDS::Vertex(aVExp.Current());
//
if (!aVx.IsSame(aV)) {
- continue;
+ continue;
}
//
anOrV=aVx.Orientation();
if (!(anOrV==TopAbs_FORWARD || anOrV==TopAbs_REVERSED)) {
- continue;
+ continue;
}
//
const BRep_ListOfCurveRepresentation& aLCR=TE->Curves();
itcr.Initialize(aLCR);
for (; itcr.More(); itcr.Next()) {
- const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
- const TopLoc_Location& loc = cr->Location();
- TopLoc_Location L = (Eloc * loc).Predivided(aV.Location());
- //
- // 3D-Curve
- if (cr->IsCurve3D()) {
- const Handle(Geom_Curve)& aC3D = cr->Curve3D();
- //
- if (aC3D.IsNull()) {
- continue;
- }
- // 3D-point treatment
- aParam=BRep_Tool::Parameter(aVx, aE);
- aPC3D= aC3D->Value(aParam);
- aPC3D.Transform(L.Transformation());
- aD2=aPV3D.SquareDistance(aPC3D);
- if (aD2 > aTolMax2) {
- aTolMax2=aD2;
- }
- //
- }//if (cr->IsCurve3D())
- //
- // 2D-Curve
- else if (cr->IsCurveOnSurface()) {
- const Handle(Geom2d_Curve)& aC2D = cr->PCurve();
- if (aC2D.IsNull()) {
- continue;
- }
- // Surface
- const Handle(Geom_Surface)& aS=cr->Surface();
- //
- // 2D-point treatment
- aParam=BRep_Tool::Parameter(aVx, aE, aS, L);
- aPC2D=aC2D->Value(aParam);
- aS->D0(aPC2D.X(), aPC2D.Y(), aPC3D);
- aPC3D.Transform(L.Transformation());
- aD2=aPV3D.SquareDistance(aPC3D);
- if (aD2 > aTolMax2) {
- aTolMax2=aD2;
- }
- } //if (cr->IsCurveOnSurface())
-
+ const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
+ const TopLoc_Location& loc = cr->Location();
+ TopLoc_Location L = (Eloc * loc).Predivided(aV.Location());
+ //
+ // 3D-Curve
+ if (cr->IsCurve3D()) {
+ const Handle(Geom_Curve)& aC3D = cr->Curve3D();
+ //
+ if (aC3D.IsNull()) {
+ continue;
+ }
+ // 3D-point treatment
+ aParam=BRep_Tool::Parameter(aVx, aE);
+ aPC3D= aC3D->Value(aParam);
+ aPC3D.Transform(L.Transformation());
+ aD2=aPV3D.SquareDistance(aPC3D);
+ if (aD2 > aTolMax2) {
+ aTolMax2=aD2;
+ }
+ //
+ }//if (cr->IsCurve3D())
+ //
+ // 2D-Curve
+ else if (cr->IsCurveOnSurface()) {
+ const Handle(Geom2d_Curve)& aC2D = cr->PCurve();
+ if (aC2D.IsNull()) {
+ continue;
+ }
+ // Surface
+ const Handle(Geom_Surface)& aS=cr->Surface();
+ //
+ // 2D-point treatment
+ aParam=BRep_Tool::Parameter(aVx, aE, aS, L);
+ aPC2D=aC2D->Value(aParam);
+ aS->D0(aPC2D.X(), aPC2D.Y(), aPC3D);
+ aPC3D.Transform(L.Transformation());
+ aD2=aPV3D.SquareDistance(aPC3D);
+ if (aD2 > aTolMax2) {
+ aTolMax2=aD2;
+ }
+ } //if (cr->IsCurveOnSurface())
+
}//for (; itcr.More(); itcr.Next())
}//for (; aVExp.More(); aVExp.Next())
}//for (; anIt.More(); anIt.Next())
//purpose :
//=======================================================================
Standard_Integer breducetolerance(Draw_Interpretor& di,
- Standard_Integer n,
- const char** a)
+ Standard_Integer n,
+ const char** a)
{
if (n<2) {
- di << " Use >bupdatetolerance Shape\n";
+ di << " use bupdatetolerance Shape\n";
return 1;
}
return 0;
}
//
-//
-static
- void PreparePCurves(const TopoDS_Shape& aShape, Draw_Interpretor& di);
-
//=======================================================================
//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.
// To prevent sophisticated treatment the Command "bopaddpcs:
// 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) {
di << " Use >bopaddpcs Shape\n";
DBRep::Set (a[1], aS);
return 0;
}
-
//=======================================================================
//function : PreparePCurves
//purpose :
BRep_ListIteratorOfListOfCurveRepresentation itcr;
itcr.Initialize(aLCR);
for (; itcr.More(); itcr.Next()) {
- const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
- //
- if (cr->IsCurveOnSurface()) {
- const Handle(Geom_Surface)& aSCR=cr->Surface();
- aSCRMap.Add(aSCR);
- }
- //
+ const Handle(BRep_CurveRepresentation)& cr = itcr.Value();
+ //
+ if (cr->IsCurveOnSurface()) {
+ const Handle(Geom_Surface)& aSCR=cr->Surface();
+ aSCRMap.Add(aSCR);
+ }
+ //
}
//
const Handle(Geom_Surface)& aS=BRep_Tool::Surface(aF, aLoc);
if (!aSCRMap.Contains(aS)) {
- // try to obtain 2D curve
- aC2D=BRep_Tool::CurveOnSurface(aE, aS, aLoc, aT1, aT2);
- if (aC2D.IsNull()) {
- di << " Warning: Can not obtain P-Curve\n";
- continue;
- }
- else {
- aBB.UpdateEdge(aE, aC2D, aF, aTolE);
- }
+ // try to obtain 2D curve
+ aC2D=BRep_Tool::CurveOnSurface(aE, aS, aLoc, aT1, aT2);
+ if (aC2D.IsNull()) {
+ di << " Warning: Can not obtain P-Curve\n";
+ continue;
+ }
+ else {
+ aBB.UpdateEdge(aE, aC2D, aF, aTolE);
+ }
}
}
}
box b1 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
set nb_v_good 12
bcleartools
baddobjects b1
baddtools b2
-bfillds 5.e-5
+bfuzzyvalue 5.e-5
+bfillds
bbop res 2
checkshape res