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