mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-01 10:26:12 +03:00
0032235: Foundation Classes, Message_MsgFile - force initialization of global mutex
Initialization of several global variables has been refactored to a function.
This commit is contained in:
parent
f7ad1e7e37
commit
ef188756a0
@ -40,8 +40,12 @@ static Standard_Integer GetTwins(Draw_Interpretor&, Standard_Integer, const char
|
|||||||
static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
{
|
||||||
|
static BOPAlgo_MakeConnected& getMakeConnectedTool()
|
||||||
{
|
{
|
||||||
static BOPAlgo_MakeConnected TheMakeConnectedTool;
|
static BOPAlgo_MakeConnected TheMakeConnectedTool;
|
||||||
|
return TheMakeConnectedTool;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -104,7 +108,7 @@ Standard_Integer MakeConnected(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TheMakeConnectedTool.Clear();
|
getMakeConnectedTool().Clear();
|
||||||
|
|
||||||
for (Standard_Integer i = 2; i < theArgc; ++i)
|
for (Standard_Integer i = 2; i < theArgc; ++i)
|
||||||
{
|
{
|
||||||
@ -114,24 +118,24 @@ Standard_Integer MakeConnected(Draw_Interpretor& theDI,
|
|||||||
theDI << "Error: " << theArgv[i] << " is a null shape. Skip it.\n";
|
theDI << "Error: " << theArgv[i] << " is a null shape. Skip it.\n";
|
||||||
continue;
|
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
|
// Print Error/Warning messages
|
||||||
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
|
BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
|
||||||
|
|
||||||
// Set the history of the operation in session
|
// 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;
|
return 0;
|
||||||
|
|
||||||
// Draw the result shape
|
// Draw the result shape
|
||||||
const TopoDS_Shape& aResult = TheMakeConnectedTool.Shape();
|
const TopoDS_Shape& aResult = getMakeConnectedTool().Shape();
|
||||||
DBRep::Set(theArgv[1], aResult);
|
DBRep::Set(theArgv[1], aResult);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -151,7 +155,7 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TheMakeConnectedTool.Shape().IsNull() || TheMakeConnectedTool.HasErrors())
|
if (getMakeConnectedTool().Shape().IsNull() || getMakeConnectedTool().HasErrors())
|
||||||
{
|
{
|
||||||
theDI << "Make the shapes connected first.\n";
|
theDI << "Make the shapes connected first.\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -210,19 +214,19 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TheMakeConnectedTool.MakePeriodic(aParams);
|
getMakeConnectedTool().MakePeriodic(aParams);
|
||||||
|
|
||||||
// Print Error/Warning messages
|
// Print Error/Warning messages
|
||||||
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
|
BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
|
||||||
|
|
||||||
// Set the history of the operation in session
|
// 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;
|
return 0;
|
||||||
|
|
||||||
// Draw the result shape
|
// Draw the result shape
|
||||||
const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
|
const TopoDS_Shape& aResult = getMakeConnectedTool().PeriodicShape();
|
||||||
DBRep::Set(theArgv[1], aResult);
|
DBRep::Set(theArgv[1], aResult);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -242,7 +246,7 @@ Standard_Integer RepeatShape(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TheMakeConnectedTool.PeriodicityTool().HasErrors())
|
if (getMakeConnectedTool().PeriodicityTool().HasErrors())
|
||||||
{
|
{
|
||||||
theDI << "The shapes have not been made periodic yet.\n";
|
theDI << "The shapes have not been made periodic yet.\n";
|
||||||
return 1;
|
return 1;
|
||||||
@ -276,20 +280,20 @@ Standard_Integer RepeatShape(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TheMakeConnectedTool.RepeatShape(aDirID, aTimes);
|
getMakeConnectedTool().RepeatShape(aDirID, aTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print Error/Warning messages
|
// Print Error/Warning messages
|
||||||
BOPTest::ReportAlerts(TheMakeConnectedTool.GetReport());
|
BOPTest::ReportAlerts(getMakeConnectedTool().GetReport());
|
||||||
|
|
||||||
// Set the history of the operation in session
|
// 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;
|
return 0;
|
||||||
|
|
||||||
// Draw the result shape
|
// Draw the result shape
|
||||||
const TopoDS_Shape& aResult = TheMakeConnectedTool.PeriodicShape();
|
const TopoDS_Shape& aResult = getMakeConnectedTool().PeriodicShape();
|
||||||
DBRep::Set(theArgv[1], aResult);
|
DBRep::Set(theArgv[1], aResult);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -331,8 +335,8 @@ Standard_Integer MaterialsOn(Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TopTools_ListOfShape& aLS = bPositive ?
|
const TopTools_ListOfShape& aLS = bPositive ?
|
||||||
TheMakeConnectedTool.MaterialsOnPositiveSide(aShape) :
|
getMakeConnectedTool().MaterialsOnPositiveSide(aShape) :
|
||||||
TheMakeConnectedTool.MaterialsOnNegativeSide(aShape);
|
getMakeConnectedTool().MaterialsOnNegativeSide(aShape);
|
||||||
|
|
||||||
TopoDS_Shape aResult;
|
TopoDS_Shape aResult;
|
||||||
if (aLS.IsEmpty())
|
if (aLS.IsEmpty())
|
||||||
@ -373,7 +377,7 @@ Standard_Integer GetTwins(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TopTools_ListOfShape& aTwins = TheMakeConnectedTool.PeriodicityTool().GetTwins(aShape);
|
const TopTools_ListOfShape& aTwins = getMakeConnectedTool().PeriodicityTool().GetTwins(aShape);
|
||||||
|
|
||||||
TopoDS_Shape aCTwins;
|
TopoDS_Shape aCTwins;
|
||||||
if (aTwins.IsEmpty())
|
if (aTwins.IsEmpty())
|
||||||
@ -401,13 +405,15 @@ Standard_Integer ClearRepetitions(Draw_Interpretor&,
|
|||||||
const char **theArgv)
|
const char **theArgv)
|
||||||
{
|
{
|
||||||
// Clear all previous repetitions
|
// Clear all previous repetitions
|
||||||
TheMakeConnectedTool.ClearRepetitions();
|
getMakeConnectedTool().ClearRepetitions();
|
||||||
|
|
||||||
// Set the history of the operation in session
|
// Set the history of the operation in session
|
||||||
BRepTest_Objects::SetHistory(TheMakeConnectedTool.History());
|
BRepTest_Objects::SetHistory(getMakeConnectedTool().History());
|
||||||
|
|
||||||
if (theArgc > 1)
|
if (theArgc > 1)
|
||||||
DBRep::Set(theArgv[1], TheMakeConnectedTool.PeriodicShape());
|
{
|
||||||
|
DBRep::Set(theArgv[1], getMakeConnectedTool().PeriodicShape());
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,12 @@ static Standard_Integer RepeatShape(Draw_Interpretor&, Standard_Integer, const c
|
|||||||
static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, const char**);
|
static Standard_Integer ClearRepetitions(Draw_Interpretor&, Standard_Integer, const char**);
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
{
|
||||||
|
static BOPAlgo_MakePeriodic& getPeriodicityMaker()
|
||||||
{
|
{
|
||||||
static BOPAlgo_MakePeriodic ThePeriodicityMaker;
|
static BOPAlgo_MakePeriodic ThePeriodicityMaker;
|
||||||
|
return ThePeriodicityMaker;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -99,8 +103,8 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThePeriodicityMaker.Clear();
|
getPeriodicityMaker().Clear();
|
||||||
ThePeriodicityMaker.SetShape(aShape);
|
getPeriodicityMaker().SetShape(aShape);
|
||||||
|
|
||||||
for (Standard_Integer i = 3; i < theArgc;)
|
for (Standard_Integer i = 3; i < theArgc;)
|
||||||
{
|
{
|
||||||
@ -131,7 +135,7 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
|
|||||||
|
|
||||||
Standard_Real aPeriod = Draw::Atof(theArgv[++i]);
|
Standard_Real aPeriod = Draw::Atof(theArgv[++i]);
|
||||||
|
|
||||||
ThePeriodicityMaker.MakePeriodic(aDirID, Standard_True, aPeriod);
|
getPeriodicityMaker().MakePeriodic(aDirID, Standard_True, aPeriod);
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
if (theArgc > i + 1)
|
if (theArgc > i + 1)
|
||||||
@ -146,28 +150,30 @@ Standard_Integer MakePeriodic(Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
Standard_Real aFirst = Draw::Atof(theArgv[++i]);
|
Standard_Real aFirst = Draw::Atof(theArgv[++i]);
|
||||||
|
|
||||||
ThePeriodicityMaker.SetTrimmed(aDirID, Standard_False, aFirst);
|
getPeriodicityMaker().SetTrimmed(aDirID, Standard_False, aFirst);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ThePeriodicityMaker.SetRunParallel(BOPTest_Objects::RunParallel());
|
getPeriodicityMaker().SetRunParallel(BOPTest_Objects::RunParallel());
|
||||||
|
|
||||||
// Perform operation
|
// Perform operation
|
||||||
ThePeriodicityMaker.Perform();
|
getPeriodicityMaker().Perform();
|
||||||
|
|
||||||
// Print Error/Warning messages
|
// Print Error/Warning messages
|
||||||
BOPTest::ReportAlerts(ThePeriodicityMaker.GetReport());
|
BOPTest::ReportAlerts(getPeriodicityMaker().GetReport());
|
||||||
|
|
||||||
// Set the history of the operation in session
|
// Set the history of the operation in session
|
||||||
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
|
BRepTest_Objects::SetHistory(getPeriodicityMaker().History());
|
||||||
|
|
||||||
if (ThePeriodicityMaker.HasErrors())
|
if (getPeriodicityMaker().HasErrors())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw the result shape
|
// Draw the result shape
|
||||||
const TopoDS_Shape& aResult = ThePeriodicityMaker.Shape();
|
const TopoDS_Shape& aResult = getPeriodicityMaker().Shape();
|
||||||
DBRep::Set(theArgv[1], aResult);
|
DBRep::Set(theArgv[1], aResult);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -195,7 +201,7 @@ Standard_Integer GetTwins(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TopTools_ListOfShape& aTwins = ThePeriodicityMaker.GetTwins(aShape);
|
const TopTools_ListOfShape& aTwins = getPeriodicityMaker().GetTwins(aShape);
|
||||||
|
|
||||||
TopoDS_Shape aCTwins;
|
TopoDS_Shape aCTwins;
|
||||||
if (aTwins.IsEmpty())
|
if (aTwins.IsEmpty())
|
||||||
@ -256,20 +262,22 @@ Standard_Integer RepeatShape(Draw_Interpretor& theDI,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThePeriodicityMaker.RepeatShape(aDirID, aTimes);
|
getPeriodicityMaker().RepeatShape(aDirID, aTimes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print Error/Warning messages
|
// Print Error/Warning messages
|
||||||
BOPTest::ReportAlerts(ThePeriodicityMaker.GetReport());
|
BOPTest::ReportAlerts(getPeriodicityMaker().GetReport());
|
||||||
|
|
||||||
// Set the history of the operation in session
|
// Set the history of the operation in session
|
||||||
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
|
BRepTest_Objects::SetHistory(getPeriodicityMaker().History());
|
||||||
|
|
||||||
if (ThePeriodicityMaker.HasErrors())
|
if (getPeriodicityMaker().HasErrors())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw the result shape
|
// Draw the result shape
|
||||||
const TopoDS_Shape& aResult = ThePeriodicityMaker.RepeatedShape();
|
const TopoDS_Shape& aResult = getPeriodicityMaker().RepeatedShape();
|
||||||
DBRep::Set(theArgv[1], aResult);
|
DBRep::Set(theArgv[1], aResult);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -284,13 +292,15 @@ Standard_Integer ClearRepetitions(Draw_Interpretor&,
|
|||||||
const char **theArgv)
|
const char **theArgv)
|
||||||
{
|
{
|
||||||
// Clear all previous repetitions
|
// Clear all previous repetitions
|
||||||
ThePeriodicityMaker.ClearRepetitions();
|
getPeriodicityMaker().ClearRepetitions();
|
||||||
|
|
||||||
// Set the history of the operation in session
|
// Set the history of the operation in session
|
||||||
BRepTest_Objects::SetHistory(ThePeriodicityMaker.History());
|
BRepTest_Objects::SetHistory(getPeriodicityMaker().History());
|
||||||
|
|
||||||
if (theArgc > 1)
|
if (theArgc > 1)
|
||||||
DBRep::Set(theArgv[1], ThePeriodicityMaker.Shape());
|
{
|
||||||
|
DBRep::Set(theArgv[1], getPeriodicityMaker().Shape());
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -74,17 +74,45 @@
|
|||||||
Standard_IMPORT Draw_Viewer dout;
|
Standard_IMPORT Draw_Viewer dout;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static BRepFeat_MakeCylindricalHole& getHole()
|
||||||
|
{
|
||||||
static BRepFeat_MakeCylindricalHole theHole;
|
static BRepFeat_MakeCylindricalHole theHole;
|
||||||
|
return theHole;
|
||||||
|
}
|
||||||
static Standard_Boolean WithControl = Standard_True;
|
static Standard_Boolean WithControl = Standard_True;
|
||||||
|
|
||||||
Standard_Boolean DownCastingEnforcing = Standard_False;
|
Standard_Boolean DownCastingEnforcing = Standard_False;
|
||||||
|
|
||||||
|
static BRepFeat_MakePrism& getPrism()
|
||||||
|
{
|
||||||
static BRepFeat_MakePrism thePrism;
|
static BRepFeat_MakePrism thePrism;
|
||||||
|
return thePrism;
|
||||||
|
}
|
||||||
|
static BRepFeat_MakeDPrism& getDPrism()
|
||||||
|
{
|
||||||
static BRepFeat_MakeDPrism theDPrism;
|
static BRepFeat_MakeDPrism theDPrism;
|
||||||
|
return theDPrism;
|
||||||
|
}
|
||||||
|
static BRepFeat_MakeRevol& getRevol()
|
||||||
|
{
|
||||||
static BRepFeat_MakeRevol theRevol;
|
static BRepFeat_MakeRevol theRevol;
|
||||||
|
return theRevol;
|
||||||
|
}
|
||||||
|
static BRepFeat_MakePipe& getPipe()
|
||||||
|
{
|
||||||
static BRepFeat_MakePipe thePipe;
|
static BRepFeat_MakePipe thePipe;
|
||||||
|
return thePipe;
|
||||||
|
}
|
||||||
|
static BRepFeat_MakeLinearForm& getLienarForm()
|
||||||
|
{
|
||||||
static BRepFeat_MakeLinearForm theLF;
|
static BRepFeat_MakeLinearForm theLF;
|
||||||
|
return theLF;
|
||||||
|
}
|
||||||
|
static BRepFeat_MakeRevolutionForm& getRevolutionForm()
|
||||||
|
{
|
||||||
static BRepFeat_MakeRevolutionForm theRF;
|
static BRepFeat_MakeRevolutionForm theRF;
|
||||||
|
return theRF;
|
||||||
|
}
|
||||||
|
|
||||||
//Input shapes for Prism, DPrism, Revol, Pipe
|
//Input shapes for Prism, DPrism, Revol, Pipe
|
||||||
static TopoDS_Shape theSbase, thePbase;
|
static TopoDS_Shape theSbase, thePbase;
|
||||||
@ -231,26 +259,27 @@ static Standard_Integer HOLE1(Draw_Interpretor& theCommands,
|
|||||||
|
|
||||||
Standard_Real Radius = Draw::Atof(a[9]);
|
Standard_Real Radius = Draw::Atof(a[9]);
|
||||||
|
|
||||||
theHole.Init(S, gp_Ax1(Or, Di));
|
getHole().Init(S, gp_Ax1(Or, Di));
|
||||||
|
|
||||||
if (narg <= 10) {
|
if (narg <= 10) {
|
||||||
theHole.Perform(Radius);
|
getHole().Perform(Radius);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Standard_Real pfrom = Draw::Atof(a[10]);
|
Standard_Real pfrom = Draw::Atof(a[10]);
|
||||||
Standard_Real pto = Draw::Atof(a[11]);
|
Standard_Real pto = Draw::Atof(a[11]);
|
||||||
theHole.Perform(Radius, pfrom, pto, WithControl);
|
getHole().Perform(Radius, pfrom, pto, WithControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
theHole.Build();
|
getHole().Build();
|
||||||
if (!theHole.HasErrors()) {
|
if (!getHole().HasErrors())
|
||||||
|
{
|
||||||
// dout.Clear();
|
// dout.Clear();
|
||||||
DBRep::Set(a[1], theHole.Shape());
|
DBRep::Set(a[1], getHole().Shape());
|
||||||
dout.Flush();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
theCommands << "Echec de MakeCylindricalHole";
|
theCommands << "Echec de MakeCylindricalHole";
|
||||||
Print(theCommands, theHole.Status());
|
Print(theCommands, getHole().Status());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,18 +294,19 @@ static Standard_Integer HOLE2(Draw_Interpretor& theCommands,
|
|||||||
|
|
||||||
Standard_Real Radius = Draw::Atof(a[9]);
|
Standard_Real Radius = Draw::Atof(a[9]);
|
||||||
|
|
||||||
theHole.Init(S, gp_Ax1(Or, Di));
|
getHole().Init(S, gp_Ax1(Or, Di));
|
||||||
theHole.PerformThruNext(Radius, WithControl);
|
getHole().PerformThruNext(Radius, WithControl);
|
||||||
|
|
||||||
theHole.Build();
|
getHole().Build();
|
||||||
if (!theHole.HasErrors()) {
|
if (!getHole().HasErrors())
|
||||||
|
{
|
||||||
// dout.Clear();
|
// dout.Clear();
|
||||||
DBRep::Set(a[1], theHole.Shape());
|
DBRep::Set(a[1], getHole().Shape());
|
||||||
dout.Flush();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
theCommands << "Echec de MakeCylindricalHole";
|
theCommands << "Echec de MakeCylindricalHole";
|
||||||
Print(theCommands, theHole.Status());
|
Print(theCommands, getHole().Status());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,17 +321,17 @@ static Standard_Integer HOLE3(Draw_Interpretor& theCommands,
|
|||||||
|
|
||||||
Standard_Real Radius = Draw::Atof(a[9]);
|
Standard_Real Radius = Draw::Atof(a[9]);
|
||||||
|
|
||||||
theHole.Init(S, gp_Ax1(Or, Di));
|
getHole().Init(S, gp_Ax1(Or, Di));
|
||||||
theHole.PerformUntilEnd(Radius, WithControl);
|
getHole().PerformUntilEnd(Radius, WithControl);
|
||||||
theHole.Build();
|
getHole().Build();
|
||||||
if (!theHole.HasErrors()) {
|
if (!getHole().HasErrors()) {
|
||||||
// dout.Clear();
|
// dout.Clear();
|
||||||
DBRep::Set(a[1], theHole.Shape());
|
DBRep::Set(a[1], getHole().Shape());
|
||||||
dout.Flush();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
theCommands << "Echec de MakeCylindricalHole";
|
theCommands << "Echec de MakeCylindricalHole";
|
||||||
Print(theCommands, theHole.Status());
|
Print(theCommands, getHole().Status());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,17 +348,18 @@ static Standard_Integer HOLE4(Draw_Interpretor& theCommands,
|
|||||||
Standard_Real Radius = Draw::Atof(a[9]);
|
Standard_Real Radius = Draw::Atof(a[9]);
|
||||||
Standard_Real Length = Draw::Atof(a[10]);
|
Standard_Real Length = Draw::Atof(a[10]);
|
||||||
|
|
||||||
theHole.Init(S, gp_Ax1(Or, Di));
|
getHole().Init(S, gp_Ax1(Or, Di));
|
||||||
theHole.PerformBlind(Radius, Length, WithControl);
|
getHole().PerformBlind(Radius, Length, WithControl);
|
||||||
theHole.Build();
|
getHole().Build();
|
||||||
if (!theHole.HasErrors()) {
|
if (!getHole().HasErrors())
|
||||||
|
{
|
||||||
// dout.Clear();
|
// dout.Clear();
|
||||||
DBRep::Set(a[1], theHole.Shape());
|
DBRep::Set(a[1], getHole().Shape());
|
||||||
dout.Flush();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
theCommands << "Echec de MakeCylindricalHole";
|
theCommands << "Echec de MakeCylindricalHole";
|
||||||
Print(theCommands, theHole.Status());
|
Print(theCommands, getHole().Status());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1630,7 +1661,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
|
|||||||
theSbase = Sbase;
|
theSbase = Sbase;
|
||||||
thePbase = Pbase;
|
thePbase = Pbase;
|
||||||
theSkface = Skface;
|
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) {
|
else if (narg == 14) {
|
||||||
rfdef = Standard_True;
|
rfdef = Standard_True;
|
||||||
@ -1641,9 +1672,10 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
|
|||||||
Standard_Real H1 = Draw::Atof(a[10]);
|
Standard_Real H1 = Draw::Atof(a[10]);
|
||||||
Standard_Real H2 = Draw::Atof(a[11]);
|
Standard_Real H2 = Draw::Atof(a[11]);
|
||||||
gp_Ax1 ax1(Or, gp_Dir(X, Y, Z));
|
gp_Ax1 ax1(Or, gp_Dir(X, Y, Z));
|
||||||
theRF.Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify);
|
getRevolutionForm().Init(Sbase, W, P, ax1, H1, H2, Fuse, Modify);
|
||||||
if (!theRF.IsDone()) {
|
if (!getRevolutionForm().IsDone())
|
||||||
se = theRF.CurrentStatusError();
|
{
|
||||||
|
se = getRevolutionForm().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
@ -1660,7 +1692,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
|
|||||||
theSbase = Sbase;
|
theSbase = Sbase;
|
||||||
thePbase = Pbase;
|
thePbase = Pbase;
|
||||||
theSkface = Skface;
|
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);
|
Fuse, Modify);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1669,9 +1701,10 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
|
|||||||
X = Draw::Atof(a[7]);
|
X = Draw::Atof(a[7]);
|
||||||
Y = Draw::Atof(a[8]);
|
Y = Draw::Atof(a[8]);
|
||||||
Z = Draw::Atof(a[9]);
|
Z = Draw::Atof(a[9]);
|
||||||
theLF.Init(Sbase, W, P, Direct, gp_Vec(X, Y, Z), Fuse, Modify);
|
getLienarForm().Init(Sbase, W, P, Direct, gp_Vec(X, Y, Z), Fuse, Modify);
|
||||||
if (!theLF.IsDone()) {
|
if (!getLienarForm().IsDone())
|
||||||
se = theLF.CurrentStatusError();
|
{
|
||||||
|
se = getLienarForm().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
@ -1691,7 +1724,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
|
|||||||
theSbase = Sbase;
|
theSbase = Sbase;
|
||||||
thePbase = Pbase;
|
thePbase = Pbase;
|
||||||
theSkface = Skface;
|
theSkface = Skface;
|
||||||
theDPrism.Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
|
getDPrism().Init(Sbase, TopoDS::Face(Pbase), Skface, Angle, Fuse, Modify);
|
||||||
}
|
}
|
||||||
else { // FEATPIPE
|
else { // FEATPIPE
|
||||||
TopoDS_Shape aLocalShape(DBRep::Get(a[4], TopAbs_WIRE));
|
TopoDS_Shape aLocalShape(DBRep::Get(a[4], TopAbs_WIRE));
|
||||||
@ -1711,7 +1744,7 @@ static Standard_Integer DEFIN(Draw_Interpretor& theCommands,
|
|||||||
theSbase = Sbase;
|
theSbase = Sbase;
|
||||||
thePbase = Pbase;
|
thePbase = Pbase;
|
||||||
theSkface = Skface;
|
theSkface = Skface;
|
||||||
thePipe.Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
|
getPipe().Init(Sbase, Pbase, Skface, Spine, Fuse, Modify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1743,7 +1776,7 @@ static Standard_Integer ADD(Draw_Interpretor&,
|
|||||||
if (fac.IsNull()) {
|
if (fac.IsNull()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
thePrism.Add(edg, fac);
|
getPrism().Add(edg, fac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcasecmp("REVOL", a[1])) {
|
else if (!strcasecmp("REVOL", a[1])) {
|
||||||
@ -1763,7 +1796,7 @@ static Standard_Integer ADD(Draw_Interpretor&,
|
|||||||
if (fac.IsNull()) {
|
if (fac.IsNull()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
theRevol.Add(edg, fac);
|
getRevol().Add(edg, fac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcasecmp("PIPE", a[1])) {
|
else if (!strcasecmp("PIPE", a[1])) {
|
||||||
@ -1783,7 +1816,7 @@ static Standard_Integer ADD(Draw_Interpretor&,
|
|||||||
if (fac.IsNull()) {
|
if (fac.IsNull()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
thePipe.Add(edg, fac);
|
getPipe().Add(edg, fac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1874,14 +1907,14 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
if (narg == 4) {
|
if (narg == 4) {
|
||||||
Standard_Real Val = Draw::Atof(a[3]);
|
Standard_Real Val = Draw::Atof(a[3]);
|
||||||
if (Kas == 1) {
|
if (Kas == 1) {
|
||||||
thePrism.Perform(Val);
|
getPrism().Perform(Val);
|
||||||
}
|
}
|
||||||
else if (Kas == 2) {
|
else if (Kas == 2) {
|
||||||
Val *= (M_PI / 180.);
|
Val *= (M_PI / 180.);
|
||||||
theRevol.Perform(Val);
|
getRevol().Perform(Val);
|
||||||
}
|
}
|
||||||
else if (Kas == 4) {
|
else if (Kas == 4) {
|
||||||
theDPrism.Perform(Val);
|
getDPrism().Perform(Val);
|
||||||
}
|
}
|
||||||
else if (Kas == 5) {
|
else if (Kas == 5) {
|
||||||
theCommands << "invalid command for lf";
|
theCommands << "invalid command for lf";
|
||||||
@ -1896,14 +1929,14 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
Standard_Real Val = Draw::Atof(a[3]);
|
Standard_Real Val = Draw::Atof(a[3]);
|
||||||
TopoDS_Shape FUntil = DBRep::Get(a[4], TopAbs_SHAPE);
|
TopoDS_Shape FUntil = DBRep::Get(a[4], TopAbs_SHAPE);
|
||||||
if (Kas == 1) {
|
if (Kas == 1) {
|
||||||
thePrism.PerformUntilHeight(FUntil, Val);
|
getPrism().PerformUntilHeight(FUntil, Val);
|
||||||
}
|
}
|
||||||
else if (Kas == 2) {
|
else if (Kas == 2) {
|
||||||
Val *= (M_PI / 180.);
|
Val *= (M_PI / 180.);
|
||||||
theRevol.PerformUntilAngle(FUntil, Val);
|
getRevol().PerformUntilAngle(FUntil, Val);
|
||||||
}
|
}
|
||||||
else if (Kas == 4) {
|
else if (Kas == 4) {
|
||||||
theDPrism.PerformUntilHeight(FUntil, Val);
|
getDPrism().PerformUntilHeight(FUntil, Val);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
theCommands << "invalid command for ribs or slots";
|
theCommands << "invalid command for ribs or slots";
|
||||||
@ -1915,22 +1948,22 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
if (narg == 3) { // Thru all
|
if (narg == 3) { // Thru all
|
||||||
switch (Kas) {
|
switch (Kas) {
|
||||||
case 1:
|
case 1:
|
||||||
thePrism.PerformThruAll();
|
getPrism().PerformThruAll();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
theRevol.PerformThruAll();
|
getRevol().PerformThruAll();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
thePipe.Perform();
|
getPipe().Perform();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
theDPrism.PerformThruAll();
|
getDPrism().PerformThruAll();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
theLF.Perform();
|
getLienarForm().Perform();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
theRF.Perform();
|
getRevolutionForm().Perform();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@ -1943,17 +1976,17 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (Funtil.IsNull()) {
|
if (Funtil.IsNull()) {
|
||||||
thePrism.PerformUntilEnd();
|
getPrism().PerformUntilEnd();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
thePrism.Perform(Funtil);
|
getPrism().Perform(Funtil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if (!Funtil.IsNull()) {
|
if (!Funtil.IsNull()) {
|
||||||
theRevol.Perform(Funtil);
|
getRevol().Perform(Funtil);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return 1;
|
return 1;
|
||||||
@ -1962,8 +1995,9 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
if (!Funtil.IsNull()) {
|
if (!Funtil.IsNull())
|
||||||
thePipe.Perform(Funtil);
|
{
|
||||||
|
getPipe().Perform(Funtil);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
theCommands << "invalid command for ribs pipe";
|
theCommands << "invalid command for ribs pipe";
|
||||||
@ -1974,10 +2008,10 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
if (!Funtil.IsNull()) {
|
if (!Funtil.IsNull()) {
|
||||||
theDPrism.Perform(Funtil);
|
getDPrism().Perform(Funtil);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
theDPrism.PerformUntilEnd();
|
getDPrism().PerformUntilEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2006,11 +2040,13 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
switch (Kas) {
|
switch (Kas) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (Ffrom.IsNull()) {
|
if (Ffrom.IsNull())
|
||||||
thePrism.PerformFromEnd(Funtil);
|
{
|
||||||
|
getPrism().PerformFromEnd(Funtil);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
thePrism.Perform(Ffrom, Funtil);
|
{
|
||||||
|
getPrism().Perform(Ffrom, Funtil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2019,7 +2055,7 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
if (Ffrom.IsNull()) {
|
if (Ffrom.IsNull()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
theRevol.Perform(Ffrom, Funtil);
|
getRevol().Perform(Ffrom, Funtil);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -2027,16 +2063,16 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
if (Ffrom.IsNull()) {
|
if (Ffrom.IsNull()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
thePipe.Perform(Ffrom, Funtil);
|
getPipe().Perform(Ffrom, Funtil);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
if (Ffrom.IsNull()) {
|
if (Ffrom.IsNull()) {
|
||||||
theDPrism.PerformFromEnd(Funtil);
|
getDPrism().PerformFromEnd(Funtil);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
theDPrism.Perform(Ffrom, Funtil);
|
getDPrism().Perform(Ffrom, Funtil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2050,15 +2086,16 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
BRepFeat_StatusError se;
|
BRepFeat_StatusError se;
|
||||||
switch (Kas) {
|
switch (Kas) {
|
||||||
case 1:
|
case 1:
|
||||||
if (!thePrism.IsDone()) {
|
if (!getPrism().IsDone())
|
||||||
se = thePrism.CurrentStatusError();
|
{
|
||||||
|
se = getPrism().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
theCommands << aSStream << "\n";
|
theCommands << aSStream << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
DBRep::Set(a[2], thePrism);
|
DBRep::Set(a[2], getPrism());
|
||||||
dout.Flush();
|
dout.Flush();
|
||||||
//History
|
//History
|
||||||
if (BRepTest_Objects::IsHistoryNeeded())
|
if (BRepTest_Objects::IsHistoryNeeded())
|
||||||
@ -2067,12 +2104,13 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
anArgs.Append(theSbase);
|
anArgs.Append(theSbase);
|
||||||
anArgs.Append(thePbase);
|
anArgs.Append(thePbase);
|
||||||
anArgs.Append(theSkface);
|
anArgs.Append(theSkface);
|
||||||
BRepTest_Objects::SetHistory(anArgs, thePrism);
|
BRepTest_Objects::SetHistory(anArgs, getPrism());
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case 2:
|
case 2:
|
||||||
if (!theRevol.IsDone()) {
|
if (!getRevol().IsDone())
|
||||||
se = theRevol.CurrentStatusError();
|
{
|
||||||
|
se = getRevol().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
@ -2086,14 +2124,15 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
anArgs.Append(theSbase);
|
anArgs.Append(theSbase);
|
||||||
anArgs.Append(thePbase);
|
anArgs.Append(thePbase);
|
||||||
anArgs.Append(theSkface);
|
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();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
case 3:
|
case 3:
|
||||||
if (!thePipe.IsDone()) {
|
if (!getPipe().IsDone())
|
||||||
se = thePipe.CurrentStatusError();
|
{
|
||||||
|
se = getPipe().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
@ -2107,14 +2146,15 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
anArgs.Append(theSbase);
|
anArgs.Append(theSbase);
|
||||||
anArgs.Append(thePbase);
|
anArgs.Append(thePbase);
|
||||||
anArgs.Append(theSkface);
|
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();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
case 4:
|
case 4:
|
||||||
if (!theDPrism.IsDone()) {
|
if (!getDPrism().IsDone())
|
||||||
se = theDPrism.CurrentStatusError();
|
{
|
||||||
|
se = getDPrism().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
@ -2128,33 +2168,35 @@ static Standard_Integer PERF(Draw_Interpretor& theCommands,
|
|||||||
anArgs.Append(theSbase);
|
anArgs.Append(theSbase);
|
||||||
anArgs.Append(thePbase);
|
anArgs.Append(thePbase);
|
||||||
anArgs.Append(theSkface);
|
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();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
case 5:
|
case 5:
|
||||||
if (!theLF.IsDone()) {
|
if (!getLienarForm().IsDone())
|
||||||
se = theLF.CurrentStatusError();
|
{
|
||||||
|
se = getLienarForm().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
theCommands << aSStream << "\n";
|
theCommands << aSStream << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
DBRep::Set(a[2], theLF);
|
DBRep::Set(a[2], getLienarForm());
|
||||||
dout.Flush();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
case 6:
|
case 6:
|
||||||
if (!theRF.IsDone()) {
|
if (!getRevolutionForm().IsDone())
|
||||||
se = theRF.CurrentStatusError();
|
{
|
||||||
|
se = getRevolutionForm().CurrentStatusError();
|
||||||
//BRepFeat::Print(se,std::cout) << std::endl;
|
//BRepFeat::Print(se,std::cout) << std::endl;
|
||||||
Standard_SStream aSStream;
|
Standard_SStream aSStream;
|
||||||
BRepFeat::Print(se, aSStream);
|
BRepFeat::Print(se, aSStream);
|
||||||
theCommands << aSStream << "\n";
|
theCommands << aSStream << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
DBRep::Set(a[2], theRF);
|
DBRep::Set(a[2], getRevolutionForm());
|
||||||
dout.Flush();
|
dout.Flush();
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
@ -2207,11 +2249,11 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
theDPrism.BossEdges(dprsig);
|
getDPrism().BossEdges(dprsig);
|
||||||
|
|
||||||
TopTools_ListOfShape theTopEdges, theLatEdges;
|
TopTools_ListOfShape theTopEdges, theLatEdges;
|
||||||
theTopEdges = theDPrism.TopEdges();
|
theTopEdges = getDPrism().TopEdges();
|
||||||
theLatEdges = theDPrism.LatEdges();
|
theLatEdges = getDPrism().LatEdges();
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape it;
|
TopTools_ListIteratorOfListOfShape it;
|
||||||
BRep_Builder B;
|
BRep_Builder B;
|
||||||
@ -2245,7 +2287,7 @@ static Standard_Integer BOSS(Draw_Interpretor& theCommands,
|
|||||||
V = DBRep::Get(a[2], TopAbs_SHAPE);
|
V = DBRep::Get(a[2], TopAbs_SHAPE);
|
||||||
}
|
}
|
||||||
else if (Kas == 3) {
|
else if (Kas == 3) {
|
||||||
V = theDPrism;
|
V = getDPrism();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (V.IsNull()) return 1;
|
if (V.IsNull()) return 1;
|
||||||
|
@ -35,7 +35,11 @@ static Message_DataMapOfExtendedString& msgsDataMap ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mutex used to prevent concurrent access to message registry
|
// mutex used to prevent concurrent access to message registry
|
||||||
|
static Standard_Mutex& Message_MsgFile_Mutex()
|
||||||
|
{
|
||||||
static Standard_Mutex theMutex;
|
static Standard_Mutex theMutex;
|
||||||
|
return theMutex;
|
||||||
|
}
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -345,13 +349,12 @@ Standard_Boolean Message_MsgFile::LoadFromString (const Standard_CString theCont
|
|||||||
//purpose : Add one message to the global table. Fails if the same keyword
|
//purpose : Add one message to the global table. Fails if the same keyword
|
||||||
// already exists in the table
|
// already exists in the table
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Standard_Boolean Message_MsgFile::AddMsg (const TCollection_AsciiString& theKeyword,
|
Standard_Boolean Message_MsgFile::AddMsg (const TCollection_AsciiString& theKeyword,
|
||||||
const TCollection_ExtendedString& theMessage)
|
const TCollection_ExtendedString& theMessage)
|
||||||
{
|
{
|
||||||
Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
|
Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
|
||||||
|
|
||||||
Standard_Mutex::Sentry aSentry (theMutex);
|
Standard_Mutex::Sentry aSentry (Message_MsgFile_Mutex());
|
||||||
aDataMap.Bind (theKeyword, theMessage);
|
aDataMap.Bind (theKeyword, theMessage);
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
@ -360,10 +363,9 @@ Standard_Boolean Message_MsgFile::AddMsg (const TCollection_AsciiString& theKeyw
|
|||||||
//function : getMsg
|
//function : getMsg
|
||||||
//purpose : retrieve the message previously defined for the given keyword
|
//purpose : retrieve the message previously defined for the given keyword
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
const TCollection_ExtendedString& Message_MsgFile::Msg (const Standard_CString theKeyword)
|
const TCollection_ExtendedString& Message_MsgFile::Msg (const Standard_CString theKeyword)
|
||||||
{
|
{
|
||||||
TCollection_AsciiString aKey((char*)theKeyword);
|
TCollection_AsciiString aKey (theKeyword);
|
||||||
return Msg (aKey);
|
return Msg (aKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,10 +373,9 @@ const TCollection_ExtendedString &Message_MsgFile::Msg (const Standard_CString t
|
|||||||
//function : HasMsg
|
//function : HasMsg
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
Standard_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyword)
|
Standard_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyword)
|
||||||
{
|
{
|
||||||
Standard_Mutex::Sentry aSentry (theMutex);
|
Standard_Mutex::Sentry aSentry (Message_MsgFile_Mutex());
|
||||||
return ::msgsDataMap().IsBound (theKeyword);
|
return ::msgsDataMap().IsBound (theKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,24 +383,26 @@ Standard_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyw
|
|||||||
//function : Msg
|
//function : Msg
|
||||||
//purpose : retrieve the message previously defined for the given keyword
|
//purpose : retrieve the message previously defined for the given keyword
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
const TCollection_ExtendedString& Message_MsgFile::Msg (const TCollection_AsciiString& theKeyword)
|
const TCollection_ExtendedString& Message_MsgFile::Msg (const TCollection_AsciiString& theKeyword)
|
||||||
{
|
{
|
||||||
// find message in the map
|
// find message in the map
|
||||||
Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
|
Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
|
||||||
Standard_Mutex::Sentry aSentry (theMutex);
|
Standard_Mutex::Sentry aSentry (Message_MsgFile_Mutex());
|
||||||
|
|
||||||
// if message is not found, generate error message and add it to the map to minimize overhead
|
// if message is not found, generate error message and add it to the map to minimize overhead
|
||||||
// on consequent calls with the same key
|
// on consequent calls with the same key
|
||||||
if (! aDataMap.IsBound(theKeyword))
|
const TCollection_ExtendedString* aValPtr = aDataMap.Seek (theKeyword);
|
||||||
|
if (aValPtr == NULL)
|
||||||
{
|
{
|
||||||
// text of the error message can be itself defined in the map
|
// text of the error message can be itself defined in the map
|
||||||
static const TCollection_AsciiString aPrefixCode("Message_Msg_BadKeyword");
|
static const TCollection_AsciiString aPrefixCode("Message_Msg_BadKeyword");
|
||||||
static const TCollection_ExtendedString aDefPrefix("Unknown message invoked with the keyword ");
|
static const TCollection_ExtendedString aDefPrefix("Unknown message invoked with the keyword ");
|
||||||
TCollection_AsciiString aErrorMessage = (aDataMap.IsBound(aPrefixCode) ? aDataMap(aPrefixCode) : aDefPrefix);
|
const TCollection_ExtendedString* aPrefValPtr = aDataMap.Seek (aPrefixCode);
|
||||||
|
TCollection_AsciiString aErrorMessage = (aPrefValPtr != NULL ? *aPrefValPtr : aDefPrefix);
|
||||||
aErrorMessage += theKeyword;
|
aErrorMessage += theKeyword;
|
||||||
aDataMap.Bind (theKeyword, aErrorMessage); // do not use AddMsg() here to avoid mutex deadlock
|
aDataMap.Bind (theKeyword, aErrorMessage); // do not use AddMsg() here to avoid mutex deadlock
|
||||||
|
aValPtr = aDataMap.Seek (theKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
return aDataMap (theKeyword);
|
return *aValPtr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user