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