Integration of OCCT 6.5.0 from SVN
[occt.git] / src / QABUC / QABUC.cxx
CommitLineData
7fd59977 1// File: QABUC.cxx
2// Created: Mon Jun 17 10:49:11 2002
3// Author: QA Admin
4// <qa@russox>
5
6#include <QABUC.hxx>
7#ifdef HAVE_CONFIG_H
8#include <config.h>
9#endif
10#include<Draw_Interpretor.hxx>
11#include<TopLoc_Location.hxx>
12#include<TopoDS_Face.hxx>
13#include<TopoDS.hxx>
14#include<DBRep.hxx>
15#include<Geom_Surface.hxx>
16#include<BRep_Tool.hxx>
17#include<GeomInt_IntSS.hxx>
18#include<BRepBuilderAPI_MakeEdge.hxx>
19#include <Standard_ErrorHandler.hxx>
20#include<tcl.h>
21
22static int BUC60623(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
23{
24 if(argc!=4)
25 {
26 di << "Usage : " << a[0] << " result Shape1 Shape2" << "\n";
27 return -1;
28 }
29
30 TopLoc_Location L1;
31 TopLoc_Location L2;
32 TopoDS_Face F1 = TopoDS::Face(DBRep::Get(a[2],TopAbs_FACE));
33 TopoDS_Face F2 = TopoDS::Face(DBRep::Get(a[3],TopAbs_FACE));
34 Handle(Geom_Surface) GSF1 = BRep_Tool::Surface(F1, L1);
35 Handle(Geom_Surface) GSF2 = BRep_Tool::Surface(F2, L2);
36 GeomInt_IntSS Inter;
37 Inter.Perform(GSF1,GSF2, BRep_Tool::Tolerance(F1));
38 if (!Inter.IsDone()) {
39 di << "Intersection not done" << "\n";
40 return 1;
41 }
42 Standard_Integer nbsol = Inter.NbLines();
43 if(!nbsol) {
44 di << "The number of solutions is zero!" << "\n";
45 return 0;
46 }
47 Handle(Geom_Curve) Sol = Inter.Line(1);
48 if(!Sol.IsNull()) {
49 DBRep::Set(a[1], BRepBuilderAPI_MakeEdge(Sol));
50 return 0;
51 } else di << "The first solution is Null!" << "\n";
52
53 di << "fini" << "\n";
54 return 0;
55}
56
57#include<ViewerTest.hxx>
58#include<AIS_InteractiveContext.hxx>
59#include<AIS_Shape.hxx>
60
61static int BUC60569(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
62{
63 if(argc!=2)
64 {
65 di << "Usage : " << argv[0] << " shape" << "\n";
66 return -1;
67 }
68
69 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
70 if(myAISContext.IsNull()) {
71 di << "use 'vinit' command before " << argv[0] << "\n";
72 return -1;
73 }
74
75 TopoDS_Shape theShape = DBRep::Get(argv[1]);
76
77 Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape );
78 myAISContext->Display( anAISShape, Standard_True );
79 myAISContext->OpenLocalContext();
80 myAISContext->ActivateStandardMode(TopAbs_FACE);
81 return 0;
82}
83
84static int BUC60614(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
85{
86 if(argc!=2)
87 {
88 di << "Usage : "<< argv[0] << " shape" << "\n";
89 return -1;
90 }
91
92 // di.Eval("vinit");
93
94 TopoDS_Shape theShape = DBRep::Get(argv[1]);
95
96// ViewerTest::GetAISContext();
97 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
98 if(myAISContext.IsNull()) {
99 di << "use 'vinit' command before " << argv[0] << "\n";
100 return -1;
101 }
102 Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape );
103 myAISContext->Display( anAISShape, Standard_True );
104 myAISContext->OpenLocalContext();
105 myAISContext->ActivateStandardMode(TopAbs_COMPOUND);
106// myAISContext->ActivateStandardMode(TopAbs_SOLID);
107// di.Eval("vfit");
108// cout << "vfini" << endl;
109 return 0;
110}
111
112#include<BRep_Builder.hxx>
113#include<BRepTools_ShapeSet.hxx>
114#include<BRepTools.hxx>
115#include<BRepAdaptor_HSurface.hxx>
116#include<TopOpeBRep_PointClassifier.hxx>
117#include<Precision.hxx>
118#ifdef WNT
119#include<stdio.h>
120#endif
121
122static int BUC60609(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
123// char file1[100];
124 gp_Pnt2d uvSurf;
125 double U,V;
126 TopAbs_State state;
127
128 if(argc < 2){
129 printf("Usage: %s draw_format_face\n [name] [interactive (0|1)]",argv[0]);
130 return(-1);
131 }
132
133 // MKV 30.03.05
134#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
135 const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
136#else
137 Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
138#endif
139
140 Standard_Character *file1 = new Standard_Character [strlen(DD)+strlen(argv[1])+2];
141 sprintf(file1,"%s/%s",DD,argv[1]);
142
143 filebuf fic;
144 istream in(&fic);
145 if (!fic.open(file1,ios::in)) {
146 di << "Cannot open file for reading : " << file1 << "\n";
147 delete file1;
148 return(-1);
149 }
150
151 TopoDS_Shape theShape;
152 char typ[255];
153 in >> typ;
154 if (!in.fail()) {
155 if( !strcmp(typ, "DBRep_DrawableShape") ){
156 BRep_Builder B;
157 BRepTools_ShapeSet S(B);
158 S.Read(in);
159 S.Read(theShape,in);
160 }else{
161 di << "Wrong entity type in " << file1 << "\n";
162 delete file1;
163 return(-1);
164 }
165 }
166
167 const TopoDS_Face &face = TopoDS::Face (theShape);
168
169 if(argc > 2){
170 DBRep::Set(argv[2],face);
171 }
172
173 Standard_Boolean inter=Standard_False ;
174
175 if(argc > 3){
176 inter= (atof(argv[3]) == 0) ? Standard_False : Standard_True ;
177 }
178
179 Standard_Real faceUMin,faceUMax,faceVMin,faceVMax;
180
181 BRepTools::UVBounds (face, faceUMin,faceUMax,faceVMin,faceVMax);
182
183 di << "The bounds of the trimmed face:" << "\n";
184 di << faceUMin << " <= U <= " << faceUMax << "\n";
185 di << faceVMin << " <= V <= " << faceVMax << "\n";
186
187 Handle(BRepAdaptor_HSurface) hsurfa = new BRepAdaptor_HSurface(face);
188
189 TopOpeBRep_PointClassifier PClass;
190
191 di << "Now test the point classifier by inputting U,V values" << "\n";
192 di << "inside or outside the bounds displayed above" << "\n";
193 di << "Type stop to exit" << "\n";
194
195 // Please register this:
196 // ***********************************************
197 // Note also that for periodic surfaces such as nimpod_1.topo,
198 // the U/V values may be +- 2pi compared to the actual face bounds
199 // (because U,V is probably coming from a Geom package routine).
200 // Hence IT WOULD BE USEFUL IF TopOpeBRep_PointClassifier COULD
201 // COPE WITH PERIODIC SURFACES, i.e. U,V +-Period giving same result.
202 // *************************************************
203 if(inter && (argc != 6)) {
204// while(cin){
205 di << "Input U: " << "\n";
206// cin >> U;
207// if(!cin) {
208 delete file1;
209 return(0);
210// }
211 di << "Input V: " << "\n";
212// cin >> V;
213// if(!cin) {
214 delete file1;
215 return(0);
216// }
217
218 uvSurf = gp_Pnt2d(U, V);
219
220 //gp_Pnt2d uvSurf(0.14,5.1); // outside!!!
221 //gp_Pnt2d uvSurf2(1.28,5.1); // inside
222
223 state = PClass.Classify(face,uvSurf,Precision::PConfusion());
224 if(state == TopAbs_IN || state == TopAbs_ON){
225 di << "U=" << U << " V=" << V << " classified INSIDE" << "\n";
226 }else{
227 di << "U=" << U << " V=" << V << " classified OUTSIDE" << "\n";
228 }
229// }
230 } else {
231 if(argc != 6) {
232 uvSurf = gp_Pnt2d(0.14,5.1);
233 state = PClass.Classify(face,uvSurf,Precision::PConfusion());
234 if(state == TopAbs_IN || state == TopAbs_ON){
235 di << "U=" << 0.14 << " V=" << 5.1 << " classified INSIDE" << "\n";
236 }else{
237 di << "U=" << 0.14 << " V=" << 5.1 << " classified OUTSIDE" << "\n";
238 }
239
240 uvSurf = gp_Pnt2d(1.28,5.1);
241 state = PClass.Classify(face,uvSurf,Precision::PConfusion());
242 if(state == TopAbs_IN || state == TopAbs_ON){
243 di << "U=" << 1.28 << " V=" << 5.1 << " classified INSIDE" << "\n";
244 }else{
245 di << "U=" << 1.28 << " V=" << 5.1 << " classified OUTSIDE" << "\n";
246 }
247 } else {
248 uvSurf = gp_Pnt2d(atof(argv[4]),atof(argv[5]));
249 state = PClass.Classify(face,uvSurf,Precision::PConfusion());
250 if(state == TopAbs_IN || state == TopAbs_ON){
251 di << "U=" << atof(argv[4]) << " V=" << atof(argv[5]) << " classified INSIDE" << "\n";
252 }else{
253 di << "U=" << atof(argv[4]) << " V=" << atof(argv[5]) << " classified OUTSIDE" << "\n";
254 }
255 }
256 }
257 return 0;
258}
259
260#if ! defined(WNT)
261void stringerror(int state)
262{
263 printf("%s",((state&ios::eofbit) !=0)? " [eof]": "");
264 printf("%s",((state&ios::failbit)!=0)? " [fail]":"");
265 printf("%s",((state&ios::badbit) !=0)? " [bad]": "");
266 printf("%s\n",(state==ios::goodbit)? " [ok]": "");
267}
268
269
270//#if defined(LIN)
271//#include <strstream>
272//#else
273//#include <strstream.h>
274//#endif
275#ifdef HAVE_IOSTREAM
276#include <iostream>
277#include <sstream>
278using namespace std;
279#elif defined (HAVE_IOSTREAM_H)
280#include <iostream.h>
281#include <strstream.h>
282#else
283#error "check config.h file or compilation options: either HAVE_IOSTREAM or HAVE_IOSTREAM_H should be defined"
284#endif
285static int UKI61075(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/) {
286 double da,db;
287 char buffer1[128];
288#ifndef USE_STL_STREAM
289 ostrstream stringout1(buffer1,sizeof(buffer1));
290 istrstream stringin1(buffer1,sizeof(buffer1));
291#else
292 ostringstream stringout1(buffer1);
293 istringstream stringin1(buffer1);
294#endif
295 char buffer2[128];
296#ifndef USE_STL_STREAM
297 ostrstream stringout2(buffer2,sizeof(buffer2));
298 istrstream stringin2(buffer2,sizeof(buffer2));
299#else
300 ostringstream stringout2(buffer1);
301 istringstream stringin2(buffer1);
302#endif
303
304 stringout1.precision(17);
305 stringout2.precision(17);
306
307 da=-(DBL_MAX);
308 db=DBL_MAX;
309 printf("Valeurs originales :\n\t%.17lg %.17lg\n",da,db);
310
311 stringout1<<da<<' '<<db<<"\n";
312#ifndef USE_STL_STREAM
313 buffer1[stringout1.pcount()]='\0';
314#else
315 buffer1[stringout1.str().length()]= '\0' ;
316#endif
317
318 printf("Valeurs ecrites dans le fichier :\n\t%s",buffer1);
319
320 da=db=0.;
321 stringin1>>da>>db;
322 printf("Valeurs relues :\n\t%.17lg %.17lg",da,db);
323 stringerror(stringin1.rdstate());
324
325 stringout2<<da<<' '<<db<<"\n";
326#ifndef USE_STL_STREAM
327 buffer2[stringout2.pcount()]='\0';
328#else
329 buffer2[stringout2.str().length()]='\0';
330#endif
331
332 printf("Valeurs reecrites :\n\t%s",buffer2);
333
334 da=db=0.;
335 stringin2>>da>>db;
336 printf("Valeurs relues a nouveau :\n\t%.17lg %.17lg",da,db);
337 stringerror(stringin2.rdstate());
338
339 return(0);
340}
341#endif
342
343#include<BRepAlgoAPI_Section.hxx>
344#include<BRepAlgo_Section.hxx>
345
346#include<Geom_Plane.hxx>
347#include<DrawTrSurf.hxx>
348
349//static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane]";
350static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane] [BRepAlgoAPI/BRepAlgo = 1/0]";
351
352static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
353
354 //if(argc<2) {
355 // cerr << "Usage : " << argv[0] << St << endl;
356 // return -1;
357 //}
358 if(argc < 2 || argc > 6) {
359 di << "Usage : " << argv[0] << " shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
360 return 1;
361 }
362 Standard_Boolean IsBRepAlgoAPI = Standard_True;
363 if (argc == 6) {
364 Standard_Integer IsB = atoi(argv[5]);
365 if (IsB != 1) {
366 IsBRepAlgoAPI = Standard_False;
367#if ! defined(BRepAlgo_def04)
368// di << "Error: There is not BRepAlgo_Section class" << "\n";
369// return 1;
370#endif
371 }
372 }
373
374
375 gp_Dir N;
376 if(!strcmp(argv[1],"trimsphere")) {
377//////////////////////////////////////////
378// Uncomment for trimmed sphere bug:
379// filename = "trimsphere.topo";
380 N=gp_Dir( 0.0, -1.0, 0.0 );
381//////////////////////////////////////////
382 } else if(!strcmp(argv[1],"sphere")) {
383
384//////////////////////////////////////////
385// Uncomment for untrimmed sphere bug:
386
387// filename="sphere.topo";
388 N=gp_Dir( 0.0, -0.75103523489975432, -0.66026212668838646 );
389
390//////////////////////////////////////////
391 } else {
392 di << "Usage : " << argv[0] << St << "\n";
393 return -1;
394 }
395
396 // MKV 30.03.05
397#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
398 const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
399#else
400 Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
401#endif
402
403 Standard_Character *filename = new Standard_Character [strlen(DD)+17];
404 sprintf(filename,"%s/%s.topo",DD,argv[1]);
405
406 filebuf fic;
407 istream in(&fic);
408 if (!fic.open(filename,ios::in)) {
409 di << "Cannot open file for reading : " << filename << "\n";
410 delete filename;
411 return -1;
412 }
413
414 // Read in the shape
415
416 BRep_Builder B;
417 BRepTools_ShapeSet S(B);
418 S.Read(in);
419 TopoDS_Shape theShape;
420 S.Read(theShape,in);
421
422 // Create the plane
423
424 gp_Pnt O( 2036.25, -97.5, -1460.499755859375 );
425 gp_Dir A( 1.0, 0.0, 0.0 );
426
427 gp_Ax3 PLA( O, N, A );
428 gp_Pln Pl(PLA);
429
430 // Perform the section
431
432//#if ! defined(BRepAlgoAPI_def01)
433// BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
434//#else
435// BRepAlgo_Section Sec( theShape, Pl, Standard_False);
436//#endif
437
438 TopoDS_Shape res;
439
440 try{
441 OCC_CATCH_SIGNALS
442// Sec.Approximation(Standard_True);
443
444 //Sec.Build();
445 //if(!Sec.IsDone()){
446 // cout << "Error performing intersection: not done." << endl;
447 // delete filename;
448 // return -1;
449 //}
450 //res = Sec.Shape();
451
452 if (IsBRepAlgoAPI) {
453 di << "BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False)" <<"\n";
454 BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
455 Sec.Build();
456 if(!Sec.IsDone()){
457 di << "Error performing intersection: not done." << "\n";
458 delete filename;
459 return -1;
460 }
461 res = Sec.Shape();
462 } else {
463 di << "BRepAlgo_Section Sec( theShape, Pl, Standard_False)" <<"\n";
464 BRepAlgo_Section Sec( theShape, Pl, Standard_False);
465 Sec.Build();
466 if(!Sec.IsDone()){
467 di << "Error performing intersection: not done." << "\n";
468 delete filename;
469 return -1;
470 }
471 res = Sec.Shape();
472 }
473
474 }catch(Standard_Failure){
475 Handle(Standard_Failure) error = Standard_Failure::Caught();
476 di << "Error performing intersection: not done." << "\n";
477 delete filename;
478 return -1;
479 }
480
481 if(argc>3) DBRep::Set(argv[3],theShape);
482
483 if(argc>2) DBRep::Set(argv[2],res);
484
485 if(argc>4) {
486 Handle(Geom_Geometry) result;
487 Handle(Geom_Plane) C = new Geom_Plane(Pl);
488 result=C;
489 DrawTrSurf::Set(argv[4],result);
490 }
491
492 di << "Done" << "\n";
493
494 delete filename;
495
496 return 0;
497}
498
499#include<TopoDS_Compound.hxx>
500
501static int BUC60547(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
502 if(argc!=2) {
503 di << "Usage : " << argv[0] << " name" << "\n";
504 return -1;
505 }
506
507 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
508 if(myAISContext.IsNull()) {
509 di << "use 'vinit' command before " << argv[0] << "\n";
510 return -1;
511 }
512
513 // MKV 30.03.05
514#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
515 const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
516#else
517 Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
518#endif
519
520 Standard_Character *Ch = new Standard_Character[strlen(argv[1])+3];
521
522 Standard_Character *FileName = new Standard_Character[strlen(DD)+13];
523
524 TopoDS_Shape free_1,free_2,free_3,free_4;
525 BRep_Builder B;
526 sprintf(FileName,"%s/%s",DD,"buc60547a.brep");
527 BRepTools::Read(free_1,FileName,B);
528 sprintf(FileName,"%s/%s",DD,"buc60547b.brep");
529 BRepTools::Read(free_2,FileName,B);
530 sprintf(FileName,"%s/%s",DD,"buc60547c.brep");
531 BRepTools::Read(free_3,FileName,B);
532 sprintf(FileName,"%s/%s",DD,"buc60547d.brep");
533 BRepTools::Read(free_4,FileName,B);
534 sprintf(Ch,"%s_%i",argv[1],1);
535 DBRep::Set(Ch,free_1);
536 di << Ch << " ";
537 sprintf(Ch,"%s_%i",argv[1],2);
538 DBRep::Set(Ch,free_2);
539 di << Ch << " ";
540 sprintf(Ch,"%s_%i",argv[1],3);
541 DBRep::Set(Ch,free_3);
542 di << Ch << " ";
543 sprintf(Ch,"%s_%i",argv[1],4);
544 DBRep::Set(Ch,free_4);
545 di << Ch << " ";
546
547// Handle(AIS_Shape) S1 = new AIS_Shape(free_1);
548// Handle(AIS_Shape) S2 = new AIS_Shape(free_2);
549// Handle(AIS_Shape) S3 = new AIS_Shape(free_3);
550// Handle(AIS_Shape) S4 = new AIS_Shape(free_4);
551
552// Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
553
554// myAISContext->Display(S1);
555// myAISContext->Display(S2);
556// myAISContext->Display(S3);
557// myAISContext->Display(S4);
558
559// di.Eval("vfit");
560
561 TopoDS_Compound Com;
562 BRep_Builder bui;
563 bui.MakeCompound(Com);
564 bui.Add(Com,free_1);
565 bui.Add(Com,free_2);
566 bui.Add(Com,free_3);
567 bui.Add(Com,free_4);
568
569 sprintf(Ch,"%s_%c",argv[1],'c');
570 DBRep::Set(Ch,Com);
571 di << Ch << " ";
572
573 Handle(AIS_Shape) SC = new AIS_Shape(Com);
574 myAISContext->Display(SC); // nothing on the screen If I save the compound :
575
576 sprintf(FileName,"%s/%s",DD,"free.brep");
577
578 BRepTools::Write(Com,FileName);
579
580 delete Ch;
581 delete FileName;
582
583 return 0;
584}
585
586#include<BRepBuilderAPI_MakeVertex.hxx>
587#include<TCollection_ExtendedString.hxx>
588#include<AIS_LengthDimension.hxx>
589
590static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
591{
592
593 Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
594 if(myAIScontext.IsNull()) {
595 di << "use 'vinit' command before " << a[0] << "\n";
596 return -1;
597 }
598 myAIScontext->EraseAll();
599
600 TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(0,0,0));
601 TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(10,10,0));
602
603 Handle(AIS_Shape) Ve1 = new AIS_Shape(V1);
604 Handle(AIS_Shape) Ve2 = new AIS_Shape(V2);
605
606 myAIScontext->Display(Ve1);
607 myAIScontext->Display(Ve2);
608
609 Handle(Geom_Plane) Plane1 = new Geom_Plane(gp_Pnt(0,0,0),gp_Dir(0,0,1));
610 TCollection_ExtendedString Ext1("Dim1");
611 Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,atof(a[2]),Ext1);
612
613 myAIScontext->SetDisplayMode(Dim1, atof(a[1]));
614 myAIScontext->Display(Dim1);
615 return 0;
616}
617
618#include<TopoDS_Wire.hxx>
619
620static Standard_Integer BUC60652(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
621{
622 if(argc!=2) {
623 di << "Usage : BUC60652 fase" << "\n";
624 return 1;
625 }
626 TopoDS_Shape shape = DBRep::Get( argv[1] );
627 TopoDS_Face face = TopoDS::Face( shape );
628 TopoDS_Wire ow = BRepTools::OuterWire( face );
629 DBRep::Set( "w", ow );
630 return 0;
631}
632
633#include <BRepAlgo_BooleanOperations.hxx>
634
635static Standard_Integer defNbPntMax = 30;
636static Standard_Real defTol3d = 1.e-7;
637static Standard_Real defTol2d = 1.e-7;
638static Standard_Boolean defRelativeTol=Standard_True;
639Standard_Integer NbPntMax = defNbPntMax;
640Standard_Real Toler3d =defTol3d;
641Standard_Real Toler2d = defTol2d;
642Standard_Boolean RelativeTol= defRelativeTol;
643// //== // ksection : operateur section appelant BRepAlgo_BooleanOperation
644//== // ksection : operateur section appelant BRepAlgo_BooleanOperations
645//=======================================================================
646Standard_Integer ksection(Draw_Interpretor& di, Standard_Integer n, const char ** a) {
647 if (n < 8) {
648 di << "Usage : " << a[0] << " resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol" << "\n";
649 return -1;
650 }
651 // a[1]= resultat
652 // a[2]= shell1
653 // a[3]= shell2
654 // a[4]= NbPntMax
655 // a[5]= Toler3d
656 // a[6]= Toler2d
657 // a[7]= RelativeTol
658 TopoDS_Shape s1 = DBRep::Get(a[2],TopAbs_SHELL);
659 TopoDS_Shape s2 = DBRep::Get(a[3],TopAbs_SHELL);
660 if (s1.IsNull() || s2.IsNull()) return 1;
661 NbPntMax=atoi(a[4]);
662 Toler3d=atof(a[5]);
663 Toler2d=atof(a[6]);
664 RelativeTol=atoi(a[7]);
665
666 di << "BRepAlgo_BooleanOperations myalgo" << "\n";
667 BRepAlgo_BooleanOperations myalgo;
668
669 myalgo.Shapes(s1, s2);
670 myalgo.SetApproxParameters(NbPntMax,Toler3d,Toler2d,RelativeTol);
671 TopoDS_Shape res; res = myalgo.Section();
672 DBRep::Set(a[1],res);
673 return 0;
674}
675
676#include <Geom_Axis2Placement.hxx>
677#include <AIS_Trihedron.hxx>
678
679static Standard_Integer BUC60574(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
680{
681
682 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
683 if(myAISContext.IsNull()) {
684 di << "use 'vinit' command before " << a[0] << "\n";
685 return -1;
686 }
687
688 Handle(Geom_Axis2Placement) atrihedronAxis = new Geom_Axis2Placement(gp::XOY());
689 Handle(AIS_Trihedron) atri = new AIS_Trihedron(atrihedronAxis);
690 gp_Trsf aTrsf;
691 gp_Vec trans(5,5,5);
692 aTrsf.SetTranslation(trans);
693 TopLoc_Location aLoc(aTrsf);
694 myAISContext->SetLocation(atri,aLoc);
695 myAISContext->Display(atri,0,-1,Standard_True, Standard_True);
696 myAISContext->OpenLocalContext(Standard_False,
697 Standard_True,Standard_False,Standard_False);
698 myAISContext->Load(atri,3,Standard_True);
699
700 return 0;
701}
702
703#include <TopoDS_Solid.hxx>
704#include <BRepPrimAPI_MakeBox.hxx>
705#include <BRepPrimAPI_MakeSphere.hxx>
706
707#include <BRepAlgoAPI_Fuse.hxx>
708#include <BRepAlgo_Fuse.hxx>
709
710#include <V3d_Plane.hxx>
711#include <V3d_View.hxx>
712#include <gce_MakePln.hxx>
713
714static Standard_Integer BUC60698(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
715{
716 if(argc > 2) {
717 di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
718 return 1;
719 }
720 Standard_Boolean IsBRepAlgoAPI = Standard_True;
721 if (argc == 2) {
722 Standard_Integer IsB = atoi(a[1]);
723 if (IsB != 1) {
724 IsBRepAlgoAPI = Standard_False;
725#if ! defined(BRepAlgo_def01)
726// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
727// return 1;
728#endif
729 }
730 }
731
732 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
733 if(myAISContext.IsNull()) {
734 di << "use 'vinit' command before " << a[0] << "\n";
735 return -1;
736 }
737 TopoDS_Solid box = BRepPrimAPI_MakeBox(1,1,1).Solid();
738 TopoDS_Shape sphere = BRepPrimAPI_MakeSphere(gp_Pnt(0.5,0.5,0.5),0.6).Shape();
739
740//#if ! defined(BRepAlgoAPI_def01)
741// TopoDS_Shape fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
742//#else
743// TopoDS_Shape fuse = BRepAlgo_Fuse(box,sphere).Shape();
744//#endif
745
746 TopoDS_Shape fuse;
747 if (IsBRepAlgoAPI) {
748 di << "fuse = BRepAlgoAPI_Fuse(box,sphere).Shape()" <<"\n";
749 fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
750 } else {
751 di << "fuse = BRepAlgo_Fuse(box,sphere).Shape()" <<"\n";
752 fuse = BRepAlgo_Fuse(box,sphere).Shape();
753 }
754
755 Handle_AIS_Shape theAISShape = new AIS_Shape(fuse);
756 myAISContext->Display(theAISShape);
757 di.Eval("vfit");
758 gp_Pln thegpPln = gce_MakePln(gp_Pnt(0.5,0.5,0.5),gp_Dir(0,0,1));
759 Standard_Real A,B,C,D;
760 thegpPln.Coefficients(A,B,C,D);
761 Handle_V3d_Plane thePlane = new V3d_Plane(myAISContext->CurrentViewer(),A,B,C,D);
762 for (myAISContext->CurrentViewer()->InitActiveViews();
763 myAISContext->CurrentViewer()->MoreActiveViews ();
764 myAISContext->CurrentViewer()->NextActiveViews ()) {
765 try {
766 OCC_CATCH_SIGNALS
767 myAISContext->CurrentViewer()->ActiveView()->SetPlaneOn(thePlane);
768 }
769 catch(Standard_Failure) {
770 di << "SetPlaneOn catched 1" << "\n";
771 }
772#ifdef WNT
773 catch(...) {
774 di << "SetPlaneOn catched 1" << "\n";
775 }
776#endif
777 }//ActiveView loop
778 for (myAISContext->CurrentViewer()->InitDefinedViews();
779 myAISContext->CurrentViewer()->MoreDefinedViews ();
780 myAISContext->CurrentViewer()->NextDefinedViews ()) {
781 try {
782 OCC_CATCH_SIGNALS
783 myAISContext->CurrentViewer()->DefinedView()->SetPlaneOn(thePlane);
784 }
785 catch(Standard_Failure) {
786 di << "SetPlaneOn catched 1" << "\n";
787 }
788#ifdef WNT
789 catch(...) {
790 di << "SetPlaneOn catched 2" << "\n";
791 }
792#endif
793 }//DefinedView loop
794 myAISContext->UpdateCurrentViewer();
795 myAISContext->OpenLocalContext();
796 myAISContext->ActivateStandardMode(TopAbs_FACE);
797 return 0;
798}
799
800static Standard_Integer BUC60699(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
801{
802
803 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
804 if(myAISContext.IsNull()) {
805 di << "use 'vinit' command before " << a[0] << "\n";
806 return -1;
807 }
808 TopoDS_Solid B1 = BRepPrimAPI_MakeBox (1,1,1).Solid();
809 TopAbs_ShapeEnum theType = B1.ShapeType();
810 if ( theType == TopAbs_SOLID ) {
811 di << "It is a solid." << "\n";
812 } else {
813 di << "It is not solid." << "\n";
814 }
815 myAISContext->Display(new AIS_Shape(B1));
816 myAISContext->OpenLocalContext();
817 TopAbs_ShapeEnum amode = TopAbs_SOLID;
818 myAISContext->ActivateStandardMode(amode);
819 di.Eval("vfit");
820 di.Eval("QAMoveTo 200 200");
821 di.Eval("QASelect 200 200");
822 myAISContext->InitSelected() ;
823 if ( myAISContext->MoreSelected() ) {
824 if (myAISContext->HasSelectedShape() ) {
825 di << "has selected shape : OK" << "\n";
826 } else {
827 di << "has selected shape : bugged - Faulty " << "\n";
828 }
829 }
830 return 0;
831}
832
833static Standard_Integer GER61394(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
834{
835 if(argc > 2) {
836 di << "Usage : " << argv[0] << " [1/0]" << "\n";
837 return -1;
838 }
839
840 Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
841 if(myAIScontext.IsNull()) {
842 di << "use 'vinit' command before " << argv[0] << "\n";
843 return -1;
844 }
845 Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
846
847 if((argc == 2) && (atof(argv[1]) == 0))
848 myV3dView->SetAntialiasingOff();
849 else
850 myV3dView->SetAntialiasingOn();
851 myV3dView->Update();
852 return 0;
853}
854
855
856#define DEFAULT_COLOR Quantity_NOC_GOLDENROD
857
858//=======================================================================
859//function : GetColorFromName
860//purpose : get the Quantity_NameOfColor from a string
861//=======================================================================
862
863static Quantity_NameOfColor GetColorFromName( const char *name )
864{
865 Quantity_NameOfColor ret = DEFAULT_COLOR;
866
867 Standard_Boolean Found = Standard_False;
868 Standard_CString colstring;
869 for(Standard_Integer i=0;i<=514 && !Found;i++)
870 {
871 colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
872 if (!strcasecmp(name,colstring)) {
873 ret = (Quantity_NameOfColor)i;
874 Found = Standard_True;
875 }
876 }
877
878 return ret;
879}
880
881static Standard_Integer setcolor (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
882{
883
884Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
885if(myAISContext.IsNull()) {
886 di << "use 'vinit' command before " << argv[0] << "\n";
887 return -1;
888 }
889
890Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
891
892switch (argc){
893
894 case 2:
895 {
896 di <<"case 2 : This command will change the background color to " << argv[1]<< "\n";
897// setcolor <name>
898// Change the background color of the view with a predefined name Graphic3d_NOC_<name>
899
900 myV3dView -> SetBackgroundColor(GetColorFromName(argv[1]));
901 myV3dView -> Redraw();
902 break;
903 }
904
905 case 3:
906 {
907 di <<"case 3 : This command will change the color of the objects to "<< argv[2]<< "\n";
908// setcolor <object> <name>
909// Change the object color with a predefined name
910
911 TopoDS_Shape aShape = DBRep::Get(argv[1]);
912 Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape);
913 myAISContext->SetColor(myShape,GetColorFromName(argv[2]),Standard_True);
914 myAISContext->Display(myShape,Standard_True);
915 myAISContext->UpdateCurrentViewer();
916// return 0;
917 break;
918 }
919 case 4:
920 {
921 di <<"case 4 : This command will change the background color to <r> <g> <b> :"<< argv[1] << argv[2] << argv[3] << "\n";
922
923// setcolor <r> <g> <b>
924// Change the background color of the view with the color values <r>,<g>,<b>
925// A color value must be defined in the space [0.,1.]
926
927 Standard_Real QuantityOfRed = atoi(argv[1]);
928 Standard_Real QuantityOfGreen = atoi(argv[2]);
929 Standard_Real QuantityOfBlue = atoi(argv[3]);
930 myV3dView->SetBackgroundColor(Quantity_TOC_RGB,QuantityOfRed,QuantityOfGreen,QuantityOfBlue);
931 myV3dView->Redraw();
932 break;
933 }
934
935 case 5:
936 {
937 di <<"case 5 : This command will change the color of the objects to <r> <g> <b> : "<<argv[2]<< argv[3]<< argv[4]<< "\n";
938
939// setcolor <object> <r> <g> <b>
940// change the object color with RGB values.
941
942
943 Standard_Real QuantityOfRed = atof(argv[2]);
944 Standard_Real QuantityOfGreen = atof(argv[3]);
945 Standard_Real QuantityOfBlue = atof(argv[4]);
946
947 TopoDS_Shape aShape = DBRep::Get(argv[1]);
948 Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape);
949 myAISContext->SetColor(myShape,Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB),Standard_True);
950 myAISContext->Display(myShape,Standard_True);
951 myAISContext->UpdateCurrentViewer();
952// myShape->SetColor(Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB));
953// myShape->Redisplay();
954 break;
955 }
956 }
957return 0;
958}
959
960static Standard_Integer BUC60726 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
961{
962 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
963 if(myAISContext.IsNull()) {
964 di << "use 'vinit' command before " << argv[0] << "\n";
965 return -1;
966 }
967
968 if(argc != 2) {
969 di << "Usage : " << argv[0] << " 0/1" << "\n";
970 }
971
972 if(atoi(argv[1]) == 0) {
973 myAISContext->CloseAllContexts();
974 BRepPrimAPI_MakeBox B(gp_Pnt(-400.,-400.,-100.),200.,150.,100.);
975 Handle(AIS_Shape) aBox = new AIS_Shape(B.Shape());
976 myAISContext->Display(aBox);
977 } else if(atoi(argv[1]) == 1) {
978 myAISContext->CloseAllContexts();
979 myAISContext->OpenLocalContext();
980 myAISContext->ActivateStandardMode(TopAbs_EDGE);
981 } else if(atoi(argv[1]) == 2) {
982 myAISContext->CloseAllContexts();
983 myAISContext->OpenLocalContext();
984 myAISContext->ActivateStandardMode(TopAbs_FACE);
985 } else {
986 di << "Usage : " << argv[0] << " 0/1" << "\n";
987 return -1;
988 }
989
990 return 0;
991}
992
993#include <BRepBndLib.hxx>
994#include <Bnd_HArray1OfBox.hxx>
995
996static Standard_Integer BUC60729 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** /*argv*/ )
997{
998 Bnd_Box aMainBox;
999 TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1,1,1).Solid();
1000
1001 BRepBndLib::Add(aShape , aMainBox );
1002
1003 Standard_Integer siMaxNbrBox = 6;
1004 Bnd_BoundSortBox m_BoundSortBox;
1005 m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox );
1006 TopExp_Explorer aExplorer(aShape,TopAbs_FACE);
1007 Standard_Integer i;
1008
1009
1010// Bnd_Box __emptyBox; // Box is void !
1011// Handle_Bnd_HArray1OfBox __aSetOfBox = new Bnd_HArray1OfBox( 1, siMaxNbrBox, __emptyBox );
1012
1013 for (i=1,aExplorer.ReInit(); aExplorer.More(); aExplorer.Next(),i++ )
1014 {
1015 const TopoDS_Shape& aFace = aExplorer.Current();
1016 Bnd_Box aBox;
1017 BRepBndLib::Add( aFace, aBox );
1018 m_BoundSortBox.Add( aBox, i );
1019// __aSetOfBox->SetValue( i, aBox );
1020 }
1021// m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox );
1022
1023 return 0;
1024}
1025
1026static Standard_Integer BUC60724(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/ )
1027{
1028 TCollection_AsciiString as1("");
1029 TCollection_AsciiString as2('\0');
1030 if((as1.ToCString()!=NULL) || (as1.ToCString() != ""))
1031 di << "Faulty : the first string is not zero string : " << as1.ToCString() << "\n";
1032
1033 if((as2.ToCString()!=NULL) || (as2.ToCString() != ""))
1034 di << "Faulty : the second string is not zero string : " << as2.ToCString() << "\n";
1035
1036 return 0;
1037}
1038
1039#include <UnitsAPI.hxx>
1040
1041static Standard_Integer BUC60727(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/ )
1042{
1043di <<"Program Test" << "\n";
1044UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); //length is mm
1045di <<"AnyToLS (3,mm) = " << UnitsAPI::AnyToLS(3.,"mm") << "\n"; // result was WRONG.
1046
1047 return 0;
1048}
1049
1050#include <gp_Circ.hxx>
1051#include <Geom_Circle.hxx>
1052#include <GeomAPI.hxx>
1053#include <Geom2d_CartesianPoint.hxx>
1054#include <Geom2dGcc_QualifiedCurve.hxx>
1055#include <Geom2dGcc_Circ2d2TanRad.hxx>
1056#include <Geom2d_Circle.hxx>
1057#include <ProjLib.hxx>
1058
1059static Standard_Integer BUC60792(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv )
1060{
1061 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1062 if(aContext.IsNull()) {
1063 di << "use 'vinit' command before " << argv[0] << "\n";
1064 return -1;
1065 }
1066
1067 gp_Pnt pt3d(0, 20, 150);
1068 gp_Ax2 anAx2(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0), gp_Dir(0, 0, 1));
1069 gp_Circ circ(anAx2, 50.0);
1070 Handle_Geom_Circle gcir = new Geom_Circle(circ);
1071 Handle_Geom_Plane pln = new Geom_Plane(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0)));
1072 Handle_Geom2d_Curve gcir1 = GeomAPI::To2d(gcir, pln->Pln());
1073 TopoDS_Shape sh1 = BRepBuilderAPI_MakeEdge(gcir1, pln).Shape();
1074 Handle_AIS_Shape ais1 = new AIS_Shape(sh1);
1075 aContext->SetColor(ais1, Quantity_NOC_INDIANRED);
1076 aContext->Display(ais1);
1077 DBRep::Set("sh0",sh1);
1078 gp_Pnt2d thepoint;
1079// local_get_2Dpointfrom3Dpoint(pt3d, pln->Pln(), thepoint);
1080 thepoint = ProjLib::Project(pln->Pln(),pt3d);
1081 Handle_Geom2d_CartesianPoint ThePoint = new Geom2d_CartesianPoint(thepoint);
1082 Geom2dAdaptor_Curve acur1(gcir1) ;
1083 Geom2dGcc_QualifiedCurve qcur1(acur1, GccEnt_outside) ;
1084 Geom2dGcc_Circ2d2TanRad cirtanrad(qcur1, ThePoint, 200.0, 0.0001);
1085 printf("\n No. of solutions = %d\n", cirtanrad.NbSolutions());
1086 Handle_Geom2d_Circle gccc;
1087 if( cirtanrad.NbSolutions() ) {
1088 for( int i = 1; i<=cirtanrad.NbSolutions(); i++) {
1089 gp_Circ2d ccc = cirtanrad.ThisSolution(i);
1090 gccc = new Geom2d_Circle(ccc);
1091 TopoDS_Shape sh = BRepBuilderAPI_MakeEdge(gccc, pln).Shape();
1092 Standard_Character aStr[5];
1093 sprintf(aStr,"sh%d",i);
1094 DBRep::Set(aStr,sh);
1095 Handle_AIS_Shape ais = new AIS_Shape(sh);
1096 if( i ==1 )
1097 aContext->SetColor(ais, Quantity_NOC_GREEN);
1098 if( i == 2)
1099 aContext->SetColor(ais, Quantity_NOC_HOTPINK);
1100 aContext->Display(ais);
1101 Standard_Real ParSol1, ParSol2, ParArg1, ParArg2;
1102 gp_Pnt2d PntSol1, PntSol2;
1103 cirtanrad.Tangency1(i, ParSol1, ParArg1, PntSol1);
1104 printf("%f\t%f\t\t%f\t%f\n",ParSol1, ParArg1,PntSol1.X(),PntSol1.Y());
1105 cirtanrad.Tangency2(i, ParSol2, ParArg2, PntSol2);
1106 printf("%f\t%f\t\t%f\t%f\n",ParSol2, ParArg2,PntSol2.X(),PntSol2.Y());
1107 }
1108 }
1109 return 0;
1110}
1111
1112#include <TColgp_Array2OfPnt.hxx>
1113#include <Geom_BezierSurface.hxx>
1114#include <BRepBuilderAPI_MakeFace.hxx>
1115#include <BRepBuilderAPI_MakeWire.hxx>
1116#include <Geom_OffsetSurface.hxx>
1117#include <BRepFilletAPI_MakeFillet2d.hxx>
1118#include <GeomProjLib.hxx>
1119#include <Geom_TrimmedCurve.hxx>
1120
1121static Standard_Integer BUC60811(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
1122{
1123 if(argc == 4) {
1124 TopLoc_Location L1;
1125 TopoDS_Edge aEdge = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
1126 TopoDS_Face aFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
1127 Standard_Real f = 0.0, l = 0.0;
1128 Handle(Geom_Curve) GC = BRep_Tool::Curve(aEdge,f,l);
1129 Handle(Geom_Surface) GS = BRep_Tool::Surface(aFace, L1);
1130 GC = new Geom_TrimmedCurve(GC, f, l);
1131 Handle(Geom_Curve) projCurve = GeomProjLib::Project(GC,GS);
1132 BRepBuilderAPI_MakeWire *myWire;
1133 myWire = new BRepBuilderAPI_MakeWire();
1134 myWire->Add((BRepBuilderAPI_MakeEdge(projCurve)).Edge());
1135 DBRep::Set(argv[1],myWire->Wire());
1136 return 0;
1137 }
1138
1139 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1140 if(aContext.IsNull()) {
1141 di << "use 'vinit' command before " << argv[0] << "\n";
1142 return -1;
1143 }
1144
1145//step 1. creating a Bezier Surface and a patch
1146 TopoDS_Face FP;
1147 TopoDS_Shape FP1;
1148 TopoDS_Solid solid;
1149 Handle(AIS_Shape) ais1;
1150 Handle_AIS_Shape ais2;
1151 Handle(Geom_BezierSurface) BZ1;
1152 TColgp_Array2OfPnt array1(1,3,1,3);
1153 array1.SetValue(1,1,gp_Pnt(0,100,0));
1154 array1.SetValue(1,2,gp_Pnt(200,100,0));
1155 array1.SetValue(1,3,gp_Pnt(400,100,0));
1156 array1.SetValue(2,1,gp_Pnt(0,200,100));
1157 array1.SetValue(2,2,gp_Pnt(200,200,100));
1158 array1.SetValue(2,3,gp_Pnt(400,200,100));
1159 array1.SetValue(3,1,gp_Pnt(0,300,0));
1160 array1.SetValue(3,2,gp_Pnt(200,300,0));
1161 array1.SetValue(3,3,gp_Pnt(400,300,0));
1162 BZ1 = new Geom_BezierSurface(array1);
1163 BRepBuilderAPI_MakeFace bzf1( BZ1 );
1164 TopoDS_Face F1= bzf1.Face();
1165 ais1 = new AIS_Shape(F1);
1166 DBRep::Set("F1",F1);
1167 aContext->SetMaterial(ais1,Graphic3d_NOM_ALUMINIUM,Standard_False);
1168 aContext->Display(ais1);
1169 BRep_Builder B;
1170 TopoDS_Shell shell;
1171 B.MakeShell(shell);
1172 B.Add(shell, bzf1);
1173 B.MakeSolid(solid);
1174 B.Add(solid,shell);
1175 gp_Dir D(0, 0, 1.0f);
1176 BRepBuilderAPI_MakeWire mkw;
1177 gp_Pnt p1 = gp_Pnt(150., 150.0, 260.);
1178 gp_Pnt p2 = gp_Pnt(350., 150., 260.);
1179 BRepBuilderAPI_MakeEdge* E1 = new BRepBuilderAPI_MakeEdge(p1,p2);
1180 mkw.Add(*E1);
1181 p1 = gp_Pnt(350., 150., 260.);
1182 p2 = gp_Pnt(350., 250., 260.);
1183 BRepBuilderAPI_MakeEdge* E2 = new BRepBuilderAPI_MakeEdge(p1,p2);
1184 mkw.Add(*E2);
1185 p1 = gp_Pnt(350., 250., 260.);
1186 p2 = gp_Pnt(300., 250.0, 260.);
1187 BRepBuilderAPI_MakeEdge* E3 = new BRepBuilderAPI_MakeEdge(p1,p2);
1188 mkw.Add(*E3);
1189 p1 = gp_Pnt(300., 250.0, 260.);
1190 p2 = gp_Pnt(200., 200.0, 260.);
1191 BRepBuilderAPI_MakeEdge* E4 = new BRepBuilderAPI_MakeEdge(p1,p2);
1192 mkw.Add(*E4);
1193 p1 = gp_Pnt(200., 200.0, 260.);
1194 p2 = gp_Pnt(150., 200.0, 260.);
1195 BRepBuilderAPI_MakeEdge* E5 = new BRepBuilderAPI_MakeEdge(p1,p2);
1196 mkw.Add(*E5);
1197 p1 = gp_Pnt(150., 200.0, 260.);
1198 p2 = gp_Pnt(150., 150.0, 260.);
1199 BRepBuilderAPI_MakeEdge* E6 = new BRepBuilderAPI_MakeEdge(p1,p2);
1200 mkw.Add(*E6);
1201 FP = BRepBuilderAPI_MakeFace(mkw.Wire());
1202 ais2 = new AIS_Shape( FP );
1203 aContext->SetMaterial(ais2,Graphic3d_NOM_ALUMINIUM,Standard_False);
1204 aContext->Display( ais2 );
1205
1206 DBRep::Set("FP",FP);
1207
1208//step 2. offseting the surface.
1209 Handle_Geom_OffsetSurface offsurf;
1210 offsurf = new Geom_OffsetSurface(BZ1, -100);
1211 BRepBuilderAPI_MakeFace bzf2( offsurf );
1212 TopoDS_Face F2= bzf2.Face();
1213 Handle_AIS_Shape ais22 = new AIS_Shape(F2);
1214 aContext->Display(ais22);
1215 DBRep::Set("F2",F2);
1216
1217//step 3. filleting the patch.
1218//( I want to project wire of this patch on offseted surface above)
1219 BRepFilletAPI_MakeFillet2d fillet( FP );
1220 TopExp_Explorer Ex;
1221 Ex.Init(FP, TopAbs_VERTEX);
1222 TopoDS_Vertex v1 = TopoDS::Vertex(Ex.Current());
1223 fillet.AddFillet(v1, 20);
1224 printf("\nError is %d ", fillet.Status());
1225 Ex.Next();
1226 TopoDS_Vertex V2 = TopoDS::Vertex(Ex.Current());
1227 fillet.AddFillet(V2, 20);
1228 printf("\nError is %d ", fillet.Status());
1229 fillet.Build();
1230 FP1 = fillet.Shape();
1231 ais2 = new AIS_Shape( FP1 );
1232 aContext->SetMaterial(ais2,Graphic3d_NOM_ALUMINIUM,Standard_False);
1233 aContext->Display( ais2 );
1234
1235 DBRep::Set("FP1",FP1);
1236
1237//step 4. Projecting the wire of this patch on offsetted surface.
1238// TopExp_Explorer Ex;
1239 BRepBuilderAPI_MakeWire *myWire;
1240 myWire = new BRepBuilderAPI_MakeWire();
1241 for (Ex.Init( FP1, TopAbs_EDGE); Ex.More(); Ex.Next())
1242 {
1243 TopoDS_Edge e1 = TopoDS::Edge(Ex.Current());
1244 Standard_Real f = 0.0, l = 0.0;
1245 Handle_Geom_Curve newBSplin = BRep_Tool::Curve(e1, f, l);
1246 newBSplin = new Geom_TrimmedCurve(newBSplin, f, l);
1247 Handle(Geom_Curve) projCurve = GeomProjLib::Project(newBSplin,offsurf);
1248 myWire->Add((BRepBuilderAPI_MakeEdge(projCurve)).Edge());
1249 }
1250 Handle_AIS_Shape ais33 = new AIS_Shape( myWire->Wire() );
1251 aContext->Display(ais33);
1252
1253 DBRep::Set("Wire",myWire->Wire());
1254
1255 return 0;
1256}
1257
1258#include<GeomAPI_ExtremaCurveCurve.hxx>
1259
1260static int BUC60825(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1261
1262{
1263 if(argc < 3){
1264 printf("Usage: %s edge1 edge2",argv[0]);
1265 return(-1);
1266 }
1267
1268 TopoDS_Edge E1 = TopoDS::Edge(DBRep::Get(argv[1])),
1269 E2 = TopoDS::Edge(DBRep::Get(argv[2]));
1270
1271 Standard_Real fp , lp;
1272
1273 Handle(Geom_Curve) C1 = BRep_Tool::Curve(E1 , fp , lp),
1274 C2 = BRep_Tool::Curve(E2 , fp , lp);
1275
1276 GeomAPI_ExtremaCurveCurve aExt(C1 , C2);
1277
1278 di << "NB RESULTS : " << aExt.NbExtrema() << "\n";
1279
1280 return 0;
1281}
1282
1283#include <BRepBuilderAPI_MakePolygon.hxx>
1284#include <BRepOffsetAPI_ThruSections.hxx>
1285
1286static int OCC10006(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1287{
1288 if(argc > 2) {
1289 di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1290 return 1;
1291 }
1292 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1293 if (argc == 2) {
1294 Standard_Integer IsB = atoi(argv[1]);
1295 if (IsB != 1) {
1296 IsBRepAlgoAPI = Standard_False;
1297#if ! defined(BRepAlgo_def01)
1298// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
1299// return 1;
1300#endif
1301 }
1302 }
1303
1304 double bottompoints1[12] = { 10, -10, 0, 100, -10, 0, 100, -100, 0, 10, -100, 0};
1305 double toppoints1[12] = { 0, 0, 10, 100, 0, 10, 100, -100, 10, 0, -100, 10};
1306 double bottompoints2[12] = { 0, 0, 10.00, 100, 0, 10.00, 100, -100, 10.00, 0, -100, 10.00};
1307 double toppoints2[12] = { 0, 0, 250, 100, 0, 250, 100, -100, 250, 0, -100, 250};
1308 BRepBuilderAPI_MakePolygon bottompolygon1, toppolygon1, bottompolygon2, toppolygon2;
1309 gp_Pnt tmppnt;
1310 for (int i=0;i<4;i++) {
1311 tmppnt.SetCoord(bottompoints1[3*i], bottompoints1[3*i+1], bottompoints1[3*i+2]);
1312 bottompolygon1.Add(tmppnt);
1313 tmppnt.SetCoord(toppoints1[3*i], toppoints1[3*i+1], toppoints1[3*i+2]);
1314 toppolygon1.Add(tmppnt);
1315 tmppnt.SetCoord(bottompoints2[3*i], bottompoints2[3*i+1], bottompoints2[3*i+2]);
1316 bottompolygon2.Add(tmppnt);
1317 tmppnt.SetCoord(toppoints2[3*i], toppoints2[3*i+1], toppoints2[3*i+2]);
1318 toppolygon2.Add(tmppnt);
1319 }
1320 bottompolygon1.Close();
1321 DBRep::Set("B1",bottompolygon1.Shape());
1322 toppolygon1.Close();
1323 DBRep::Set("T1",toppolygon1.Shape());
1324 bottompolygon2.Close();
1325 DBRep::Set("B2",bottompolygon2.Shape());
1326 toppolygon2.Close();
1327 DBRep::Set("T2",toppolygon2.Shape());
1328 BRepOffsetAPI_ThruSections loft1(Standard_True, Standard_True);
1329 loft1.AddWire(bottompolygon1.Wire());
1330 loft1.AddWire(toppolygon1.Wire());
1331 loft1.Build();
1332 BRepOffsetAPI_ThruSections loft2(Standard_True, Standard_True);
1333 loft2.AddWire(bottompolygon2.Wire());
1334 loft2.AddWire(toppolygon2.Wire());
1335 loft2.Build();
1336 if (loft1.Shape().IsNull() || loft2.Shape().IsNull())
1337 return 1;
1338 DBRep::Set("TS1",loft1.Shape());
1339 DBRep::Set("TS2",loft2.Shape());
1340
1341//#if ! defined(BRepAlgoAPI_def01)
1342// BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape());
1343//#else
1344// BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape());
1345//#endif
1346 if (IsBRepAlgoAPI) {
1347 di << "BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape())" <<"\n";
1348 BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape());
1349 DBRep::Set("F",result.Shape());
1350 } else {
1351 di << "BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape())" <<"\n";
1352 BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape());
1353 DBRep::Set("F",result.Shape());
1354 }
1355
1356// DBRep::Set("F",result.Shape());
1357 return 0;
1358}
1359
1360#include <Geom_RectangularTrimmedSurface.hxx>
1361#include <GC_MakeTrimmedCone.hxx>
1362
1363static Standard_Integer BUC60856(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv )
1364{
1365 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1366 if(aContext.IsNull()) {
1367 di << "use 'vinit' command before " << argv[0] << "\n";
1368 return -1;
1369 }
1370
1371 gp_Ax2 Cone_Ax;
1372 double R1=8, R2=16, H1=20, H2=40, angle;
1373 gp_Pnt P0(0,0,0),
1374 P1(0,0,20), P2(0,0,45);
1375 angle = 2*PI;
1376 Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
1377 TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S).Shape();
1378 Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
1379 aContext->Display(ais1);
1380 aContext->SetColor(ais1, Quantity_NOC_BLUE1);
1381
1382 Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2,R1, 0).Value();
1383 TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2).Shape();
1384 Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
1385 aContext->Display(ais2);
1386 aContext->SetColor(ais2, Quantity_NOC_RED);
1387 return 0;
1388}
1389
1390#if ! defined(WNT)
1391//#include <fstream.h>
1392#ifdef HAVE_FSTREAM
1393# include <fstream>
1394#elif defined (HAVE_FSTREAM_H)
1395# include <fstream.h>
1396#endif
1397//#include <Standard_Stream.hxx>
1398//==========================================================================
1399//function : CoordLoad
1400// chargement d une face dans l explorer.
1401//==========================================================================
1402static Standard_Integer coordload (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1403{
1404 char line[256];
1405 char X[30], Y[30];
1406 int fr;
1407 TopoDS_Vertex V1,V2;
1408 TopoDS_Edge Edge;
1409 TopoDS_Wire Wire;
1410 TopoDS_Face Face;
1411
1412 if (argc < 3) return 1;
1413
1414 ifstream file(argv[2], ios::in);
1415 if(!file)
1416 {
1417 di<<"unable to open "<<argv[2]<<" for input"<<"\n";
1418 return 2;
1419 }
1420 BRepBuilderAPI_MakeWire WB;
1421
1422 file.getline(line,80);
1423 for(int i=0;i<30;i++) X[i]=Y[i]=0;
1424 fr = sscanf(line,"%20c%20c",&X,&Y);
1425 V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
1426
1427 for(;;)
1428 {
1429 file.getline(line,80);
1430 if (!file) break;
1431 for(int i=0;i<30;i++) X[i]=Y[i]=0;
1432 fr = sscanf(line,"%20c%20c",&X,&Y);
1433 V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
1434 Edge = BRepBuilderAPI_MakeEdge(V1,V2);
1435 WB.Add(Edge);
1436 V1=V2;
1437 }
1438
1439 file.close();
1440 if (WB.IsDone()) Wire = WB.Wire();
1441 Face = BRepBuilderAPI_MakeFace(Wire);
1442
1443 DBRep::Set (argv[1],Face);
1444 return 0;
1445}
1446#endif
1447
1448static Standard_Integer TestMem (Draw_Interpretor& /*di*/,
1449 Standard_Integer /*nb*/,
1450 const char ** /*arg*/)
1451{
1452 TCollection_ExtendedString aString(1024*1024, 'A');
1453 return 0;
1454}
1455
1456static Standard_Integer BUC60876_ (Draw_Interpretor& di,
1457 Standard_Integer argc,
1458 const char ** argv)
1459{
1460 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
1461 if(aContext.IsNull()) {
1462 di << "use 'vinit' command before " << argv[0] << "\n";
1463 return -1;
1464 }
1465 if((argc != 2) && (argc != 3)) {
1466 di<< "usage : " << argv[0] << " shape [mode==1]" << "\n";
1467 return -1;
1468 }
1469 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1470 Handle(AIS_InteractiveObject) anIO = new AIS_Shape(aShape);
1471// Handle(AIS_InteractiveObject) anIOa = ViewerTest::GetAISShapeFromName(argv[1]);
1472 anIO->SetHilightMode((argc == 3) ? atoi(argv[2]) : 1);
1473 aContext->Display(anIO);
1474 return 0;
1475}
1476
1477//=======================================================================
1478//function : buc60773
1479//purpose :
1480//=======================================================================
1481
1482#include<TCollection_HAsciiString.hxx>
1483
1484static Standard_Integer BUC60773 (Draw_Interpretor& /*di*/, Standard_Integer /*n*/, const char ** /*a*/)
1485{
1486 Handle(TCollection_HAsciiString) hAscii = new TCollection_HAsciiString();
1487 Standard_CString aStr = hAscii->ToCString();
1488 TCollection_AsciiString aAscii(aStr);
1489
1490 return 0;
1491}
1492
1493#include<BRepPrimAPI_MakeCylinder.hxx>
1494#include<BRepPrimAPI_MakeCone.hxx>
1495
1496static int TestCMD(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1497
1498{
1499 if(argc > 2) {
1500 di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1501 return 1;
1502 }
1503 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1504 if (argc == 2) {
1505 Standard_Integer IsB = atoi(argv[1]);
1506 if (IsB != 1) {
1507 IsBRepAlgoAPI = Standard_False;
1508#if ! defined(BRepAlgo_def01)
1509// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
1510// return 1;
1511#endif
1512 }
1513 }
1514
1515 //Cylindre 36.085182 20.0 8.431413 88.04671 20.0 38.931416 10.0
1516
1517 Standard_Real x11 = 36.085182;
1518 Standard_Real y11 = 20.0;
1519 Standard_Real z11 = 8.431413;
1520 Standard_Real x12 = 88.04671;
1521 Standard_Real y12 = 20.0;
1522 Standard_Real z12 = 38.931416;
1523 Standard_Real radius = 10.0;
1524
1525 gp_Pnt base1(x11, y11, z11);
1526 gp_Dir vect1(x12-x11, y12-y11, z12-z11);
1527 gp_Ax2 axis1(base1, vect1);
1528 Standard_Real height1 = sqrt( ((x12-x11)*(x12-x11)) + ((y12-y11)*(y12-y11)) + ((z12-z11)*(z12-z11)) );
1529 BRepPrimAPI_MakeCylinder cylinder(axis1, radius, height1);
1530
1531 TopoDS_Shape SCyl = cylinder.Shape();
1532 DBRep::Set("cyl", SCyl);
1533
1534
1535 //Cone 70.7262 20.0 28.431412 105.36722 20.0 48.431416 6.0 3.0
1536 Standard_Real x21 = 70.7262;
1537 Standard_Real y21 = 20.0;
1538 Standard_Real z21 = 28.431412;
1539 Standard_Real x22 = 105.36722;
1540 Standard_Real y22 = 20.0;
1541 Standard_Real z22 = 48.431416;
1542 Standard_Real radius1 = 6.0;
1543 Standard_Real radius2 = 3.0;
1544
1545 gp_Pnt base2(x21, y21, z21);
1546 gp_Dir vect2(x22-x21, y22-y21, z22-z21);
1547 gp_Ax2 axis2(base2, vect2);
1548 Standard_Real height2 = sqrt( ((x22-x21)*(x22-x21)) + ((y22-y21)*(y22-y21)) + ((z22-z21)*(z22-z21)) );
1549 BRepPrimAPI_MakeCone cone(axis2, radius1, radius2, height2);
1550
1551 TopoDS_Shape SCon = cone.Shape();
1552 DBRep::Set("con", SCon);
1553
1554//#if ! defined(BRepAlgoAPI_def01)
1555// BRepAlgoAPI_Fuse SFuse(SCyl, SCon);
1556//#else
1557// BRepAlgo_Fuse SFuse(SCyl, SCon);
1558//#endif
1559//
1560// if(! SFuse.IsDone() )
1561// cout<<"Error: Boolean fuse operation failed !"<<endl;
1562//
1563// TopoDS_Shape fuse = SFuse.Shape();
1564
1565 TopoDS_Shape fuse;
1566 if (IsBRepAlgoAPI) {
1567 di << "BRepAlgoAPI_Fuse SFuse(SCyl, SCon)" <<"\n";
1568 BRepAlgoAPI_Fuse SFuse(SCyl, SCon);
1569 if(! SFuse.IsDone() )
1570 di<<"Error: Boolean fuse operation failed !"<<"\n";
1571 fuse = SFuse.Shape();
1572 } else {
1573 di << "BRepAlgo_Fuse SFuse(SCyl, SCon)" <<"\n";
1574 BRepAlgo_Fuse SFuse(SCyl, SCon);
1575 if(! SFuse.IsDone() )
1576 di<<"Error: Boolean fuse operation failed !"<<"\n";
1577 fuse = SFuse.Shape();
1578 }
1579
1580 DBRep::Set("fus", fuse);
1581
1582 return 0;
1583}
1584
1585#include <Dico_DictionaryOfInteger.hxx>
1586#include <TColStd_HSequenceOfAsciiString.hxx>
1587#include <TopExp.hxx>
1588#include <TopoDS_Iterator.hxx>
1589
1590//---------------------------------------------------------------------------------------
1591
1592static Standard_Integer statface (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
1593
1594{
1595 TopoDS_Shape aShape = DBRep::Get(argv[1]);
1596 if(aShape.IsNull())
1597 {
1598 di<<"Invalid input shape"<<"\n";
1599 return 1;
1600 }
1601 Handle(Dico_DictionaryOfInteger) aDico = new Dico_DictionaryOfInteger();
1602 Handle(TColStd_HSequenceOfAsciiString) aSequence = new TColStd_HSequenceOfAsciiString;
1603 Standard_CString aString;
1604 Standard_Integer i=1,j=1,k=1,l=1,aa=1;
1605 TopExp_Explorer expl;
1606 Standard_Real f3d,l3d;
1607 for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
1608 {
1609 // SURFACES
1610 TopoDS_Face aFace = TopoDS::Face (expl.Current());
1611 Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
1612 aString = aSurface->DynamicType()->Name();
1613
1614 if(aDico->GetItem(aString,aa) != 0)
1615 {
1616 aDico->GetItem(aString,aa);
1617 aDico->SetItem(aString,aa+1);
1618 } else {
1619 aDico->SetItem(aString,1);
1620 aSequence->Append(aString);
1621 aa=1;
1622 i++;
1623 }
1624 }
1625 // PCURVES
1626 for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
1627 {
1628 TopoDS_Face aFace = TopoDS::Face (expl.Current());
1629 TopoDS_Iterator anIt(aFace);
1630 TopoDS_Wire aWire = TopoDS::Wire (anIt.Value());
1631 TopoDS_Iterator it (aWire);
1632 for (; it.More(); it.Next()) {
1633 TopoDS_Edge Edge = TopoDS::Edge (it.Value());
1634 Handle(Geom2d_Curve) aCurve2d = BRep_Tool::CurveOnSurface(Edge,aFace,f3d,l3d);
1635 aString = aCurve2d->DynamicType()->Name();
1636 if(aDico->GetItem(aString,aa) != 0)
1637 {
1638 aDico->GetItem(aString,aa);
1639 aDico->SetItem(aString,aa+1);
1640 } else {
1641 aDico->SetItem(aString,1);
1642 aSequence->Append(aString);
1643 i++;
1644 aa=1;
1645 }
1646 }
1647 }
1648 // 3d CURVES
1649 TopExp_Explorer exp;
1650 for (exp.Init(aShape,TopAbs_EDGE); exp.More(); exp.Next())
1651 {
1652 TopoDS_Edge Edge = TopoDS::Edge (exp.Current());
1653 Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve (Edge,f3d,l3d);
1654 if(aCurve3d.IsNull())
1655 {
1656 l++;
1657 goto aLabel;
1658 }
1659 aString = aCurve3d->DynamicType()->Name();
1660 if(aDico->GetItem(aString,aa) != 0)
1661 {
1662 aDico->GetItem(aString,aa);
1663 aDico->SetItem(aString,aa+1);
1664 } else {
1665 aDico->SetItem(aString,1);
1666 aSequence->Append(aString);
1667 i++;
1668 aa=1;
1669 }
1670 aLabel:;
1671 }
1672 // Output
1673 di<<"\n";
1674 for(j=1;j<i;j++)
1675 {
1676 aDico->GetItem(aSequence->Value(j),aa);
1677 di<<aa<<" -- "<<aSequence->Value(j).ToCString()<<"\n";
1678 }
1679
1680 di<<"\n";
1681 di<<"Degenerated edges :"<<"\n";
1682 di<<l<<" -- "<<"Degenerated edges "<<"\n";
1683
1684 return 0;
1685
1686}
1687
1688#include <BRepBuilderAPI_Transform.hxx>
1689
1690static Standard_Integer BUC60841(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
1691{
1692 if(argc > 2) {
1693 di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
1694 return 1;
1695 }
1696 Standard_Boolean IsBRepAlgoAPI = Standard_True;
1697 if (argc == 2) {
1698 Standard_Integer IsB = atoi(argv[1]);
1699 if (IsB != 1) {
1700 IsBRepAlgoAPI = Standard_False;
1701#if ! defined(BRepAlgo_def01)
1702// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
1703// return 1;
1704#endif
1705 }
1706 }
1707
1708 gp_Ax2 Ax2 = gp_Ax2(gp_Pnt(0, 621, 78), gp_Dir(0, 1,0));
1709 BRepPrimAPI_MakeCylinder cyl(Ax2, 260, 150);
1710 //BRepPrimAPI_MakeCylinder cyl(gp_Ax2(gp_Pnt(0, 621, 78), gp_Dir(0, 1,0)), 260, 150);
1711
1712 TopoDS_Shape sh1 = cyl.Shape();
1713 DBRep::Set("sh1",sh1);
1714 gp_Trsf trsf1, trsf2;
1715 trsf1.SetTranslation(gp_Pnt(0.000000,700.000000,-170.000000),
1716 gp_Pnt(0.000000,700.000000,-95.000000));
1717 trsf2.SetRotation(gp_Ax1(gp_Pnt(0.000000,700.000000,-170.000000),
1718 gp_Dir(0.000000,0.000000,1.000000)), 0.436111);
1719 BRepBuilderAPI_Transform trans1(sh1, trsf1);
1720 TopoDS_Shape sh2 = trans1.Shape();
1721 DBRep::Set("sh2",sh2);
1722
1723//#if ! defined(BRepAlgoAPI_def01)
1724// BRepAlgoAPI_Fuse fuse1(sh1, sh2);
1725//#else
1726// BRepAlgo_Fuse fuse1(sh1, sh2);
1727//#endif
1728//
1729// TopoDS_Shape fsh1 = fuse1.Shape();
1730
1731 TopoDS_Shape fsh1;
1732 if (IsBRepAlgoAPI) {
1733 di << "BRepAlgoAPI_Fuse fuse1(sh1, sh2)" <<"\n";
1734 BRepAlgoAPI_Fuse fuse1(sh1, sh2);
1735 fsh1 = fuse1.Shape();
1736 } else {
1737 di << "BRepAlgo_Fuse fuse1(sh1, sh2)" <<"\n";
1738 BRepAlgo_Fuse fuse1(sh1, sh2);
1739 fsh1 = fuse1.Shape();
1740 }
1741
1742 DBRep::Set("fsh1",fsh1);
1743 BRepBuilderAPI_Transform trans2(fsh1, trsf2);
1744 TopoDS_Shape sh3 = trans2.Shape();
1745 DBRep::Set("sh3",sh3);
1746
1747//#if ! defined(BRepAlgoAPI_def01)
1748// BRepAlgoAPI_Fuse fuse2(fsh1,sh3);
1749//#else
1750// BRepAlgo_Fuse fuse2(fsh1,sh3);
1751//#endif
1752//
1753// TopoDS_Shape fsh2 = fuse2.Shape();
1754
1755 TopoDS_Shape fsh2;
1756 if (IsBRepAlgoAPI) {
1757 di << "BRepAlgoAPI_Fuse fuse2(fsh1,sh3)" <<"\n";
1758 BRepAlgoAPI_Fuse fuse2(fsh1,sh3);
1759 fsh2 = fuse2.Shape();
1760 } else {
1761 di << "BRepAlgo_Fuse fuse2(fsh1,sh3)" <<"\n";
1762 BRepAlgo_Fuse fuse2(fsh1,sh3);
1763 fsh2 = fuse2.Shape();
1764 }
1765
1766 DBRep::Set("fsh2",fsh2);
1767 Handle_AIS_Shape aisp1 = new AIS_Shape(fsh2);
1768// aContext->Display(aisp1);
1769 return 0;
1770}
1771
1772#include <ShapeBuild_Edge.hxx>
1773
1774static Standard_Integer BUC60874(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** argv )
1775{
1776 TopoDS_Edge e = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
1777 ShapeBuild_Edge().BuildCurve3d(e);
1778 DBRep::Set("ED",e);
1779 return 0;
1780}
1781
1782
1783#include<TDF_Label.hxx>
1784#include<TDataStd_TreeNode.hxx>
1785
1786#include<DDocStd.hxx>
1787
1788#include<DDF.hxx>
1789
1790#include<TDocStd_Modified.hxx>
1791#include<TDF_ListIteratorOfDeltaList.hxx>
1792#include<TDocStd_Document.hxx>
1793#include<TDocStd_Application.hxx>
1794#include<TDF_Delta.hxx>
1795#include<TDataXtd_Constraint.hxx>
1796#include<TPrsStd_AISPresentation.hxx>
1797#include<TPrsStd_AISViewer.hxx>
1798#include<TNaming_Builder.hxx>
1799#include<TNaming_Naming.hxx>
1800#include<TNaming_NamedShape.hxx>
1801
1802static int BUC60817(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
1803 if(argc!=2) {
1804 di << "Usage : " << argv[0] << " D" << "\n";
1805 di<<1;
1806 return 0;
1807 }
1808
1809 Handle(TDF_Data) DF;
1810 if (!DDF::GetDF(argv[1],DF)) {di<<2;return 0;}
1811
1812 TDF_Label L1,L2;
1813 Handle(TDataStd_TreeNode) TN1,TN2;
1814
1815 DDF::AddLabel(DF,"0:2",L1);
1816 TN1 = TDataStd_TreeNode::Set(L1);
1817
1818 DDF::AddLabel(DF,"0:3",L2);
1819 TN2 = TDataStd_TreeNode::Set(L2);
1820
1821 TN1->Append(TN2);
1822 if(!(TN2->IsDescendant(TN1))) {di<<3;return 0;}
1823 if((TN1->IsDescendant(TN2))) {di<<4;return 0;}
1824
1825 di<<0;
1826 return 0;
1827}
1828
1829static int BUC60831_1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
1830 if(argc!=2) {
1831 di << "Usage : " << argv[0] << " D" << "\n";
1832 di<<-1;
1833 return 0;
1834 }
1835
1836 Handle(TDF_Data) DF;
1837 if (!DDF::GetDF(argv[1],DF)) {di<<-2;return 0;}
1838
1839 TDF_Label L;
1840 DDF::FindLabel(DF,"0:1",L,Standard_False);
1841 Handle(TDocStd_Modified) MDF;
1842 if (!L.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
1843 MDF = new TDocStd_Modified();
1844 L.Root().AddAttribute(MDF);
1845 }
1846
1847 di<<!MDF->IsEmpty();
1848 return 0;
1849}
1850
1851static int BUC60831_2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
1852 if(argc!=3) {
1853 di << "Usage : " << argv[0] << " D Label" << "\n";
1854 di<<1;
1855 return 0;
1856 }
1857
1858 Handle(TDF_Data) DF;
1859 if (!DDF::GetDF(argv[1],DF)) {di<<2;return 0;}
1860
1861 TDF_Label L;
1862 DDF::FindLabel(DF,argv[2],L,Standard_False);
1863
1864 TDocStd_Modified::Add(L);
1865
1866 di<<0;
1867 return 0;
1868}
1869
1870static int BUC60836(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
1871 if(argc!=2) {
1872 di << "Usage : " << argv[0] << " D" << "\n";
1873 di<<1;
1874 return 0;
1875 }
1876
1877
1878 Handle(TDF_Data) aDF;
1879 if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
1880
1881 Handle(TDocStd_Document) aDocument;
1882 if (!DDocStd::GetDocument(argv[1], aDocument)) {di<<3;return 0;}
1883
1884 TDF_Label L;
1885 Handle(TDataStd_TreeNode) TN;
1886
1887 aDocument->NewCommand();
1888 DDF::AddLabel(aDF,"0:2",L);
1889 TN = TDataStd_TreeNode::Set(L);
1890
1891 aDocument->NewCommand();
1892 DDF::AddLabel(aDF,"0:3",L);
1893 TN = TDataStd_TreeNode::Set(L);
1894
1895 aDocument->NewCommand();
1896 DDF::AddLabel(aDF,"0:4",L);
1897 TN = TDataStd_TreeNode::Set(L);
1898 aDocument->NewCommand();
1899
1900 TDF_DeltaList Us,Rs;
1901 Us = aDocument->GetUndos();
1902 Rs = aDocument->GetUndos();
1903
1904 Standard_Integer i;
1905 char Names[10][5]={"n1","n2","n3","n4","n5","n6","n7","n8","n9","n10"};
1906
1907 TDF_ListIteratorOfDeltaList IDL;
1908 for(IDL.Initialize(Us),i=1;IDL.More();IDL.Next(),i++){
1909 Handle(TDF_Delta) D = IDL.Value();
1910 TCollection_ExtendedString S(Names[i-1]);
1911 D->SetName(S);
1912// cout<<" U"<<i<<"="<<D->Name()<<endl;
1913 }
1914
1915 aDocument->Undo();
1916 aDocument->Undo();
1917
1918 Us = aDocument->GetUndos();
1919 Rs = aDocument->GetRedos();
1920
1921 for(IDL.Initialize(Us),i=1;IDL.More();IDL.Next(),i++){
1922 Handle(TDF_Delta) D = IDL.Value();
1923// cout<<" U"<<i<<"="<<D->Name()<<endl;
1924 }
1925
1926 TCollection_ExtendedString n2name ("n2");
1927 for(IDL.Initialize(Rs),i=1;IDL.More();IDL.Next(),i++){
1928 Handle(TDF_Delta) D = IDL.Value();
1929 if ( i == 1 && ! D->Name().IsEqual (n2name) )
1930 {
1931 di << 4;
1932 return 0;
1933 }
1934 }
1935
1936 di<<0;
1937 return 0;
1938}
1939
1940static int BUC60847(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
1941 if(argc!=3) {
1942 di << "Usage : " << argv[0] << " D Shape" << "\n";
1943 di<<1;
1944 return 0;
1945 }
1946
1947 Handle(TDF_Data) aDF;
1948 if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
1949
1950 TopoDS_Shape s = DBRep::Get(argv[2]);
1951 if (s.IsNull()) { di <<"shape not found"<< "\n"; di<<3;return 0;}
1952 TDF_Label L;
1953 DDF::AddLabel(aDF, "0:2", L);
1954 TNaming_Builder SI (L);
1955 SI.Generated(s);
1956
1957 Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
1958
1959 TNaming_Naming aNN;
1960 NS=aNN.Name(L,s,s);
1961// if (!NS->IsEmpty()) {di<<3;return 0;}
1962 if (NS->IsEmpty()) {di<<4;return 0;}
1963 di<<0;
1964 return 0;
1965}
1966
1967static int BUC60862(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
1968 if(argc!=3) {
1969 di << "Usage : " << argv[0] << " D Shape" << "\n";
1970 di<<1;
1971 return 0;
1972 }
1973
1974 Handle(TDF_Data) aDF;
1975 if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
1976
1977 TopoDS_Shape s = DBRep::Get(argv[2]);
1978 if (s.IsNull()) { di <<"shape not found"<< "\n"; di<<3;return 0;}
1979 TDF_Label L;
1980 DDF::AddLabel(aDF, "0:2", L);
1981 TNaming_Builder SI (L);
1982 SI.Generated(s);
1983
1984 Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
1985
1986 TNaming_Naming aNN;
1987 NS=aNN.Name(L,s,s);
1988 if (NS->IsEmpty()) {di<<4;return 0;}
1989 di<<0;
1990 return 0;
1991}
1992
1993static int BUC60867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
1994 if (argc == 2) {
1995 TCollection_ExtendedString path (argv[1]);
1996 Handle(TDocStd_Application) A;
1997 if (!DDocStd::Find(A)) {di<<1;return 0;}
1998 Handle(TDocStd_Document) D;
1999 Standard_Integer insession = A->IsInSession(path);
2000 if (insession > 0) {
2001 di <<"document " << insession << " is already in session" << "\n";
2002 di<<2;
2003 return 0;
2004 }
2005 CDF_RetrievableStatus Result = A->Open(path,D);
2006 if(Result==CDF_RS_OK){
2007 di<<0;
2008 return 0;
2009 }
2010 }
2011 di<<3;
2012 return 0;
2013}
2014
2015static int BUC60910(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
2016 if(argc!=2) {
2017 di << "Usage : " << argv[0] << " D" << "\n";
2018 di<<1;
2019 return 0;
2020 }
2021
2022 Handle(TDF_Data) aDF;
2023 if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
2024
2025 TDF_Label L;
2026 DDF::AddLabel(aDF, "0:2", L);
2027
2028 Handle(TPrsStd_AISPresentation) AISP = new TPrsStd_AISPresentation;
2029
2030 AISP->Set(L,TDataXtd_Constraint::GetID());
2031
2032 if (AISP->HasOwnMode()) {di<<3;return 0;}
2033 AISP->SetMode(3);
2034 Standard_Integer Mode = AISP->Mode();
2035 if (Mode!=3) {di<<4;return 0;}
2036 if (!AISP->HasOwnMode()) {di<<5;return 0;}
2037 AISP->UnsetMode();
2038 if (AISP->HasOwnMode()) {di<<6;return 0;}
2039 di<<0;
2040 return 0;
2041}
2042
2043static int BUC60925(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
2044 if(argc!=2) {
2045 di << "Usage : " << argv[0] << " D" << "\n";
2046 di<<1;
2047 return 0;
2048 }
2049
2050 Handle(TDF_Data) aDF;
2051 if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
2052
2053 TDF_Label L;
2054 DDF::AddLabel(aDF, "0:2", L);
2055 TDF_LabelMap LM;
2056 LM.Add(L);
2057
2058 Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
2059// Handle(TNaming_Name) NN = new TNaming_Name;
2060 TNaming_Name NN;
2061
2062 NN.Type(TNaming_IDENTITY);
2063 NN.Append(NS);
2064 Standard_Boolean Res = NN.Solve(L,LM);
2065
2066 if (Res!=Standard_False) {di<<3;return 0;}
2067 di<<0;
2068 return 0;
2069}
2070
2071static int BUC60932(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
2072 if(argc!=2) {
2073 di << "Usage : " << argv[0] << " D" << "\n";
2074 di<<1;
2075 return 0;
2076 }
2077
2078
2079 Handle(TDocStd_Document) aDocument;
2080 if (!DDocStd::GetDocument(argv[1], aDocument)) {di<<2;return 0;}
2081
2082 if(!aDocument->InitDeltaCompaction()) {di<<3;return 0;}
2083 if(!aDocument->PerformDeltaCompaction()) {di<<4;return 0;}
2084
2085 di<<0;
2086 return 0;
2087}
2088
2089//=======================================================================
2090//function : AISWidth
2091//purpose : AISWidth (DOC,entry,[width])
2092// abv: testing command for checking bug BUC60917 in TPrsStd_AISPresentation
2093//=======================================================================
2094
2095static int AISWidth(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
2096
2097 if (argc >= 3) {
2098 Handle(TDocStd_Document) D;
2099 if (!DDocStd::GetDocument(argv[1],D)) {di<<(-1);return 0;}
2100 TDF_Label L;
2101 if (!DDF::FindLabel(D->GetData(),argv[2],L)) {di<<(-2);return 0;}
2102
2103 Handle(TPrsStd_AISViewer) viewer;
2104 if( !TPrsStd_AISViewer::Find(L, viewer) ) {di<<(-3);return 0;}
2105
2106 Handle(TPrsStd_AISPresentation) prs;
2107 if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
2108 if( argc == 4 ) {
2109 prs->SetWidth(atof(argv[3]));
2110 TPrsStd_AISViewer::Update(L);
2111 }
2112 else {
2113 if (prs->HasOwnWidth()){
2114// cout << "Width = " << prs->Width() << endl;
2115 di<<prs->Width();
2116 }
2117 else{
2118 di << "AISWidth: Warning : Width wasn't set" << "\n";
2119 di<<(-4);
2120 }
2121 }
2122 return 0;
2123 }
2124 }
2125 di << "AISWidth : Error" << "\n";
2126 di<<(-5);
2127 return 0;
2128}
2129
2130//=======================================================================
2131//function : BUC60921 ( & BUC60954 )
2132//purpose : Test memory allocation of OCAF in Undo/Redo operations
2133//=======================================================================
2134
2135static Standard_Integer BUC60921 (Draw_Interpretor& di,
2136 Standard_Integer nb,
2137 const char ** arg)
2138{
2139 if (nb >= 4) {
2140 Handle(TDocStd_Document) D;
2141 if (!DDocStd::GetDocument(arg[1],D)) {di<<1;return 0;}
2142 TDF_Label L;
2143 DDF::AddLabel(D->GetData(),arg[2],L);
2144
2145 BRep_Builder B;
2146 TopoDS_Shape S;
2147 BRepTools::Read ( S, arg[3], B );
2148
2149 TNaming_Builder tnBuild(L);
2150 tnBuild.Generated(S);
2151// di << "File " << arg[3] << " added";
2152 di<<0;
2153 return 0;
2154 }
2155 di << "BUC60921 Doc label brep_file: directly read brep file and put shape to the label" << "\n";
2156 di<<2;
2157 return 0;
2158}
2159
2160#include<IGESControl_Reader.hxx>
2161#include<BRepPrimAPI_MakeHalfSpace.hxx>
2162
2163static Standard_Integer BUC60951_(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
2164{
2165 //if(argc!=2)
2166 // {
2167 // cerr << "Usage : " << a[0] << " file.igs" << endl;
2168 // return -1;
2169 // }
2170 if(argc < 2 || argc > 3) {
2171 di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
2172 return 1;
2173 }
2174 Standard_Boolean IsBRepAlgoAPI = Standard_True;
2175 if (argc == 3) {
2176 Standard_Integer IsB = atoi(a[2]);
2177 if (IsB != 1) {
2178 IsBRepAlgoAPI = Standard_False;
2179#if ! defined(BRepAlgo_def01)
2180// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
2181// return 1;
2182#endif
2183 }
2184 }
2185
2186 Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
2187
2188 if(myContext.IsNull()) {
2189 di << "use 'vinit' command before " << a[0] << "\n";
2190 return -1;
2191 }
2192
2193// IGESControlStd_Reader reader;
2194 IGESControl_Reader reader;
2195 reader.ReadFile(a[1]);
2196 reader.TransferRoots();
2197 TopoDS_Shape shape = reader.OneShape();
2198 printf("\n iges1 shape type = %d", shape.ShapeType() );
2199 TopTools_IndexedMapOfShape list;
2200 TopExp::MapShapes(shape, TopAbs_FACE, list);
2201 printf("\n No. of faces = %d", list.Extent());
2202
2203 TopoDS_Shell shell;
2204 BRep_Builder builder;
2205 builder.MakeShell(shell);
2206 for(int i=1;i<=list.Extent(); i++) {
2207 TopoDS_Face face = TopoDS::Face(list.FindKey(i));
2208 builder.Add(shell, face);
2209 }
2210
2211 BRepPrimAPI_MakeHalfSpace half(shell, gp_Pnt(0, 0, 20));
2212 TopoDS_Solid sol = half.Solid();
2213 gp_Ax2 anAx2(gp_Pnt(-800.0, 0.0, 0), gp_Dir(0, 0, -1));
2214 BRepPrimAPI_MakeCylinder cyl(anAx2, 50, 300);
2215 TopoDS_Shape sh = cyl.Shape();
2216
2217//#if ! defined(BRepAlgoAPI_def01)
2218// BRepAlgoAPI_Fuse fuse(sol, sh);
2219//#else
2220// BRepAlgo_Fuse fuse(sol, sh);
2221//#endif
2222//
2223// sh = fuse.Shape();
2224
2225 if (IsBRepAlgoAPI) {
2226 di << "BRepAlgoAPI_Fuse fuse(sol, sh)" <<"\n";
2227 BRepAlgoAPI_Fuse fuse(sol, sh);
2228 sh = fuse.Shape();
2229 } else {
2230 di << "BRepAlgo_Fuse fuse(sol, sh)" <<"\n";
2231 BRepAlgo_Fuse fuse(sol, sh);
2232 sh = fuse.Shape();
2233 }
2234
2235 Handle(AIS_Shape) res = new AIS_Shape(sh);
2236 myContext->Display( res );
2237 return 0;
2238}
2239
2240void QABUC::Commands(Draw_Interpretor& theCommands) {
2241 const char *group = "QABUC";
2242
2243 theCommands.Add("BUC60623","BUC60623 result Shape1 Shape2",__FILE__,BUC60623,group);
2244 theCommands.Add("BUC60569","BUC60569 shape",__FILE__,BUC60569,group);
2245 theCommands.Add("BUC60614","BUC60614 shape",__FILE__,BUC60614,group);
2246 theCommands.Add("BUC60609","BUC60609 shape [name] [interactive (0|1)]",__FILE__,BUC60609,group);
2247#if ! defined(WNT)
2248 theCommands.Add("UKI61075","UKI61075",__FILE__,UKI61075,group);
2249#endif
2250 theCommands.Add("BUC60585",St,__FILE__,BUC60585,group);
2251 theCommands.Add("BUC60547","BUC60547 name",__FILE__,BUC60547,group);
2252 theCommands.Add("BUC60632","BUC60632 mode length",__FILE__,BUC60632,group);
2253 theCommands.Add("BUC60652","BUC60652 face",__FILE__,BUC60652,group);
2254 theCommands.Add("ksection","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);
2255 theCommands.Add("BUC60682","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);
2256 theCommands.Add("BUC60669","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);
2257 theCommands.Add("PRO19626","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);
2258 theCommands.Add("BUC60574","BUC60574 ",__FILE__,BUC60574,group);
2259
2260 theCommands.Add("BUC60698","BUC60698 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60698,group);
2261
2262 theCommands.Add("BUC60699","BUC60699 ",__FILE__,BUC60699,group);
2263 theCommands.Add("GER61394","GER61394 [1/0]",__FILE__,GER61394,group);
2264 theCommands.Add("GER61351","GER61351 name/object name/r g b/object r g b",__FILE__,setcolor,group);
2265 theCommands.Add("setcolor","setcolor name/object name/r g b/object r g b",__FILE__,setcolor,group);
2266
2267 theCommands.Add("BUC60726","BUC60726 0/1",__FILE__,BUC60726,group);
2268 theCommands.Add("BUC60729","BUC60729",__FILE__,BUC60729,group);
2269 theCommands.Add("BUC60724","BUC60724",__FILE__,BUC60724,group);
2270 theCommands.Add("BUC60727","BUC60727",__FILE__,BUC60727,group);
2271 theCommands.Add("BUC60792","BUC60792",__FILE__,BUC60792,group);
2272 theCommands.Add("BUC60811","BUC60811",__FILE__,BUC60811,group);
2273
2274 theCommands.Add("BUC60825","BUC60825",__FILE__,BUC60825,group);
2275
2276 theCommands.Add("OCC10006","OCC10006 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,OCC10006,group);
2277
2278 theCommands.Add("BUC60856","BUC60856",__FILE__,BUC60856,group);
2279
2280#if ! defined(WNT)
2281 theCommands.Add("coordload","load coord from file",__FILE__,coordload);
2282#endif
2283
2284 theCommands.Add("TestMem","TestMem",__FILE__,TestMem,group);
2285 theCommands.Add("BUC60945","BUC60945",__FILE__,TestMem,group);
2286 theCommands.Add("BUC60876","BUC60876 shape",__FILE__,BUC60876_,group);
2287 theCommands.Add("BUC60773","BUC60773",__FILE__,BUC60773,group);
2288
2289 theCommands.Add("TestCMD","TestCMD [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,TestCMD,group);
2290
2291 theCommands.Add("statface","statface face",__FILE__,statface,group);
2292
2293 theCommands.Add("BUC60841","BUC60841 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60841,group);
2294
2295 theCommands.Add("BUC60874","BUC60874",__FILE__,BUC60874,group);
2296
2297 theCommands.Add("BUC60817","BUC60817 D",__FILE__,BUC60817,group);
2298 theCommands.Add("BUC60831_1","BUC60831_1 D",__FILE__,BUC60831_1,group);
2299 theCommands.Add("BUC60831_2","BUC60831_2 D Label",__FILE__,BUC60831_2,group);
2300 theCommands.Add("BUC60836","BUC60836 D",__FILE__,BUC60836,group);
2301 theCommands.Add("BUC60847","BUC60847 D Shape",__FILE__,BUC60847,group);
2302 theCommands.Add("BUC60862","BUC60862 D Shape",__FILE__,BUC60862,group);
2303 theCommands.Add("BUC60867","BUC60867",__FILE__,BUC60867,group);
2304 theCommands.Add("BUC60910","BUC60910 D",__FILE__,BUC60910,group);
2305 theCommands.Add("BUC60925","BUC60925 D",__FILE__,BUC60925,group);
2306 theCommands.Add("BUC60932","BUC60932 D",__FILE__,BUC60932,group);
2307 theCommands.Add("AISWidth","AISWidth (DOC,entry,[width])",__FILE__,AISWidth,group);
2308 theCommands.Add("BUC60921","BUC60921 Doc label brep_file",__FILE__,BUC60921,group);
2309
2310 theCommands.Add("BUC60951","BUC60951 file.igs [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60951_, group );
2311
2312}