// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
-
#include <QABugs.hxx>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include<Draw_Interpretor.hxx>
-#include<TopLoc_Location.hxx>
-#include<TopoDS_Face.hxx>
-#include<TopoDS.hxx>
-#include<DBRep.hxx>
-#include<Geom_Surface.hxx>
-#include<BRep_Tool.hxx>
-#include<GeomInt_IntSS.hxx>
-#include<BRepBuilderAPI_MakeEdge.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS.hxx>
+#include <DBRep.hxx>
+#include <Geom_Surface.hxx>
+#include <BRep_Tool.hxx>
+#include <GeomInt_IntSS.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Standard_ErrorHandler.hxx>
-#include<tcl.h>
+#include <Graphic3d_ClipPlane.hxx>
+#include <tcl.h>
+
+#include <fstream>
static int BUC60623(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
{
di << "U=" << 1.28 << " V=" << 5.1 << " classified OUTSIDE" << "\n";
}
} else {
- uvSurf = gp_Pnt2d(atof(argv[3]),atof(argv[4]));
+ uvSurf = gp_Pnt2d(Draw::Atof(argv[3]),Draw::Atof(argv[4]));
state = PClass.Classify(face,uvSurf,Precision::PConfusion());
if(state == TopAbs_IN || state == TopAbs_ON){
- di << "U=" << atof(argv[3]) << " V=" << atof(argv[4]) << " classified INSIDE" << "\n";
+ di << "U=" << Draw::Atof(argv[3]) << " V=" << Draw::Atof(argv[4]) << " classified INSIDE" << "\n";
}else{
- di << "U=" << atof(argv[3]) << " V=" << atof(argv[4]) << " classified OUTSIDE" << "\n";
+ di << "U=" << Draw::Atof(argv[3]) << " V=" << Draw::Atof(argv[4]) << " classified OUTSIDE" << "\n";
}
}
return 0;
}
Standard_Boolean IsBRepAlgoAPI = Standard_True;
if (argc == 6) {
- Standard_Integer IsB = atoi(argv[5]);
+ Standard_Integer IsB = Draw::Atoi(argv[5]);
if (IsB != 1) {
IsBRepAlgoAPI = Standard_False;
#if ! defined(BRepAlgo_def04)
#endif
Standard_Character *filename = new Standard_Character [strlen(DD)+17];
- sprintf(filename,"%s/%s.topo",DD,argv[1]);
+ Sprintf(filename,"%s/%s.topo",DD,argv[1]);
filebuf fic;
istream in(&fic);
TopoDS_Shape free_1,free_2,free_3,free_4;
BRep_Builder B;
- sprintf(FileName,"%s/%s",DD,"buc60547a.brep");
+ Sprintf(FileName,"%s/%s",DD,"buc60547a.brep");
BRepTools::Read(free_1,FileName,B);
- sprintf(FileName,"%s/%s",DD,"buc60547b.brep");
+ Sprintf(FileName,"%s/%s",DD,"buc60547b.brep");
BRepTools::Read(free_2,FileName,B);
- sprintf(FileName,"%s/%s",DD,"buc60547c.brep");
+ Sprintf(FileName,"%s/%s",DD,"buc60547c.brep");
BRepTools::Read(free_3,FileName,B);
- sprintf(FileName,"%s/%s",DD,"buc60547d.brep");
+ Sprintf(FileName,"%s/%s",DD,"buc60547d.brep");
BRepTools::Read(free_4,FileName,B);
- sprintf(Ch,"%s_%i",argv[1],1);
+ Sprintf(Ch,"%s_%i",argv[1],1);
DBRep::Set(Ch,free_1);
di << Ch << " ";
- sprintf(Ch,"%s_%i",argv[1],2);
+ Sprintf(Ch,"%s_%i",argv[1],2);
DBRep::Set(Ch,free_2);
di << Ch << " ";
- sprintf(Ch,"%s_%i",argv[1],3);
+ Sprintf(Ch,"%s_%i",argv[1],3);
DBRep::Set(Ch,free_3);
di << Ch << " ";
- sprintf(Ch,"%s_%i",argv[1],4);
+ Sprintf(Ch,"%s_%i",argv[1],4);
DBRep::Set(Ch,free_4);
di << Ch << " ";
bui.Add(Com,free_3);
bui.Add(Com,free_4);
- sprintf(Ch,"%s_%c",argv[1],'c');
+ Sprintf(Ch,"%s_%c",argv[1],'c');
DBRep::Set(Ch,Com);
di << Ch << " ";
Handle(AIS_Shape) SC = new AIS_Shape(Com);
myAISContext->Display(SC); // nothing on the screen If I save the compound :
- sprintf(FileName,"%s/%s",DD,"free.brep");
+ Sprintf(FileName,"%s/%s",DD,"free.brep");
BRepTools::Write(Com,FileName);
Handle(Geom_Plane) Plane1 = new Geom_Plane(gp_Pnt(0,0,0),gp_Dir(0,0,1));
TCollection_ExtendedString Ext1("Dim1");
- Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,atof(a[2]),Ext1);
+ Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,Draw::Atof(a[2]),Ext1);
- myAIScontext->SetDisplayMode(Dim1, atoi(a[1]));
+ myAIScontext->SetDisplayMode(Dim1, Draw::Atoi(a[1]));
myAIScontext->Display(Dim1);
return 0;
}
TopoDS_Shape s1 = DBRep::Get(a[2],TopAbs_SHELL);
TopoDS_Shape s2 = DBRep::Get(a[3],TopAbs_SHELL);
if (s1.IsNull() || s2.IsNull()) return 1;
- NbPntMax=atoi(a[4]);
- Toler3d=atof(a[5]);
- Toler2d=atof(a[6]);
- RelativeTol=atoi(a[7]);
+ NbPntMax=Draw::Atoi(a[4]);
+ Toler3d=Draw::Atof(a[5]);
+ Toler2d=Draw::Atof(a[6]);
+ RelativeTol=Draw::Atoi(a[7]);
di << "BRepAlgo_BooleanOperations myalgo" << "\n";
BRepAlgo_BooleanOperations myalgo;
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgo_Fuse.hxx>
-#include <V3d_Plane.hxx>
#include <V3d_View.hxx>
#include <gce_MakePln.hxx>
-static Standard_Integer BUC60698(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
-{
- if(argc > 2) {
- di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
- return 1;
- }
- Standard_Boolean IsBRepAlgoAPI = Standard_True;
- if (argc == 2) {
- Standard_Integer IsB = atoi(a[1]);
- if (IsB != 1) {
- IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-// return 1;
-#endif
- }
- }
-
- Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
- if(myAISContext.IsNull()) {
- di << "use 'vinit' command before " << a[0] << "\n";
- return -1;
- }
- TopoDS_Solid box = BRepPrimAPI_MakeBox(1,1,1).Solid();
- TopoDS_Shape sphere = BRepPrimAPI_MakeSphere(gp_Pnt(0.5,0.5,0.5),0.6).Shape();
-
-//#if ! defined(BRepAlgoAPI_def01)
-// TopoDS_Shape fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
-//#else
-// TopoDS_Shape fuse = BRepAlgo_Fuse(box,sphere).Shape();
-//#endif
-
- TopoDS_Shape fuse;
- if (IsBRepAlgoAPI) {
- di << "fuse = BRepAlgoAPI_Fuse(box,sphere).Shape()" <<"\n";
- fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
- } else {
- di << "fuse = BRepAlgo_Fuse(box,sphere).Shape()" <<"\n";
- fuse = BRepAlgo_Fuse(box,sphere).Shape();
- }
-
- Handle_AIS_Shape theAISShape = new AIS_Shape(fuse);
- myAISContext->Display(theAISShape);
- di.Eval("vfit");
- gp_Pln thegpPln = gce_MakePln(gp_Pnt(0.5,0.5,0.5),gp_Dir(0,0,1));
- Standard_Real A,B,C,D;
- thegpPln.Coefficients(A,B,C,D);
- Handle_V3d_Plane thePlane = new V3d_Plane(A,B,C,D);
- myAISContext->CurrentViewer()->AddPlane (thePlane); // add to defined planes list
- for (myAISContext->CurrentViewer()->InitActiveViews();
- myAISContext->CurrentViewer()->MoreActiveViews ();
- myAISContext->CurrentViewer()->NextActiveViews ()) {
- try {
- OCC_CATCH_SIGNALS
- myAISContext->CurrentViewer()->ActiveView()->SetPlaneOn(thePlane);
- }
- catch(Standard_Failure) {
- di << "SetPlaneOn catched 1" << "\n";
- }
-#ifdef WNT
- catch(...) {
- di << "SetPlaneOn catched 1" << "\n";
- }
-#endif
- }//ActiveView loop
- for (myAISContext->CurrentViewer()->InitDefinedViews();
- myAISContext->CurrentViewer()->MoreDefinedViews ();
- myAISContext->CurrentViewer()->NextDefinedViews ()) {
- try {
- OCC_CATCH_SIGNALS
- myAISContext->CurrentViewer()->DefinedView()->SetPlaneOn(thePlane);
- }
- catch(Standard_Failure) {
- di << "SetPlaneOn catched 1" << "\n";
- }
-#ifdef WNT
- catch(...) {
- di << "SetPlaneOn catched 2" << "\n";
- }
-#endif
- }//DefinedView loop
- myAISContext->UpdateCurrentViewer();
- myAISContext->OpenLocalContext();
- myAISContext->ActivateStandardMode(TopAbs_FACE);
- return 0;
-}
-
static Standard_Integer BUC60699(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
{
}
Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
- if((argc == 2) && (atof(argv[1]) == 0))
+ if((argc == 2) && (Draw::Atof(argv[1]) == 0))
myV3dView->SetAntialiasingOff();
else
myV3dView->SetAntialiasingOn();
// Change the background color of the view with the color values <r>,<g>,<b>
// A color value must be defined in the space [0.,1.]
- Standard_Real QuantityOfRed = atoi(argv[1]);
- Standard_Real QuantityOfGreen = atoi(argv[2]);
- Standard_Real QuantityOfBlue = atoi(argv[3]);
+ Standard_Real QuantityOfRed = Draw::Atoi(argv[1]);
+ Standard_Real QuantityOfGreen = Draw::Atoi(argv[2]);
+ Standard_Real QuantityOfBlue = Draw::Atoi(argv[3]);
myV3dView->SetBackgroundColor(Quantity_TOC_RGB,QuantityOfRed,QuantityOfGreen,QuantityOfBlue);
myV3dView->Redraw();
break;
// change the object color with RGB values.
- Standard_Real QuantityOfRed = atof(argv[2]);
- Standard_Real QuantityOfGreen = atof(argv[3]);
- Standard_Real QuantityOfBlue = atof(argv[4]);
+ Standard_Real QuantityOfRed = Draw::Atof(argv[2]);
+ Standard_Real QuantityOfGreen = Draw::Atof(argv[3]);
+ Standard_Real QuantityOfBlue = Draw::Atof(argv[4]);
TopoDS_Shape aShape = DBRep::Get(argv[1]);
Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape);
di << "Usage : " << argv[0] << " 0/1" << "\n";
}
- if(atoi(argv[1]) == 0) {
+ if(Draw::Atoi(argv[1]) == 0) {
myAISContext->CloseAllContexts();
BRepPrimAPI_MakeBox B(gp_Pnt(-400.,-400.,-100.),200.,150.,100.);
Handle(AIS_Shape) aBox = new AIS_Shape(B.Shape());
myAISContext->Display(aBox);
- } else if(atoi(argv[1]) == 1) {
+ } else if(Draw::Atoi(argv[1]) == 1) {
myAISContext->CloseAllContexts();
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode(TopAbs_EDGE);
- } else if(atoi(argv[1]) == 2) {
+ } else if(Draw::Atoi(argv[1]) == 2) {
myAISContext->CloseAllContexts();
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode(TopAbs_FACE);
#include <BRepBndLib.hxx>
#include <Bnd_HArray1OfBox.hxx>
-static Standard_Integer BUC60729 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** /*argv*/ )
+static Standard_Integer BUC60729 (Draw_Interpretor& /*di*/,Standard_Integer /*argc*/, const char ** /*argv*/ )
{
Bnd_Box aMainBox;
TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1,1,1).Solid();
{
TCollection_AsciiString as1("");
TCollection_AsciiString as2('\0');
- if((as1.ToCString()!=NULL) || (as1.ToCString() != ""))
- di << "Faulty : the first string is not zero string : " << as1.ToCString() << "\n";
+ if(as1.ToCString() == NULL || as1.Length() != 0 || as1.ToCString()[0] != '\0')
+ di << "Error : the first string is not zero string : " << as1.ToCString() << "\n";
- if((as2.ToCString()!=NULL) || (as2.ToCString() != ""))
- di << "Faulty : the second string is not zero string : " << as2.ToCString() << "\n";
+ if(as2.ToCString() == NULL || as2.Length() != 0 || as2.ToCString()[0] != '\0')
+ di << "Error : the second string is not zero string : " << as2.ToCString() << "\n";
return 0;
}
gccc = new Geom2d_Circle(ccc);
TopoDS_Shape sh = BRepBuilderAPI_MakeEdge(gccc, pln).Shape();
Standard_Character aStr[5];
- sprintf(aStr,"sh%d",i);
+ Sprintf(aStr,"sh%d",i);
DBRep::Set(aStr,sh);
Handle_AIS_Shape ais = new AIS_Shape(sh);
if( i ==1 )
}
Standard_Boolean IsBRepAlgoAPI = Standard_True;
if (argc == 2) {
- Standard_Integer IsB = atoi(argv[1]);
+ Standard_Integer IsB = Draw::Atoi(argv[1]);
if (IsB != 1) {
IsBRepAlgoAPI = Standard_False;
#if ! defined(BRepAlgo_def01)
}
gp_Ax2 Cone_Ax;
- double R1=8, R2=16, H1=20, H2=40, angle;
+ double R1=8, R2=16, angle;
gp_Pnt P0(0,0,0),
P1(0,0,20), P2(0,0,45);
angle = 2*M_PI;
return 0;
}
-#if ! defined(WNT)
-//#include <fstream.h>
-#ifdef HAVE_FSTREAM
-# include <fstream>
-#elif defined (HAVE_FSTREAM_H)
-# include <fstream.h>
-#endif
-//#include <Standard_Stream.hxx>
//==========================================================================
//function : CoordLoad
// chargement d une face dans l explorer.
//==========================================================================
-static Standard_Integer coordload (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+static Standard_Integer coordload (Draw_Interpretor& theDi,
+ Standard_Integer theArgsNb,
+ const char** theArgVec)
{
- char line[256];
- char X[30], Y[30];
- int fr;
- TopoDS_Vertex V1,V2;
- TopoDS_Edge Edge;
- TopoDS_Wire Wire;
- TopoDS_Face Face;
-
- if (argc < 3) return 1;
-
- ifstream file(argv[2], ios::in);
- if(!file)
+ if (theArgsNb < 3)
+ {
+ return 1;
+ }
+
+ std::ifstream aFile (theArgVec[2], ios::in);
+ if (!aFile)
+ {
+ theDi << "unable to open " << theArgVec[2] << " for input\n";
+ return 2;
+ }
+
+ char aLine[80];
+ memset (aLine, 0, 40);
+ aFile.getline (aLine, 80);
+
+ gp_Pnt aPnt (0.0, 0.0, 0.0);
+ aLine[40] = '\0';
+ aPnt.SetY (Draw::Atof (&aLine[20]));
+ aLine[20] = '\0';
+ aPnt.SetX (Draw::Atof (aLine));
+ TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex (aPnt);
+ BRepBuilderAPI_MakeWire aMakeWire;
+ for (;;)
+ {
+ memset (aLine, 0, 40);
+ aFile.getline (aLine, 80);
+ if (!aFile)
{
- di<<"unable to open "<<argv[2]<<" for input"<<"\n";
- return 2;
+ break;
}
- BRepBuilderAPI_MakeWire WB;
- file.getline(line,80);
- for(int i=0;i<30;i++) X[i]=Y[i]=0;
- fr = sscanf(line,"%20c%20c",&X,&Y);
- V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
+ aLine[40] = '\0';
+ aPnt.SetY (Draw::Atof (&aLine[20]));
+ aLine[20] = '\0';
+ aPnt.SetX (Draw::Atof (aLine));
+ TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex (aPnt);
+ aMakeWire.Add (BRepBuilderAPI_MakeEdge (aVert1, aVert2));
+ aVert1 = aVert2;
+ }
+ aFile.close();
- for(;;)
- {
- file.getline(line,80);
- if (!file) break;
- for(int i=0;i<30;i++) X[i]=Y[i]=0;
- fr = sscanf(line,"%20c%20c",&X,&Y);
- V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
- Edge = BRepBuilderAPI_MakeEdge(V1,V2);
- WB.Add(Edge);
- V1=V2;
+ if (!aMakeWire.IsDone())
+ {
+ DBRep::Set (theArgVec[1], TopoDS_Face());
+ return 0;
}
-
- file.close();
- if (WB.IsDone()) Wire = WB.Wire();
- Face = BRepBuilderAPI_MakeFace(Wire);
- DBRep::Set (argv[1],Face);
+ BRepBuilderAPI_MakeFace aMakeFace (aMakeWire.Wire());
+ DBRep::Set (theArgVec[1], aMakeFace.IsDone() ? aMakeFace.Face() : TopoDS_Face());
return 0;
}
-#endif
static Standard_Integer TestMem (Draw_Interpretor& /*di*/,
Standard_Integer /*nb*/,
TopoDS_Shape aShape = DBRep::Get(argv[1]);
Handle(AIS_InteractiveObject) anIO = new AIS_Shape(aShape);
// Handle(AIS_InteractiveObject) anIOa = ViewerTest::GetAISShapeFromName(argv[1]);
- anIO->SetHilightMode((argc == 3) ? atoi(argv[2]) : 1);
+ anIO->SetHilightMode((argc == 3) ? Draw::Atoi(argv[2]) : 1);
aContext->Display(anIO);
return 0;
}
}
Standard_Boolean IsBRepAlgoAPI = Standard_True;
if (argc == 2) {
- Standard_Integer IsB = atoi(argv[1]);
+ Standard_Integer IsB = Draw::Atoi(argv[1]);
if (IsB != 1) {
IsBRepAlgoAPI = Standard_False;
#if ! defined(BRepAlgo_def01)
Handle(Dico_DictionaryOfInteger) aDico = new Dico_DictionaryOfInteger();
Handle(TColStd_HSequenceOfAsciiString) aSequence = new TColStd_HSequenceOfAsciiString;
Standard_CString aString;
- Standard_Integer i=1,j=1,k=1,l=1,aa=1;
+ Standard_Integer i=1,j=1,l=1,aa=1;
TopExp_Explorer expl;
Standard_Real f3d,l3d;
for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
}
Standard_Boolean IsBRepAlgoAPI = Standard_True;
if (argc == 2) {
- Standard_Integer IsB = atoi(argv[1]);
+ Standard_Integer IsB = Draw::Atoi(argv[1]);
if (IsB != 1) {
IsBRepAlgoAPI = Standard_False;
#if ! defined(BRepAlgo_def01)
Handle(TPrsStd_AISPresentation) prs;
if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
if( argc == 4 ) {
- prs->SetWidth(atof(argv[3]));
+ prs->SetWidth(Draw::Atof(argv[3]));
TPrsStd_AISViewer::Update(L);
}
else {
}
Standard_Boolean IsBRepAlgoAPI = Standard_True;
if (argc == 3) {
- Standard_Integer IsB = atoi(a[2]);
+ Standard_Integer IsB = Draw::Atoi(a[2]);
if (IsB != 1) {
IsBRepAlgoAPI = Standard_False;
#if ! defined(BRepAlgo_def01)
theCommands.Add("PRO19626","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);
theCommands.Add("BUC60574","BUC60574 ",__FILE__,BUC60574,group);
- theCommands.Add("BUC60698","BUC60698 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60698,group);
-
theCommands.Add("BUC60699","BUC60699 ",__FILE__,BUC60699,group);
theCommands.Add("GER61394","GER61394 [1/0]",__FILE__,GER61394,group);
theCommands.Add("GER61351","GER61351 name/object name/r g b/object r g b",__FILE__,setcolor,group);
theCommands.Add("BUC60856","BUC60856",__FILE__,BUC60856,group);
-#if ! defined(WNT)
theCommands.Add("coordload","load coord from file",__FILE__,coordload);
-#endif
theCommands.Add("TestMem","TestMem",__FILE__,TestMem,group);
theCommands.Add("BUC60945","BUC60945",__FILE__,TestMem,group);