1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031731: Draw Harness - colorize errors and exception messages

Draw_Interpretor, CommandCmd() - catched exceptions and messages put into Tcl string result
before throwing a Tcl exception (return 1) are now print in intense red (using Message::SendFail()).
Duplication of exception message in std::cout and Tcl output has been removed.

Draw Harness plugins have been updated to use either Message::SendFail() or theDI instead of std::cout/std::cerr
for printing colored error message before throwing a Tcl exception.
This commit is contained in:
kgv
2020-08-24 19:13:08 +03:00
parent 1d99a2baaa
commit d99f0355e3
98 changed files with 514 additions and 620 deletions

View File

@@ -39,6 +39,7 @@
#include <BRepBndLib.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_Box2d.hxx>
#include <Message.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <BRepTools_WireExplorer.hxx>
@@ -176,7 +177,7 @@ static Standard_Integer transform(Draw_Interpretor& ,Standard_Integer n,const ch
TopoDS_Shape S = DBRep::Get(a[i]);
if (S.IsNull())
{
std::cerr << "Error: " << a[i] << " is not a valid shape\n";
Message::SendFail() << "Error: " << a[i] << " is not a valid shape";
return 1;
}
else
@@ -188,7 +189,7 @@ static Standard_Integer transform(Draw_Interpretor& ,Standard_Integer n,const ch
for (Standard_Integer i = 1; i < last; i++) {
TopoDS_Shape S = DBRep::Get(a[i]);
if (S.IsNull()) {
std::cerr << "Error: " << a[i] << " is not a valid shape\n";
Message::SendFail() << "Error: " << a[i] << " is not a valid shape";
return 1;
}
else {
@@ -271,9 +272,9 @@ static Standard_Integer tcopy(Draw_Interpretor& di,Standard_Integer n,const char
}
if (n < 3 || (n - iFirst) % 2) {
std::cout << "Use: " << a[0] << " [-n(ogeom)] [-m(esh)] shape1 copy1 [shape2 copy2 [...]]" << std::endl;
std::cout << "Option -n forbids copying of geometry (it will be shared)" << std::endl;
std::cout << "Option -m forces copying of mesh (disabled by default)" << std::endl;
Message::SendFail() << "Use: " << a[0] << " [-n(ogeom)] [-m(esh)] shape1 copy1 [shape2 copy2 [...]]\n"
<< "Option -n forbids copying of geometry (it will be shared)\n"
<< "Option -m forces copying of mesh (disabled by default)";
return 1;
}
@@ -584,7 +585,7 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI,
}
else
{
std::cout << "Syntax error at argument '" << theArgVal[anArgIter] << "'.\n";
Message::SendFail() << "Syntax error at argument '" << theArgVal[anArgIter] << "'";
return 1;
}
}
@@ -592,19 +593,19 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI,
if (anAABB.IsVoid()
&& aShape.IsNull())
{
std::cout << "Syntax error: input is not specified (neither shape nor coordinates)\n";
Message::SendFail() << "Syntax error: input is not specified (neither shape nor coordinates)";
return 1;
}
else if (!anAABB.IsVoid()
&& (isOBB || isOptimal || isTolerUsed))
{
std::cout << "Syntax error: Options -obb, -optimal and -extToler cannot be used for explicitly defined AABB.\n";
Message::SendFail() << "Syntax error: Options -obb, -optimal and -extToler cannot be used for explicitly defined AABB";
return 1;
}
else if (isOBB
&& !anOutVars[0].IsEmpty())
{
std::cout << "Error: Option -save works only with axes-aligned boxes.\n";
Message::SendFail() << "Error: Option -save works only with axes-aligned boxes";
return 1;
}

View File

@@ -14,8 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
// modified by mps (juillet 96) : ajout de la commande distmini
#include <DBRep.hxx>
#include <BRepTest.hxx>
#include <BRepExtrema_Poly.hxx>
@@ -28,15 +26,13 @@
#include <TopoDS_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <Draw.hxx>
#include <Message.hxx>
#include <OSD_Timer.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
#include <Precision.hxx>
//#ifdef _MSC_VER
#include <stdio.h>
//#endif
//=======================================================================
//function : distance
@@ -150,9 +146,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
{
if (theNbArgs < 3 || theNbArgs > 6)
{
std::cout << "Usage: " << theArgs[0] <<
" Shape1 Shape2 [-tol <value>] [-profile]" << std::endl;
Message::SendFail() << "Usage: " << theArgs[0] << " Shape1 Shape2 [-tol <value>] [-profile]";
return 1;
}
@@ -161,7 +155,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
if (aShape1.IsNull() || aShape2.IsNull())
{
std::cout << "Error: Failed to find specified shapes" << std::endl;
Message::SendFail() << "Error: Failed to find specified shapes";
return 1;
}
@@ -178,14 +172,14 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
{
if (++anArgIdx >= theNbArgs)
{
std::cout << "Error: wrong syntax at argument '" << aFlag << std::endl;
Message::SendFail() << "Error: wrong syntax at argument '" << aFlag;
return 1;
}
const Standard_Real aTolerance = Draw::Atof (theArgs[anArgIdx]);
if (aTolerance < 0.0)
{
std::cout << "Error: Tolerance value should be non-negative" << std::endl;
Message::SendFail() << "Error: Tolerance value should be non-negative";
return 1;
}
else
@@ -231,7 +225,7 @@ static int ShapeProximity (Draw_Interpretor& theDI, Standard_Integer theNbArgs,
if (!aTool.IsDone())
{
std::cout << "Error: Failed to perform proximity test" << std::endl;
Message::SendFail() << "Error: Failed to perform proximity test";
return 1;
}
@@ -287,17 +281,14 @@ static int ShapeSelfIntersection (Draw_Interpretor& theDI, Standard_Integer theN
{
if (theNbArgs < 2 || theNbArgs > 5)
{
std::cout << "Usage: " << theArgs[0] <<
" Shape [-tol <value>] [-profile]" << std::endl;
Message::SendFail() << "Usage: " << theArgs[0] << " Shape [-tol <value>] [-profile]";
return 1;
}
TopoDS_Shape aShape = DBRep::Get (theArgs[1]);
if (aShape.IsNull())
{
std::cout << "Error: Failed to find specified shape" << std::endl;
Message::SendFail() << "Error: Failed to find specified shape";
return 1;
}
@@ -313,14 +304,14 @@ static int ShapeSelfIntersection (Draw_Interpretor& theDI, Standard_Integer theN
{
if (++anArgIdx >= theNbArgs)
{
std::cout << "Error: wrong syntax at argument '" << aFlag << std::endl;
Message::SendFail() << "Error: wrong syntax at argument '" << aFlag;
return 1;
}
const Standard_Real aValue = Draw::Atof (theArgs[anArgIdx]);
if (aValue < 0.0)
{
std::cout << "Error: Tolerance value should be non-negative" << std::endl;
Message::SendFail() << "Error: Tolerance value should be non-negative";
return 1;
}
else
@@ -360,7 +351,7 @@ static int ShapeSelfIntersection (Draw_Interpretor& theDI, Standard_Integer theN
if (!aTool.IsDone())
{
std::cout << "Error: Failed to perform proximity test" << std::endl;
Message::SendFail() << "Error: Failed to perform proximity test";
return 1;
}

View File

@@ -65,6 +65,7 @@
#include <BRepFilletAPI_MakeFillet.hxx>
#include <ChFi3d_FilletShape.hxx>
#include <Message.hxx>
#include <Precision.hxx>
@@ -756,16 +757,16 @@ static Standard_Integer SPLS(Draw_Interpretor&,
if (narg < 3)
{
std::cout << "Invalid number of arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]" << std::endl;
Message::SendFail() << "Invalid number of arguments. Should be : splitshape result shape [splitedges] "
"[face wire/edge/compound [wire/edge/compound ...] "
"[face wire/edge/compound [wire/edge/compound...] ...] "
"[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]";
return 1;
}
TopoDS_Shape S = DBRep::Get(a[2]);
if (S.IsNull())
{
std::cout << "Invalid input shape " << a[2] << std::endl;
Message::SendFail() << "Invalid input shape " << a[2];
return 1;
}
BRepFeat_SplitShape Spls(S);
@@ -792,7 +793,7 @@ static Standard_Integer SPLS(Draw_Interpretor&,
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
std::cout << "Invalid input shape " << a[i] << std::endl;
Message::SendFail() << "Invalid input shape " << a[i];
return 1;
}
@@ -871,7 +872,7 @@ static Standard_Integer SPLS(Draw_Interpretor&,
TopoDS_Shape aSh = DBRep::Get(a[i]);
if (aSh.IsNull())
{
std::cout << "Invalid input shape " << a[i] << std::endl;
Message::SendFail() << "Invalid input shape " << a[i];
return 1;
}
TopExp_Explorer aExpE(aSh, TopAbs_EDGE, TopAbs_FACE);
@@ -880,10 +881,10 @@ static Standard_Integer SPLS(Draw_Interpretor&,
}
else
{
std::cout << "Invalid input arguments. Should be : splitshape result shape [splitedges] \
[face wire/edge/compound [wire/edge/compound ...] \
[face wire/edge/compound [wire/edge/compound...] ...] \
[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]" << std::endl;
Message::SendFail() << "Invalid input arguments. Should be : splitshape result shape [splitedges] "
"[face wire/edge/compound [wire/edge/compound ...] "
"[face wire/edge/compound [wire/edge/compound...] ...] "
"[@ edgeonshape edgeonwire [edgeonshape edgeonwire...]]";
return 1;
}
}
@@ -906,7 +907,7 @@ static Standard_Integer SPLS(Draw_Interpretor&,
Ew = TopoDS::Edge(aLocalShape);
// Ew = TopoDS::Edge(DBRep::Get(a[i+1],TopAbs_EDGE));
if (Ew.IsNull()) {
std::cout << "Invalid input shape " << a[i + 1] << std::endl;
Message::SendFail() << "Invalid input shape " << a[i + 1];
return 1;
}
Spls.Add(TopoDS::Edge(Ew), TopoDS::Edge(Es));

View File

@@ -51,6 +51,7 @@
#include <FilletSurf_ErrorTypeStatus.hxx>
#include <TopAbs.hxx>
#include <DrawTrSurf.hxx>
#include <Message.hxx>
#include <stdio.h>
@@ -333,7 +334,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
printtolblend(di);
if(narg < 5)
{
std::cout << "Use <command name> result shape1 shape2 radius [-d]" << std::endl;
Message::SendFail() << "Use <command name> result shape1 shape2 radius [-d]";
return 1;
}
@@ -341,7 +342,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
TopoDS_Shape S1 = DBRep::Get(a[2]);
TopoDS_Shape S2 = DBRep::Get(a[3]);
if (S1.IsNull() || S2.IsNull()) {
printf(" Null shapes are not allowed \n");
Message::SendFail() << " Null shapes are not allowed";
return 1;
}
Standard_Real Rad = Draw::Atof(a[4]);
@@ -363,7 +364,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
//
theDSFiller.Perform();
if (theDSFiller.HasErrors()) {
printf("Check types of the arguments, please\n");
Message::SendFail() << "Check types of the arguments, please";
return 1;
}
@@ -377,7 +378,7 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
Standard_Boolean anIsDone = pBuilder->IsDone();
if (!anIsDone)
{
printf("boolean operation not done HasErrors()=%d\n", pBuilder->HasErrors());
Message::SendFail() << "boolean operation not done HasErrors()=" << pBuilder->HasErrors();
return 1;
}

View File

@@ -75,6 +75,7 @@
#include <BRepOffset_MakeOffset.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Message.hxx>
static
void SampleEdges (const TopoDS_Shape& theShape,
@@ -277,7 +278,7 @@ Standard_Integer brepintcs(Draw_Interpretor& di, Standard_Integer n, const char*
{
if (n <= 2)
{
std::cout<<"Invalid input arguments. Should be: curve1 [curve2 ...] shape [result] [tol]"<<std::endl;
Message::SendFail() << "Invalid input arguments. Should be: curve1 [curve2 ...] shape [result] [tol]";
return 1;
}
Standard_Integer indshape = 2;
@@ -290,7 +291,7 @@ Standard_Integer brepintcs(Draw_Interpretor& di, Standard_Integer n, const char*
}
if (S.IsNull())
{
std::cout<<"Invalid input shape"<<std::endl;
Message::SendFail() << "Invalid input shape";
return 1;
}

View File

@@ -32,7 +32,7 @@
#include <BRepPrimAPI_MakeSphere.hxx>
#include <Geom_Plane.hxx>
#include <gp_Pln.hxx>
#include <Message.hxx>
//=======================================================================
// box
@@ -129,7 +129,7 @@ static Standard_Integer box(Draw_Interpretor& , Standard_Integer n, const char**
}
else
{
std::cout<<"Syntax error\n";
Message::SendFail() << "Syntax error";
return 1;
}
}

View File

@@ -46,6 +46,7 @@
#include <BRepBuilderAPI_FastSewing.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Message.hxx>
#ifdef _WIN32
//#define strcasecmp strcmp Already defined
@@ -75,7 +76,7 @@ static Standard_Integer mkface(Draw_Interpretor& , Standard_Integer n, const cha
Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[2]);
if (S.IsNull()) {
std::cout << a[2] << " is not a surface" << std::endl;
Message::SendFail() << a[2] << " is not a surface";
return 1;
}
@@ -580,7 +581,7 @@ static Standard_Integer getedgeregul
{
if( argc < 3)
{
std::cout<<"Invalid number of arguments. Should be: checkedgeregularity edge face1 [face2]"<<std::endl;
Message::SendFail() << "Invalid number of arguments. Should be: checkedgeregularity edge face1 [face2]";
return 1;
}
@@ -589,7 +590,7 @@ static Standard_Integer getedgeregul
TopoDS_Shape aFace2 = (argc > 3 ? DBRep::Get(argv[3],TopAbs_FACE) : aFace1);
if( anEdge.IsNull() || aFace1.IsNull() || aFace2.IsNull())
{
std::cout<<"Invalid number of arguments. Should be: getedgeregularity edge face1 [face2]"<<std::endl;
Message::SendFail() << "Invalid number of arguments. Should be: getedgeregularity edge face1 [face2]";
return 1;
}

View File

@@ -59,7 +59,7 @@ static BRepOffsetAPI_ThruSections* Generator = 0;
#include <gp_Vec.hxx>
#include <Geom_Circle.hxx>
#include <gp_Ax2.hxx>
#include <Message.hxx>
//=======================================================================
// prism
@@ -244,7 +244,7 @@ static Standard_Integer geompipe(Draw_Interpretor&,
aPipe.Perform(Standard_True);
if (!aPipe.IsDone())
{
std::cout << "GeomFill_Pipe cannot make a surface" << std::endl;
Message::SendFail() << "GeomFill_Pipe cannot make a surface";
return 1;
}
@@ -550,16 +550,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if (n == 1) {
//std::cout << "setsweep options [arg1 [arg2 [...]]] : options are :" << std::endl;
//std::cout << " -FR : Tangent and Normal are given by Frenet trihedron" <<std::endl;
//std::cout << " -CF : Tangente is given by Frenet," << std::endl;
//std::cout << " the Normal is computed to minimize the torsion " << std::endl;
//std::cout << " -DX Surf : Tangent and Normal are given by Darboux trihedron,"
// <<std::endl;
//std::cout << " Surf have to be a shell or a face" <<std::endl;
//std::cout << " -CN dx dy dz : BiNormal is given by dx dy dz" << std::endl;
//std::cout << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed" <<std::endl;
//std::cout << " -G guide 0|1(ACR|Plan) 0|1(contact|no contact) : with guide"<<std::endl;
di << "setsweep options [arg1 [arg2 [...]]] : options are :\n";
di << " -FR : Tangent and Normal are given by Frenet trihedron\n";
di << " -CF : Tangente is given by Frenet,\n";
@@ -574,7 +564,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
@@ -589,14 +578,12 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else if (!strcmp(a[1], "-DX")) {
if (n != 3) {
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
TopoDS_Shape Surf;
Surf = DBRep::Get(a[2], TopAbs_SHAPE);
if (Surf.IsNull()) {
//std::cout << a[2] <<"is not a shape !" << std::endl;
di << a[2] << "is not a shape !\n";
return 1;
}
@@ -604,7 +591,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else if (!strcmp(a[1], "-CN")) {
if (n != 5) {
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
@@ -613,7 +599,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else if (!strcmp(a[1], "-FX")) {
if ((n != 5) && (n != 8)) {
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
@@ -632,7 +617,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
{
if (n != 5)
{
//std::cout << "bad arguments !" << std::endl;
di << "bad arguments !\n";
return 1;
}
@@ -648,7 +632,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
}
else {
//std::cout << "The option "<< a[1] << " is unknown !" << std::endl;
di << "The option " << a[1] << " is unknown !\n";
return 1;
}
@@ -663,11 +646,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if (n == 1) {
//std::cout << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :" << std::endl;
//std::cout << " -T : the wire/vertex have to be translated to assume contact"<< std::endl;
//std::cout << " with the spine" <<std::endl;
//std::cout << " -R : the wire have to be rotated to assume orthogonality"<<std::endl;
//std::cout << " with the spine's tangent" << std::endl;
di << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :\n";
di << " -T : the wire/vertex have to be translated to assume contact\n";
di << " with the spine\n";
@@ -677,7 +655,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
}
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
@@ -691,7 +668,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
(Section.ShapeType() != TopAbs_WIRE &&
Section.ShapeType() != TopAbs_VERTEX))
{
//std::cout << a[1] <<"is not a wire and is not a vertex!" << std::endl;
di << a[1] << " is not a wire and is not a vertex!\n";
return 1;
}
@@ -705,7 +681,6 @@ static Standard_Integer addsweep(Draw_Interpretor& di,
// Reading of Vertex
TopoDS_Shape InputVertex(DBRep::Get(a[cur], TopAbs_VERTEX));
Vertex = TopoDS::Vertex(InputVertex);
// Vertex = TopoDS::Vertex(DBRep::Get(a[cur],TopAbs_VERTEX));
if (!Vertex.IsNull()) {
cur++;
HasVertex = Standard_True;
@@ -768,15 +743,12 @@ static Standard_Integer deletesweep(Draw_Interpretor& di,
TopoDS_Wire Section;
TopoDS_Shape InputShape(DBRep::Get(a[1], TopAbs_SHAPE));
Section = TopoDS::Wire(InputShape);
// Section = TopoDS::Wire(DBRep::Get(a[1],TopAbs_SHAPE));
if (Section.IsNull()) {
//std::cout << a[1] <<"is not a wire !" << std::endl;
di << a[1] << "is not a wire !\n";
return 1;
}
Sweep->Delete(Section);
return 0;
}
@@ -787,14 +759,6 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
Standard_Integer n, const char** a)
{
if (n == 1) {
//std::cout << "build sweep result [-M/-C/-R] [-S] [tol] : options are" << std::endl;
//std::cout << " -M : Discontinuities are treated by Modfication of"<< std::endl;
//std::cout << " the sweeping mode : it is the default" <<std::endl;
//std::cout << " -C : Discontinuities are treated like Right Corner" << std::endl;
//std::cout << " Treatement is Extent && Intersect" << std::endl;
//std::cout << " -R : Discontinuities are treated like Round Corner" << std::endl;
//std::cout << " Treatement is Intersect and Fill" << std::endl;
//std::cout << " -S : To build a Solid" << std::endl;
di << "build sweep result [-M/-C/-R] [-S] [tol] : options are\n";
di << " -M : Discontinuities are treated by Modfication of\n";
di << " the sweeping mode : it is the default\n";
@@ -808,13 +772,11 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
Standard_Boolean mksolid = Standard_False;
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
if (!Sweep->IsReady()) {
//std::cout << "You have forgotten the <<addsweep>> command !"<< std::endl;
di << "You have forgotten the <<addsweep>> command !\n";
return 1;
}
@@ -841,15 +803,12 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
// Calcul le resultat
Sweep->Build();
if (!Sweep->IsDone()) {
//std::cout << "Buildsweep : Not Done" << std::endl;
di << "Buildsweep : Not Done\n";
BRepBuilderAPI_PipeError Stat = Sweep->GetStatus();
if (Stat == BRepBuilderAPI_PlaneNotIntersectGuide) {
//std::cout << "Buildsweep : One Plane not intersect the guide" << std::endl;
di << "Buildsweep : One Plane not intersect the guide\n";
}
if (Stat == BRepBuilderAPI_ImpossibleContact) {
//std::cout << "BuildSweep : One section can not be in contact with the guide" << std::endl;
di << "BuildSweep : One section can not be in contact with the guide\n";
}
}
@@ -857,7 +816,6 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
if (mksolid) {
Standard_Boolean B;
B = Sweep->MakeSolid();
//if (!B) std::cout << " BuildSweep : It is impossible to make a solid !" << std::endl;
if (!B) di << " BuildSweep : It is impossible to make a solid !\n";
}
result = Sweep->Shape();
@@ -903,13 +861,11 @@ static Standard_Integer simulsweep(Draw_Interpretor& di,
if ((n != 3) && (n != 4)) return 1;
if (Sweep == 0) {
//std::cout << "You have forgotten the <<mksweep>> command !"<< std::endl;
di << "You have forgotten the <<mksweep>> command !\n";
return 1;
}
if (!Sweep->IsReady()) {
//std::cout << "You have forgotten the <<addsweep>> command !"<< std::endl;
di << "You have forgotten the <<addsweep>> command !\n";
return 1;
}

View File

@@ -42,6 +42,7 @@
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <gp.hxx>
#include <gp_Pln.hxx>
#include <Message.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
@@ -118,7 +119,7 @@ static Standard_Integer section(Draw_Interpretor& , Standard_Integer n, const ch
Sec.Approximation(Standard_True);
else if (strcasecmp(a[i], "-p"))
{
std::cout << "Unknown option: " << a[i] << std::endl;
Message::SendFail() << "Unknown option: " << a[i];
return 1;
}
}
@@ -170,7 +171,6 @@ static Standard_Integer halfspace(Draw_Interpretor& di,
if ( Face.IsNull()) {
TopoDS_Shape Shell = DBRep::Get(a[2],TopAbs_SHELL);
if (Shell.IsNull()) {
//std::cout << a[2] << " must be a face or a shell" << std::endl;
di << a[2] << " must be a face or a shell\n";
return 1;
}
@@ -180,7 +180,6 @@ static Standard_Integer halfspace(Draw_Interpretor& di,
DBRep::Set(a[1],Half.Solid());
}
else {
//std::cout << " HalfSpace NotDone" << std::endl;
di << " HalfSpace NotDone\n";
return 1;
}
@@ -192,7 +191,6 @@ static Standard_Integer halfspace(Draw_Interpretor& di,
DBRep::Set(a[1],Half.Solid());
}
else {
//std::cout << " HalfSpace NotDone" << std::endl;
di << " HalfSpace NotDone\n";
return 1;
}
@@ -211,14 +209,12 @@ static Standard_Integer buildfaces(Draw_Interpretor& , Standard_Integer narg, co
TopoDS_Shape InputShape(DBRep::Get( a[2] ,TopAbs_FACE));
TopoDS_Face F = TopoDS::Face(InputShape);
// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[2],TopAbs_FACE));
BRepAlgo_FaceRestrictor FR;
FR.Init(F);
for (Standard_Integer i = 3 ; i < narg ; i++) {
TopoDS_Shape InputWire(DBRep::Get(a[i],TopAbs_WIRE));
TopoDS_Wire W = TopoDS::Wire(InputWire);
// TopoDS_Wire W = TopoDS::Wire(DBRep::Get(a[i],TopAbs_WIRE));
FR.Add(W);
}
FR.Perform();