namespace
{
- static BOPAlgo_MakeConnected TheMakeConnectedTool;
+ static BOPAlgo_MakeConnected& getMakeConnectedTool()
+ {
+ static BOPAlgo_MakeConnected TheMakeConnectedTool;
+ return TheMakeConnectedTool;
+ }
}
//=======================================================================
return 1;
}
- TheMakeConnectedTool.Clear();
+ getMakeConnectedTool().Clear();
for (Standard_Integer i = 2; i < theArgc; ++i)
{
theDI << "Error: " << theArgv[i] << " is a null shape. Skip it.\n";
continue;
}
- TheMakeConnectedTool.AddArgument(aS);
+ getMakeConnectedTool().AddArgument(aS);
}
- TheMakeConnectedTool.SetRunParallel(BOPTest_Objects::RunParallel());
+ getMakeConnectedTool().SetRunParallel(BOPTest_Objects::RunParallel());
- TheMakeConnectedTool.Perform();
+ getMakeConnectedTool().Perform();
// Print Error/Warning messages
- BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
+ BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
// Set the history of the operation in session
- BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
+ BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
- if (TheMakeConnectedTool.HasErrors())
+ if (getMakeConnectedTool().HasErrors())
return 0;
// Draw the result shape
- const TopoDS_Shape& aResult = TheMakeConnectedTool.Shape();
+ const TopoDS_Shape& aResult = getMakeConnectedTool().Shape();
DBRep::Set(theArgv[1], aResult);
return 0;
return 1;
}
- if (TheMakeConnectedTool.Shape().IsNull() || TheMakeConnectedTool.HasErrors())
+ if (getMakeConnectedTool().Shape().IsNull() || getMakeConnectedTool().HasErrors())
{
theDI << "Make the shapes connected first.\n";
return 1;
}
}
- TheMakeConnectedTool.MakePeriodic(aParams);
+ getMakeConnectedTool().MakePeriodic(aParams);
// Print Error/Warning messages
- BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
+ BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
// Set the history of the operation in session
- BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
+ BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
- if (TheMakeConnectedTool.HasErrors())
+ if (getMakeConnectedTool().HasErrors())
return 0;
// Draw the result shape
- const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
+ const TopoDS_Shape& aResult = getMakeConnectedTool().PeriodicShape();
DBRep::Set(theArgv[1], aResult);
return 0;
return 1;
}
- if (TheMakeConnectedTool.PeriodicityTool().HasErrors())
+ if (getMakeConnectedTool().PeriodicityTool().HasErrors())
{
theDI << "The shapes have not been made periodic yet.\n";
return 1;
return 1;
}
- TheMakeConnectedTool.RepeatShape(aDirID, aTimes);
+ getMakeConnectedTool().RepeatShape(aDirID, aTimes);
}
// Print Error/Warning messages
- BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
+ BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
// Set the history of the operation in session
- BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
+ BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
- if (TheMakeConnectedTool.HasErrors())
+ if (getMakeConnectedTool().HasErrors())
return 0;
// Draw the result shape
- const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
+ const TopoDS_Shape& aResult = getMakeConnectedTool().PeriodicShape();
DBRep::Set(theArgv[1], aResult);
return 0;
}
const TopTools_ListOfShape& aLS = bPositive ?
- TheMakeConnectedTool.MaterialsOnPositiveSide(aShape) :
- TheMakeConnectedTool.MaterialsOnNegativeSide(aShape);
+ getMakeConnectedTool().MaterialsOnPositiveSide(aShape) :
+ getMakeConnectedTool().MaterialsOnNegativeSide(aShape);
TopoDS_Shape aResult;
if (aLS.IsEmpty())
return 1;
}
- const TopTools_ListOfShape& aTwins = TheMakeConnectedTool.PeriodicityTool().GetTwins(aShape);
+ const TopTools_ListOfShape& aTwins = getMakeConnectedTool().PeriodicityTool().GetTwins(aShape);
TopoDS_Shape aCTwins;
if (aTwins.IsEmpty())
const char **theArgv)
{
// Clear all previous repetitions
- TheMakeConnectedTool.ClearRepetitions();
+ getMakeConnectedTool().ClearRepetitions();
// Set the history of the operation in session
- BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
+ BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
if (theArgc > 1)
- DBRep::Set(theArgv[1], TheMakeConnectedTool.PeriodicShape());
+ {
+ DBRep::Set(theArgv[1], getMakeConnectedTool().PeriodicShape());
+ }
return 0;
}
Standard_IMPORT Draw_Viewer dout;
#endif
-static BRepFeat_MakeCylindricalHole theHole;
+static BRepFeat_MakeCylindricalHole& getHole()
+{
+ static BRepFeat_MakeCylindricalHole theHole;
+ return theHole;
+}
static Standard_Boolean WithControl = Standard_True;
Standard_Boolean DownCastingEnforcing = Standard_False;
-static BRepFeat_MakePrism thePrism;
-static BRepFeat_MakeDPrism theDPrism;
-static BRepFeat_MakeRevol theRevol;
-static BRepFeat_MakePipe thePipe;
-static BRepFeat_MakeLinearForm theLF;
-static BRepFeat_MakeRevolutionForm theRF;
+static BRepFeat_MakePrism& getPrism()
+{
+ static BRepFeat_MakePrism thePrism;
+ return thePrism;
+}
+static BRepFeat_MakeDPrism& getDPrism()
+{
+ static BRepFeat_MakeDPrism theDPrism;
+ return theDPrism;
+}
+static BRepFeat_MakeRevol& getRevol()
+{
+ static BRepFeat_MakeRevol theRevol;
+ return theRevol;
+}
+static BRepFeat_MakePipe& getPipe()
+{
+ static BRepFeat_MakePipe thePipe;
+ return thePipe;
+}
+static BRepFeat_MakeLinearForm& getLienarForm()
+{
+ static BRepFeat_MakeLinearForm theLF;
+ return theLF;
+}
+static BRepFeat_MakeRevolutionForm& getRevolutionForm()
+{
+ static BRepFeat_MakeRevolutionForm theRF;
+ return theRF;
+}
//Input shapes for Prism, DPrism, Revol, Pipe
static TopoDS_Shape theSbase, thePbase;
Standard_Real Radius = Draw::Atof(a[9]);
- theHole.Init(S, gp_Ax1(Or, Di));
+ getHole().Init(S, gp_Ax1(Or, Di));
if (narg <= 10) {
- theHole.Perform(Radius);
+ getHole().Perform(Radius);
}
else {
Standard_Real pfrom = Draw::Atof(a[10]);
Standard_Real pto = Draw::Atof(a[11]);
- theHole.Perform(Radius, pfrom, pto, WithControl);
+ getHole().Perform(Radius, pfrom, pto, WithControl);
}
- theHole.Build();
- if (!theHole.HasErrors()) {
+ getHole().Build();
+ if (!getHole().HasErrors())
+ {
// dout.Clear();
- DBRep::Set(a[1], theHole.Shape());
+ DBRep::Set(a[1], getHole().Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
- Print(theCommands, theHole.Status());
+ Print(theCommands, getHole().Status());
return 1;
}
Standard_Real Radius = Draw::Atof(a[9]);
- theHole.Init(S, gp_Ax1(Or, Di));
- theHole.PerformThruNext(Radius, WithControl);
+ getHole().Init(S, gp_Ax1(Or, Di));
+ getHole().PerformThruNext(Radius, WithControl);
- theHole.Build();
- if (!theHole.HasErrors()) {
+ getHole().Build();
+ if (!getHole().HasErrors())
+ {
// dout.Clear();
- DBRep::Set(a[1], theHole.Shape());
+ DBRep::Set(a[1], getHole().Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
- Print(theCommands, theHole.Status());
+ Print(theCommands, getHole().Status());
return 1;
}
Standard_Real Radius = Draw::Atof(a[9]);
- theHole.Init(S, gp_Ax1(Or, Di));
- theHole.PerformUntilEnd(Radius, WithControl);
- theHole.Build();
- if (!theHole.HasErrors()) {
+ getHole().Init(S, gp_Ax1(Or, Di));
+ getHole().PerformUntilEnd(Radius, WithControl);
+ getHole().Build();
+ if (!getHole().HasErrors()) {
// dout.Clear();
- DBRep::Set(a[1], theHole.Shape());
+ DBRep::Set(a[1], getHole().Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
- Print(theCommands, theHole.Status());
+ Print(theCommands, getHole().Status());
return 1;
}
Standard_Real Radius = Draw::Atof(a[9]);
Standard_Real Length = Draw::Atof(a[10]);
- theHole.Init(S, gp_Ax1(Or, Di));
- theHole.PerformBlind(Radius, Length, WithControl);
- theHole.Build();
- if (!theHole.HasErrors()) {
+ getHole().Init(S, gp_Ax1(Or, Di));
+ getHole().PerformBlind(Radius, Length, WithControl);
+ getHole().Build();
+ if (!getHole().HasErrors())
+ {
// dout.Clear();
- DBRep::Set(a[1], theHole.Shape());
+ DBRep::Set(a[1], getHole().Shape());
dout.Flush();
return 0;
}
theCommands << "Echec de MakeCylindricalHole";
- Print(theCommands, theHole.Status());
+ Print(theCommands, getHole().Status());
return 1;
}
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
- thePrism.Init(Sbase, Pbase, Skface, gp_Dir(X, Y, Z), Fuse, Modify);
+ getPrism().Init(Sbase, Pbase, Skface, gp_Dir(X, Y, Z), Fuse, Modify);
}
else if (narg == 14) {
rfdef = Standard_True;
Standard_Real H1 = Draw::Atof(a[10]);
Standard_Real H2 = Draw::Atof(a[11]);
gp_Ax1 ax1(Or, gp_Dir(X, Y, Z));
- theRF.Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify);
- if (!theRF.IsDone()) {
- se = theRF.CurrentStatusError();
+ getRevolutionForm().Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify);
+ if (!getRevolutionForm().IsDone())
+ {
+ se = getRevolutionForm().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
- theRevol.Init(Sbase, Pbase, Skface, gp_Ax1(Or, gp_Dir(X, Y, Z)),
+ getRevol().Init(Sbase, Pbase, Skface, gp_Ax1(Or, gp_Dir(X, Y, Z)),
Fuse, Modify);
}
else {
X = Draw::Atof(a[7]);
Y = Draw::Atof(a[8]);
Z = Draw::Atof(a[9]);
- theLF.Init(Sbase, W, P, Direct, gp_Vec(X, Y, Z), Fuse, Modify);
- if (!theLF.IsDone()) {
- se = theLF.CurrentStatusError();
+ getLienarForm().Init(Sbase, W, P, Direct, gp_Vec(X, Y, Z), Fuse, Modify);
+ if (!getLienarForm().IsDone())
+ {
+ se = getLienarForm().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
- theDPrism.Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
+ getDPrism().Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
}
else { // FEATPIPE
TopoDS_Shape aLocalShape(DBRep::Get(a[4], TopAbs_WIRE));
theSbase = Sbase;
thePbase = Pbase;
theSkface = Skface;
- thePipe.Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
+ getPipe().Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
}
}
return 0;
if (fac.IsNull()) {
return 1;
}
- thePrism.Add(edg, fac);
+ getPrism().Add(edg, fac);
}
}
else if (!strcasecmp("REVOL", a[1])) {
if (fac.IsNull()) {
return 1;
}
- theRevol.Add(edg, fac);
+ getRevol().Add(edg, fac);
}
}
else if (!strcasecmp("PIPE", a[1])) {
if (fac.IsNull()) {
return 1;
}
- thePipe.Add(edg, fac);
+ getPipe().Add(edg, fac);
}
}
else {
if (narg == 4) {
Standard_Real Val = Draw::Atof(a[3]);
if (Kas == 1) {
- thePrism.Perform(Val);
+ getPrism().Perform(Val);
}
else if (Kas == 2) {
Val *= (M_PI / 180.);
- theRevol.Perform(Val);
+ getRevol().Perform(Val);
}
else if (Kas == 4) {
- theDPrism.Perform(Val);
+ getDPrism().Perform(Val);
}
else if (Kas == 5) {
theCommands << "invalid command for lf";
Standard_Real Val = Draw::Atof(a[3]);
TopoDS_Shape FUntil = DBRep::Get(a[4], TopAbs_SHAPE);
if (Kas == 1) {
- thePrism.PerformUntilHeight(FUntil, Val);
+ getPrism().PerformUntilHeight(FUntil, Val);
}
else if (Kas == 2) {
Val *= (M_PI / 180.);
- theRevol.PerformUntilAngle(FUntil, Val);
+ getRevol().PerformUntilAngle(FUntil, Val);
}
else if (Kas == 4) {
- theDPrism.PerformUntilHeight(FUntil, Val);
+ getDPrism().PerformUntilHeight(FUntil, Val);
}
else {
theCommands << "invalid command for ribs or slots";
if (narg == 3) { // Thru all
switch (Kas) {
case 1:
- thePrism.PerformThruAll();
+ getPrism().PerformThruAll();
break;
case 2:
- theRevol.PerformThruAll();
+ getRevol().PerformThruAll();
break;
case 3:
- thePipe.Perform();
+ getPipe().Perform();
break;
case 4:
- theDPrism.PerformThruAll();
+ getDPrism().PerformThruAll();
break;
case 5:
- theLF.Perform();
+ getLienarForm().Perform();
break;
case 6:
- theRF.Perform();
+ getRevolutionForm().Perform();
break;
default:
case 1:
{
if (Funtil.IsNull()) {
- thePrism.PerformUntilEnd();
+ getPrism().PerformUntilEnd();
}
else {
- thePrism.Perform(Funtil);
+ getPrism().Perform(Funtil);
}
}
break;
case 2:
{
if (!Funtil.IsNull()) {
- theRevol.Perform(Funtil);
+ getRevol().Perform(Funtil);
}
else {
return 1;
break;
case 3:
{
- if (!Funtil.IsNull()) {
- thePipe.Perform(Funtil);
+ if (!Funtil.IsNull())
+ {
+ getPipe().Perform(Funtil);
}
else {
theCommands << "invalid command for ribs pipe";
case 4:
{
if (!Funtil.IsNull()) {
- theDPrism.Perform(Funtil);
+ getDPrism().Perform(Funtil);
}
else {
- theDPrism.PerformUntilEnd();
+ getDPrism().PerformUntilEnd();
}
}
break;
switch (Kas) {
case 1:
{
- if (Ffrom.IsNull()) {
- thePrism.PerformFromEnd(Funtil);
+ if (Ffrom.IsNull())
+ {
+ getPrism().PerformFromEnd(Funtil);
}
- else {
- thePrism.Perform(Ffrom, Funtil);
+ else
+ {
+ getPrism().Perform(Ffrom, Funtil);
}
}
break;
if (Ffrom.IsNull()) {
return 1;
}
- theRevol.Perform(Ffrom, Funtil);
+ getRevol().Perform(Ffrom, Funtil);
}
break;
case 3:
if (Ffrom.IsNull()) {
return 1;
}
- thePipe.Perform(Ffrom, Funtil);
+ getPipe().Perform(Ffrom, Funtil);
}
break;
case 4:
{
if (Ffrom.IsNull()) {
- theDPrism.PerformFromEnd(Funtil);
+ getDPrism().PerformFromEnd(Funtil);
}
else {
- theDPrism.Perform(Ffrom, Funtil);
+ getDPrism().Perform(Ffrom, Funtil);
}
}
break;
BRepFeat_StatusError se;
switch (Kas) {
case 1:
- if (!thePrism.IsDone()) {
- se = thePrism.CurrentStatusError();
+ if (!getPrism().IsDone())
+ {
+ se = getPrism().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theCommands << aSStream << "\n";
return 1;
}
- DBRep::Set(a[2], thePrism);
+ DBRep::Set(a[2], getPrism());
dout.Flush();
//History
if (BRepTest_Objects::IsHistoryNeeded())
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
- BRepTest_Objects::SetHistory(anArgs, thePrism);
+ BRepTest_Objects::SetHistory(anArgs, getPrism());
}
return 0;
case 2:
- if (!theRevol.IsDone()) {
- se = theRevol.CurrentStatusError();
+ if (!getRevol().IsDone())
+ {
+ se = getRevol().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
- BRepTest_Objects::SetHistory(anArgs, theRevol);
+ BRepTest_Objects::SetHistory(anArgs, getRevol());
}
- DBRep::Set(a[2], theRevol);
+ DBRep::Set(a[2], getRevol());
dout.Flush();
return 0;
case 3:
- if (!thePipe.IsDone()) {
- se = thePipe.CurrentStatusError();
+ if (!getPipe().IsDone())
+ {
+ se = getPipe().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
- BRepTest_Objects::SetHistory(anArgs, thePipe);
+ BRepTest_Objects::SetHistory(anArgs, getPipe());
}
- DBRep::Set(a[2], thePipe);
+ DBRep::Set(a[2], getPipe());
dout.Flush();
return 0;
case 4:
- if (!theDPrism.IsDone()) {
- se = theDPrism.CurrentStatusError();
+ if (!getDPrism().IsDone())
+ {
+ se = getDPrism().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
anArgs.Append(theSbase);
anArgs.Append(thePbase);
anArgs.Append(theSkface);
- BRepTest_Objects::SetHistory(anArgs, theDPrism);
+ BRepTest_Objects::SetHistory(anArgs, getDPrism());
}
- DBRep::Set(a[2], theDPrism);
+ DBRep::Set(a[2], getDPrism());
dout.Flush();
return 0;
case 5:
- if (!theLF.IsDone()) {
- se = theLF.CurrentStatusError();
+ if (!getLienarForm().IsDone())
+ {
+ se = getLienarForm().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theCommands << aSStream << "\n";
return 1;
}
- DBRep::Set(a[2], theLF);
+ DBRep::Set(a[2], getLienarForm());
dout.Flush();
return 0;
case 6:
- if (!theRF.IsDone()) {
- se = theRF.CurrentStatusError();
+ if (!getRevolutionForm().IsDone())
+ {
+ se = getRevolutionForm().CurrentStatusError();
//BRepFeat::Print(se,std::cout) << std::endl;
Standard_SStream aSStream;
BRepFeat::Print(se, aSStream);
theCommands << aSStream << "\n";
return 1;
}
- DBRep::Set(a[2], theRF);
+ DBRep::Set(a[2], getRevolutionForm());
dout.Flush();
return 0;
default:
return 1;
}
- theDPrism.BossEdges(dprsig);
+ getDPrism().BossEdges(dprsig);
TopTools_ListOfShape theTopEdges, theLatEdges;
- theTopEdges = theDPrism.TopEdges();
- theLatEdges = theDPrism.LatEdges();
+ theTopEdges = getDPrism().TopEdges();
+ theLatEdges = getDPrism().LatEdges();
TopTools_ListIteratorOfListOfShape it;
BRep_Builder B;
V = DBRep::Get(a[2], TopAbs_SHAPE);
}
else if (Kas == 3) {
- V = theDPrism;
+ V = getDPrism();
}
if (V.IsNull()) return 1;