#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Graphic3d_ClipPlane.hxx>
-#include <tcl.h>
#include <fstream>
return 0;
}
-
-#if ! defined(WNT)
-void stringerror(int state)
-{
- printf("%s",((state&ios::eofbit) !=0)? " [eof]": "");
- printf("%s",((state&ios::failbit)!=0)? " [fail]":"");
- printf("%s",((state&ios::badbit) !=0)? " [bad]": "");
- printf("%s\n",(state==ios::goodbit)? " [ok]": "");
-}
-
-
-//#if defined(LIN)
-//#include <strstream>
-//#else
-//#include <strstream.h>
-//#endif
-#ifdef HAVE_IOSTREAM
-#include <iostream>
-#include <sstream>
-using namespace std;
-#elif defined (HAVE_IOSTREAM_H)
-#include <iostream.h>
-#include <strstream.h>
-#else
-#error "check config.h file or compilation options: either HAVE_IOSTREAM or HAVE_IOSTREAM_H should be defined"
-#endif
-static int UKI61075(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/) {
- double da,db;
- char buffer1[128];
-#ifndef USE_STL_STREAM
- ostrstream stringout1(buffer1,sizeof(buffer1));
- istrstream stringin1(buffer1,sizeof(buffer1));
-#else
- ostringstream stringout1(buffer1);
- istringstream stringin1(buffer1);
-#endif
- char buffer2[128];
-#ifndef USE_STL_STREAM
- ostrstream stringout2(buffer2,sizeof(buffer2));
- istrstream stringin2(buffer2,sizeof(buffer2));
-#else
- ostringstream stringout2(buffer1);
- istringstream stringin2(buffer1);
-#endif
-
- stringout1.precision(17);
- stringout2.precision(17);
-
- da=-(DBL_MAX);
- db=DBL_MAX;
- printf("Valeurs originales :\n\t%.17lg %.17lg\n",da,db);
-
- stringout1<<da<<' '<<db<<"\n";
-#ifndef USE_STL_STREAM
- buffer1[stringout1.pcount()]='\0';
-#else
- buffer1[stringout1.str().length()]= '\0' ;
-#endif
-
- printf("Valeurs ecrites dans le fichier :\n\t%s",buffer1);
-
- da=db=0.;
- stringin1>>da>>db;
- printf("Valeurs relues :\n\t%.17lg %.17lg",da,db);
- stringerror(stringin1.rdstate());
-
- stringout2<<da<<' '<<db<<"\n";
-#ifndef USE_STL_STREAM
- buffer2[stringout2.pcount()]='\0';
-#else
- buffer2[stringout2.str().length()]='\0';
-#endif
-
- printf("Valeurs reecrites :\n\t%s",buffer2);
-
- da=db=0.;
- stringin2>>da>>db;
- printf("Valeurs relues a nouveau :\n\t%.17lg %.17lg",da,db);
- stringerror(stringin2.rdstate());
-
- return(0);
-}
-#endif
-
-#include<BRepAlgoAPI_Section.hxx>
-#include<BRepAlgo_Section.hxx>
-
-#include<Geom_Plane.hxx>
-#include<DrawTrSurf.hxx>
-
-//static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane]";
-static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane] [BRepAlgoAPI/BRepAlgo = 1/0]";
-
-static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-
- //if(argc<2) {
- // cerr << "Usage : " << argv[0] << St << endl;
- // return -1;
- //}
- if(argc < 2 || argc > 6) {
- di << "Usage : " << argv[0] << " shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
- return 1;
- }
- Standard_Boolean IsBRepAlgoAPI = Standard_True;
- if (argc == 6) {
- Standard_Integer IsB = Draw::Atoi(argv[5]);
- if (IsB != 1) {
- IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def04)
-// di << "Error: There is not BRepAlgo_Section class" << "\n";
-// return 1;
-#endif
- }
- }
-
-
- gp_Dir N;
- if(!strcmp(argv[1],"trimsphere")) {
-//////////////////////////////////////////
-// Uncomment for trimmed sphere bug:
-// filename = "trimsphere.topo";
- N=gp_Dir( 0.0, -1.0, 0.0 );
-//////////////////////////////////////////
- } else if(!strcmp(argv[1],"sphere")) {
-
-//////////////////////////////////////////
-// Uncomment for untrimmed sphere bug:
-
-// filename="sphere.topo";
- N=gp_Dir( 0.0, -0.75103523489975432, -0.66026212668838646 );
-
-//////////////////////////////////////////
- } else {
- di << "Usage : " << argv[0] << St << "\n";
- return -1;
- }
-
- // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
- const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
- Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
-
- Standard_Character *filename = new Standard_Character [strlen(DD)+17];
- Sprintf(filename,"%s/%s.topo",DD,argv[1]);
-
- filebuf fic;
- istream in(&fic);
- if (!fic.open(filename,ios::in)) {
- di << "Cannot open file for reading : " << filename << "\n";
- delete [] filename;
- return -1;
- }
-
- // Read in the shape
-
- BRep_Builder B;
- BRepTools_ShapeSet S(B);
- S.Read(in);
- TopoDS_Shape theShape;
- S.Read(theShape,in);
-
- // Create the plane
-
- gp_Pnt O( 2036.25, -97.5, -1460.499755859375 );
- gp_Dir A( 1.0, 0.0, 0.0 );
-
- gp_Ax3 PLA( O, N, A );
- gp_Pln Pl(PLA);
-
- // Perform the section
-
-//#if ! defined(BRepAlgoAPI_def01)
-// BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
-//#else
-// BRepAlgo_Section Sec( theShape, Pl, Standard_False);
-//#endif
-
- TopoDS_Shape res;
-
- try{
- OCC_CATCH_SIGNALS
-// Sec.Approximation(Standard_True);
-
- //Sec.Build();
- //if(!Sec.IsDone()){
- // cout << "Error performing intersection: not done." << endl;
- // delete filename;
- // return -1;
- //}
- //res = Sec.Shape();
-
- if (IsBRepAlgoAPI) {
- di << "BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False)" <<"\n";
- BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
- Sec.Build();
- if(!Sec.IsDone()){
- di << "Error performing intersection: not done." << "\n";
- delete [] filename;
- return -1;
- }
- res = Sec.Shape();
- } else {
- di << "BRepAlgo_Section Sec( theShape, Pl, Standard_False)" <<"\n";
- BRepAlgo_Section Sec( theShape, Pl, Standard_False);
- Sec.Build();
- if(!Sec.IsDone()){
- di << "Error performing intersection: not done." << "\n";
- delete [] filename;
- return -1;
- }
- res = Sec.Shape();
- }
-
- }catch(Standard_Failure){
- Handle(Standard_Failure) error = Standard_Failure::Caught();
- di << "Error performing intersection: not done." << "\n";
- delete [] filename;
- return -1;
- }
-
- if(argc>3) DBRep::Set(argv[3],theShape);
-
- if(argc>2) DBRep::Set(argv[2],res);
-
- if(argc>4) {
- Handle(Geom_Geometry) result;
- Handle(Geom_Plane) C = new Geom_Plane(Pl);
- result=C;
- DrawTrSurf::Set(argv[4],result);
- }
-
- di << "Done" << "\n";
-
- delete [] filename;
-
- return 0;
-}
-
-#include<TopoDS_Compound.hxx>
-
-static int BUC60547(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
- if(argc!=2) {
- di << "Usage : " << argv[0] << " name" << "\n";
- return -1;
- }
-
- Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
- if(myAISContext.IsNull()) {
- di << "use 'vinit' command before " << argv[0] << "\n";
- return -1;
- }
-
- // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
- const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
- Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
-
- Standard_Character *Ch = new Standard_Character[strlen(argv[1])+3];
-
- Standard_Character *FileName = new Standard_Character[strlen(DD)+13];
-
- TopoDS_Shape free_1,free_2,free_3,free_4;
- BRep_Builder B;
- Sprintf(FileName,"%s/%s",DD,"buc60547a.brep");
- BRepTools::Read(free_1,FileName,B);
- Sprintf(FileName,"%s/%s",DD,"buc60547b.brep");
- BRepTools::Read(free_2,FileName,B);
- Sprintf(FileName,"%s/%s",DD,"buc60547c.brep");
- BRepTools::Read(free_3,FileName,B);
- Sprintf(FileName,"%s/%s",DD,"buc60547d.brep");
- BRepTools::Read(free_4,FileName,B);
- Sprintf(Ch,"%s_%i",argv[1],1);
- DBRep::Set(Ch,free_1);
- di << Ch << " ";
- Sprintf(Ch,"%s_%i",argv[1],2);
- DBRep::Set(Ch,free_2);
- di << Ch << " ";
- Sprintf(Ch,"%s_%i",argv[1],3);
- DBRep::Set(Ch,free_3);
- di << Ch << " ";
- Sprintf(Ch,"%s_%i",argv[1],4);
- DBRep::Set(Ch,free_4);
- di << Ch << " ";
-
-// Handle(AIS_Shape) S1 = new AIS_Shape(free_1);
-// Handle(AIS_Shape) S2 = new AIS_Shape(free_2);
-// Handle(AIS_Shape) S3 = new AIS_Shape(free_3);
-// Handle(AIS_Shape) S4 = new AIS_Shape(free_4);
-
-// Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-
-// myAISContext->Display(S1);
-// myAISContext->Display(S2);
-// myAISContext->Display(S3);
-// myAISContext->Display(S4);
-
-// di.Eval("vfit");
-
- TopoDS_Compound Com;
- BRep_Builder bui;
- bui.MakeCompound(Com);
- bui.Add(Com,free_1);
- bui.Add(Com,free_2);
- bui.Add(Com,free_3);
- bui.Add(Com,free_4);
-
- 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");
-
- BRepTools::Write(Com,FileName);
-
- delete [] Ch;
- delete [] FileName;
-
- return 0;
-}
-
#include<BRepBuilderAPI_MakeVertex.hxx>
#include<TCollection_ExtendedString.hxx>
#include<AIS_LengthDimension.hxx>
theCommands.Add("BUC60569","BUC60569 shape",__FILE__,BUC60569,group);
theCommands.Add("BUC60614","BUC60614 shape",__FILE__,BUC60614,group);
theCommands.Add("BUC60609","BUC60609 shape name [U V]",__FILE__,BUC60609,group);
-#if ! defined(WNT)
- theCommands.Add("UKI61075","UKI61075",__FILE__,UKI61075,group);
-#endif
- theCommands.Add("BUC60585",St,__FILE__,BUC60585,group);
- theCommands.Add("BUC60547","BUC60547 name",__FILE__,BUC60547,group);
theCommands.Add("BUC60632","BUC60632 mode length",__FILE__,BUC60632,group);
theCommands.Add("BUC60652","BUC60652 face",__FILE__,BUC60652,group);
theCommands.Add("ksection","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);