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