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