0026172: Visualization, AIS_LocalContext - locally selected object should not stay...
[occt.git] / src / QABugs / QABugs_19.cxx
CommitLineData
b311480e 1// Created on: 2002-05-21
2// Created by: QA Admin
973c2be1 3// Copyright (c) 2002-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
1cd84fee 16#include <QABugs.hxx>
7fd59977 17
18#include <Draw_Interpretor.hxx>
19#include <DBRep.hxx>
20#include <DrawTrSurf.hxx>
7fd59977 21#include <ViewerTest.hxx>
4a350f94 22#include <V3d_View.hxx>
7fd59977 23#include <TopoDS_Shape.hxx>
f376ac72 24#include <AIS_InteractiveContext.hxx>
c070aa39 25#include <AIS_LocalContext.hxx>
f376ac72 26#include <AIS_TexturedShape.hxx>
27#include <Image_PixMap.hxx>
28#include <Image_Color.hxx>
7fd59977 29
30#include <gp_Pnt2d.hxx>
f6f03db9 31#include <gp_Ax1.hxx>
7fd59977 32#include <GCE2d_MakeSegment.hxx>
33#include <Geom2d_TrimmedCurve.hxx>
34#include <DrawTrSurf.hxx>
35
f6f03db9 36#include <Precision.hxx>
37
7fd59977 38#include <PCollection_HAsciiString.hxx>
39
c2ae831c 40#include <cstdio>
41#include <cmath>
42#include <iostream>
c2ae831c 43#include <OSD_Timer.hxx>
c7b59798 44#include <OSD_Parallel.hxx>
45#include <OSD_PerfMeter.hxx>
c2ae831c 46#include <BRepPrimAPI_MakeBox.hxx>
47#include <BRepPrimAPI_MakeSphere.hxx>
48#include <BRepAlgo_Cut.hxx>
ab2db9a5 49#include <NCollection_Map.hxx>
dda67c1c 50#include <NCollection_Handle.hxx>
29cb310a 51#include <TCollection_HAsciiString.hxx>
2cd138b8 52#include <GeomFill_Trihedron.hxx>
53#include <BRepOffsetAPI_MakePipe.hxx>
ee6bb37b 54#include <Standard_Atomic.hxx>
29cb310a 55
05d7de53 56#include <Standard_Version.hxx>
57
29cb310a 58#define QCOMPARE(val1, val2) \
59 di << "Checking " #val1 " == " #val2 << \
60 ((val1) == (val2) ? ": OK\n" : ": Error\n")
d2786814 61
7fd59977 62static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
63{
64 if ( argc != 4) {
65 di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
66 return 1;
67 }
68
69 gp_Pnt2d P1, P2;
70 if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
71 di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
72 return 1;
73 }
74 if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
75 di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
76 return 1;
77 }
78
79 GCE2d_MakeSegment MakeSegment(P1,P2);
80 Handle(Geom2d_TrimmedCurve) TrimmedCurve = MakeSegment.Value();
81 DrawTrSurf::Set(argv[1], TrimmedCurve);
82 return 0;
83}
84
85static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
86{
87 for(Standard_Integer i= 0;i <= 20;i++){
88 Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
89 pstr->Clear();
90 }
91 di << "OCC142: OK" << "\n";
92 return 0;
93}
94
f6f03db9 95static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
96{
97 gp_Pnt p(0, 0, 2);
98
99 gp_Trsf t1, t2;
100 t1.SetRotation(gp_Ax1(p, gp_Dir(0, 1, 0)), -0.49328285294022267);
101 t2.SetRotation(gp_Ax1(p, gp_Dir(0, 0, 1)), 0.87538474718473880);
102
103 gp_Trsf tComp = t2 * t1;
104
105 gp_Pnt p1(10, 3, 4);
106 gp_Pnt p2 = p1.Transformed(tComp);
107 gp_Pnt p3 = p1.Transformed(t1);
108 p3.Transform(t2);
109
110 // points must be equal
111 if ( ! p2.IsEqual(p3, Precision::Confusion()) )
112 di << "ERROR OCC23361: equivalent transformations does not produce equal points" << "\n";
113 else
114 di << "OCC23361: OK" << "\n";
115
116 return 0;
117}
118
c2ae831c 119static Standard_Integer OCC23237 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
120{
121 OSD_PerfMeter aPM("TestMeter",0);
122 OSD_Timer aTM;
123
124 // run some operation in cycle for about 2 seconds to have good values of times to compare
125 int count = 0;
126 printf("OSD_PerfMeter test.\nRunning Boolean operation on solids in loop.\n");
127 for (; aTM.ElapsedTime() < 2.; count++)
128 {
129 aPM.Start();
130 aTM.Start();
131
b3a7aa39 132 // do some operation that will take considerable time compared with time of starting / stopping timers
c2ae831c 133 BRepPrimAPI_MakeBox aBox (10., 10., 10.);
134 BRepPrimAPI_MakeSphere aSphere (10.);
b3a7aa39 135 BRepAlgo_Cut aCutter (aBox.Shape(), aSphere.Shape());
c2ae831c 136
137 aTM.Stop();
138 aPM.Stop();
139 }
140
141 int aNbEnters = 0;
142 Standard_Real aPerfMeter_CPUtime = 0., aTimer_ElapsedTime = aTM.ElapsedTime();
143
144 perf_get_meter("TestMeter", &aNbEnters, &aPerfMeter_CPUtime);
145
146 Standard_Real aTimeDiff = (fabs(aTimer_ElapsedTime - aPerfMeter_CPUtime) / aTimer_ElapsedTime);
147
148 printf("\nMeasurement results (%d cycles):\n", count);
149 printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer elapsed time: %lf\n", aPerfMeter_CPUtime, aTimer_ElapsedTime);
150 printf("Time delta is: %.3lf %%\n", aTimeDiff * 100);
151
152 if (aTimeDiff > 0.2)
153 di << "OCC23237: Error: too much difference between CPU and elapsed times";
154 else if (aNbEnters != count)
155 di << "OCC23237: Error: counter reported by PerfMeter (" << aNbEnters << ") does not correspond to actual number of cycles";
156 else
157 di << "OCC23237: OK";
158
159 return 0;
160}
161
1365140b
RL
162class IncrementerDecrementer
163{
164public:
165 IncrementerDecrementer (Standard_Integer* theVal, Standard_Boolean thePositive) : myVal (theVal), myPositive (thePositive)
166 {}
c7b59798 167 void operator() (const size_t) const
1365140b 168 {
c7b59798 169 if ( myPositive )
170 Standard_Atomic_Increment(myVal);
171 else
172 Standard_Atomic_Decrement(myVal);
1365140b
RL
173 }
174private:
175 Standard_Integer* myVal;
c7b59798 176 Standard_Boolean myPositive;
1365140b 177};
1365140b 178
1365140b
RL
179static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
180{
181 int aSum = 0;
182
183 //check returned value
184 QCOMPARE (Standard_Atomic_Decrement (&aSum), -1);
185 QCOMPARE (Standard_Atomic_Increment (&aSum), 0);
186 QCOMPARE (Standard_Atomic_Increment (&aSum), 1);
187 QCOMPARE (Standard_Atomic_Increment (&aSum), 2);
188// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 0);
189// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 1);
190
191 //check atomicity
192 aSum = 0;
193 const int N = 1 << 24; //big enough to ensure concurrency
194
195 //increment
c7b59798 196 OSD_Parallel::For(0, N, IncrementerDecrementer (&aSum, true));
1365140b
RL
197 QCOMPARE (aSum, N);
198
199 //decrement
c7b59798 200 OSD_Parallel::For(0, N, IncrementerDecrementer (&aSum, false));
1365140b
RL
201 QCOMPARE (aSum, 0);
202
203 return 0;
204}
205
e6aad0ee
RL
206#include <TDocStd_Application.hxx>
207#include <XCAFApp_Application.hxx>
208#include <TDocStd_Document.hxx>
209#include <XCAFDoc_ShapeTool.hxx>
210#include <XCAFDoc_DocumentTool.hxx>
211#include <TDF_Label.hxx>
212#include <TDataStd_Name.hxx>
213
773f53f1 214static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
e6aad0ee
RL
215{
216 const Handle(TDocStd_Application)& anApp = XCAFApp_Application::GetApplication();
217 Handle(TDocStd_Document) aDoc;
218 anApp->NewDocument ("XmlXCAF", aDoc);
219 QCOMPARE (!aDoc.IsNull(), Standard_True);
220
221 Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
222
223 //check default value
224 Standard_Boolean aValue = XCAFDoc_ShapeTool::AutoNaming();
225 QCOMPARE (aValue, Standard_True);
226
227 //true
228 XCAFDoc_ShapeTool::SetAutoNaming (Standard_True);
229 TopoDS_Shape aShape = BRepPrimAPI_MakeBox (100., 200., 300.).Shape();
230 TDF_Label aLabel = aShTool->AddShape (aShape);
231 Handle(TDataStd_Name) anAttr;
232 QCOMPARE (aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
233
234 //false
235 XCAFDoc_ShapeTool::SetAutoNaming (Standard_False);
236 aShape = BRepPrimAPI_MakeBox (300., 200., 100.).Shape();
237 aLabel = aShTool->AddShape (aShape);
238 QCOMPARE (!aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
239
240 //restore
241 XCAFDoc_ShapeTool::SetAutoNaming (aValue);
242
243 return 0;
244}
245
5d1833ef 246#include <ExprIntrp_GenExp.hxx>
247Standard_Integer OCC22611 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
248{
249
250 if (argc != 3) {
251 di << "Usage : " << argv[0] << " string nb\n";
252 return 1;
253 }
254
255 TCollection_AsciiString aToken = argv[1];
256 Standard_Integer aNb = atoi(argv[2]);
257
258 Handle(ExprIntrp_GenExp) aGen = ExprIntrp_GenExp::Create();
259 for (Standard_Integer i=0; i < aNb; i++)
260 {
261 aGen->Process(aToken);
262 Handle(Expr_GeneralExpression) aExpr = aGen->Expression();
263 }
264
265 return 0;
266}
267
35e08fe8 268Standard_Integer OCC22595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
e187cc0a 269{
270 gp_Mat M0;
271 di << "M0 = "
272 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}"
273 << " {" << M0(2,1) << "} {" << M0(2,2) << "} {" << M0(2,3) <<"}"
274 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}";
275 return 0;
276}
277
bead40f2 278#include <TopoDS_Face.hxx>
279#include <TopoDS_Face.hxx>
280#include <TopoDS.hxx>
281#include <BRepBuilderAPI_Transform.hxx>
282#include <BRepExtrema_DistShapeShape.hxx>
283#include <BRepTools.hxx>
284
f24125b9 285static Standard_Boolean OCC23774Test(const TopoDS_Face& grossPlateFace, const TopoDS_Shape& originalWire, Draw_Interpretor& di)
bead40f2 286{
287 BRepExtrema_DistShapeShape distShapeShape(grossPlateFace,originalWire,Extrema_ExtFlag_MIN);
288 if(!distShapeShape.IsDone()) {
289 di <<"Distance ShapeShape is Not Done\n";
290 return Standard_False;
291 }
292
293 if(distShapeShape.Value() > 0.01) {
294 di << "Wrong Dist = " <<distShapeShape.Value() << "\n";
295 return Standard_False;
296 } else
297 di << "Dist0 = " <<distShapeShape.Value() <<"\n";
298
299 //////////////////////////////////////////////////////////////////////////
300 /// First Flip Y
301 const gp_Pnt2d axis1P1(1474.8199035519228,1249.9995745636970);
302 const gp_Pnt2d axis1P2(1474.8199035519228,1250.9995745636970);
303
304 gp_Vec2d mirrorVector1(axis1P1,axis1P2);
305
306 gp_Trsf2d mirror1;
307 mirror1.SetMirror(gp_Ax2d(axis1P1,mirrorVector1));
308
309 BRepBuilderAPI_Transform transformer1(mirror1);
310 transformer1.Perform(originalWire);
311 if(!transformer1.IsDone()) {
312 di << "Not Done1 " << "\n";
313 return Standard_False;
314 }
346cf025 315 TopoDS_Shape step1ModifiedShape = transformer1.ModifiedShape(originalWire);
bead40f2 316
317 BRepExtrema_DistShapeShape distShapeShape1(grossPlateFace,step1ModifiedShape,Extrema_ExtFlag_MIN);
318 if(!distShapeShape1.IsDone())
319 return Standard_False;
320 if(distShapeShape1.Value() > 0.01) {
321 di << "Dist = " <<distShapeShape1.Value() <<"\n";
322 return Standard_False;
323 } else
324 di << "Dist1 = " <<distShapeShape1.Value() <<"\n";
325
326 //////////////////////////////////////////////////////////////////////////
327 /// Second flip Y
328 transformer1.Perform(step1ModifiedShape);
329 if(!transformer1.IsDone()) {
330 di << "Not Done1 \n";
331 return Standard_False;
332 }
346cf025 333 TopoDS_Shape step2ModifiedShape = transformer1.ModifiedShape(step1ModifiedShape);
bead40f2 334
335 //This is identity matrix for values but for type is gp_Rotation ?!
336 gp_Trsf2d mirror11 = mirror1;
337 mirror11.PreMultiply(mirror1);
338
339 BRepExtrema_DistShapeShape distShapeShape2(grossPlateFace,step2ModifiedShape);//,Extrema_ExtFlag_MIN);
340 if(!distShapeShape2.IsDone())
341 return Standard_False;
342
343 //This last test case give error (the value is 1008.8822038689706)
344 if(distShapeShape2.Value() > 0.01) {
345 di << "Wrong Dist2 = " <<distShapeShape2.Value() <<"\n";
346 Standard_Integer N = distShapeShape2.NbSolution();
347 di << "Nb = " <<N <<"\n";
348 for (Standard_Integer i=1;i <= N;i++)
349 di <<"Sol(" <<i<<") = " <<distShapeShape2.PointOnShape1(i).Distance(distShapeShape2.PointOnShape2(i)) <<"\n";
350 return Standard_False;
351 }
352 di << "Distance2 = " <<distShapeShape2.Value() <<"\n";
353
354 return Standard_True;
355}
356static Standard_Integer OCC23774(Draw_Interpretor& di, Standard_Integer n, const char** a)
357{
358
359 if (n != 3) {
360 di <<"OCC23774: invalid number of input parameters\n";
361 return 1;
362 }
363
364 const char *ns1 = (a[1]), *ns2 = (a[2]);
365 TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
366 if (S1.IsNull() || S2.IsNull()) {
367 di <<"OCC23774: Null input shapes\n";
368 return 1;
369 }
370 const TopoDS_Face& aFace = TopoDS::Face(S1);
371 if(!OCC23774Test(aFace, S2, di))
372 di << "Something is wrong\n";
373
374 return 0;
375}
376
1ef32e96
RL
377#include <GeomConvert_ApproxSurface.hxx>
378#include <Geom_BSplineSurface.hxx>
379#include <Draw.hxx>
380#include <OSD_Thread.hxx>
1ef32e96 381
7a5f1202 382struct GeomConvertTest_Data
383{
384 Standard_Integer nbupoles;
385 Handle(Geom_Surface) surf;
1ef32e96
RL
386};
387
7a5f1202 388static Standard_Address GeomConvertTest (Standard_Address data)
1ef32e96 389{
7a5f1202 390 GeomConvertTest_Data* info = (GeomConvertTest_Data*)data;
391
392 GeomConvert_ApproxSurface aGAS (info->surf, 1e-4, GeomAbs_C1, GeomAbs_C1, 9, 9, 100, 1);
393 if (!aGAS.IsDone()) {
394 cout << "Error: ApproxSurface is not done!" << endl;
395 return Standard_False;
396 }
397 const Handle(Geom_BSplineSurface)& aBSurf = aGAS.Surface();
398 if (aBSurf.IsNull()) {
399 cout << "Error: BSplineSurface is not created!" << endl;
400 return Standard_False;
401 }
402 cout << "Number of UPoles:" << aBSurf->NbUPoles();
403 if (aBSurf->NbUPoles() == info->nbupoles)
404 {
405 cout << ": OK" << endl;
406 return data; // any non-null pointer
407 }
408 else
409 {
410 cout << ": Error, must be " << info->nbupoles << endl;
411 return 0;
412 }
1ef32e96
RL
413}
414
415static Standard_Integer OCC23952sweep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
416{
7a5f1202 417 if (argc != 3) {
418 cout << "Error: invalid number of arguments" << endl;
419 return 1;
420 }
421
422 struct GeomConvertTest_Data aStorage;
423 aStorage.nbupoles = Draw::Atoi(argv[1]);
424 aStorage.surf = DrawTrSurf::GetSurface(argv[2]);
425 if (aStorage.surf.IsNull())
426 {
427 cout << "Error: " << argv[2] << " is not a DRAW surface!" << endl;
428 return 0;
429 }
430
431 // start conversion in several threads
432 const int NBTHREADS = 100;
433 OSD_Thread aThread[NBTHREADS];
434 for (int i=0; i < NBTHREADS; i++)
435 {
436 aThread[i].SetFunction (GeomConvertTest);
437 if (!aThread[i].Run(&aStorage))
438 di << "Error: Cannot start thread << " << i << "\n";
439 }
440
441 // check results
442 for (int i=0; i < NBTHREADS; i++)
443 {
444 Standard_Address aResult = 0;
445 if (!aThread[i].Wait(aResult))
446 di << "Error: Failed waiting for thread << " << i << "\n";
447 if (!aResult)
448 di << "Error: wrong number of poles in thread " << i << "!\n";
449 }
450
451 return 0;
1ef32e96 452}
d2786814 453
1ef32e96 454#include <GeomInt_IntSS.hxx>
1ef32e96 455
7a5f1202 456struct GeomIntSSTest_Data
457{
458 Standard_Integer nbsol;
459 Handle(Geom_Surface) surf1, surf2;
1ef32e96 460};
7a5f1202 461
462static Standard_Address GeomIntSSTest (Standard_Address data)
1ef32e96 463{
7a5f1202 464 GeomIntSSTest_Data* info = (GeomIntSSTest_Data*)data;
465 GeomInt_IntSS anInter;
466 anInter.Perform (info->surf1, info->surf2, Precision::Confusion(), Standard_True);
467 if (!anInter.IsDone()) {
468 cout << "An intersection is not done!" << endl;
469 return 0;
470 }
471
472 cout << "Number of Lines:" << anInter.NbLines();
473 if (anInter.NbLines() == info->nbsol)
474 {
475 cout << ": OK" << endl;
476 return data; // any non-null pointer
477 }
478 else
479 {
480 cout << ": Error, must be " << info->nbsol << endl;
481 return 0;
482 }
1ef32e96
RL
483}
484
485static Standard_Integer OCC23952intersect (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
486{
7a5f1202 487 if (argc != 4) {
488 cout << "Error: invalid number of arguments" << endl;
489 return 1;
490 }
491
492 struct GeomIntSSTest_Data aStorage;
493 aStorage.nbsol = Draw::Atoi(argv[1]);
494 aStorage.surf1 = DrawTrSurf::GetSurface(argv[2]);
495 aStorage.surf2 = DrawTrSurf::GetSurface(argv[3]);
496 if (aStorage.surf1.IsNull() || aStorage.surf2.IsNull())
497 {
498 cout << "Error: Either " << argv[2] << " or " << argv[3] << " is not a DRAW surface!" << endl;
499 return 0;
500 }
501
502 // start conversion in several threads
503 const int NBTHREADS = 100;
504 OSD_Thread aThread[NBTHREADS];
505 for (int i=0; i < NBTHREADS; i++)
506 {
507 aThread[i].SetFunction (GeomIntSSTest);
508 if (!aThread[i].Run(&aStorage))
509 di << "Error: Cannot start thread << " << i << "\n";
510 }
511
512 // check results
513 for (int i=0; i < NBTHREADS; i++)
514 {
515 Standard_Address aResult = 0;
516 if (!aThread[i].Wait(aResult))
517 di << "Error: Failed waiting for thread << " << i << "\n";
518 if (!aResult)
519 di << "Error: wrong number of intersections in thread " << i << "!\n";
520 }
521
522 return 0;
1ef32e96
RL
523}
524
525#include <Geom_SurfaceOfRevolution.hxx>
06be28a4
RL
526static Standard_Integer OCC23683 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
527{
528 if (argc < 2) {
529 di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
530 return 1;
531 }
532
533 Standard_Integer ucontinuity = 1;
534 Standard_Integer vcontinuity = 1;
535 Standard_Boolean iscnu = false;
536 Standard_Boolean iscnv = false;
537
538 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[1]);
539
540 QCOMPARE (aSurf->IsCNu (ucontinuity), iscnu);
541 QCOMPARE (aSurf->IsCNv (vcontinuity), iscnv);
542
543 return 0;
544}
545
1939140c 546#include <gp_Ax1.hxx>
547#include <gp_Ax22d.hxx>
548#include <Geom_Plane.hxx>
549#include <Geom2d_Circle.hxx>
550#include <Geom2d_TrimmedCurve.hxx>
551#include <BRepBuilderAPI_MakeEdge.hxx>
552#include <BRepPrimAPI_MakeRevol.hxx>
553#include <Geom2d_OffsetCurve.hxx>
554
555static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
556{
557 // Check the command arguments
558 if ( argc != 1 )
559 {
560 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
561 di << "Usage: type help " << argv[0] << "\n";
562 return 1; // TCL_ERROR
563 }
564
565 gp_Ax1 RotoAx( gp::Origin(), gp::DZ() );
566 gp_Ax22d Ax2( gp::Origin2d(), gp::DY2d(), gp::DX2d() );
567 Handle(Geom_Surface) Plane = new Geom_Plane( gp::YOZ() );
568
569 di << "<<<< Preparing sample surface of revolution based on trimmed curve >>>>" << "\n";
570 di << "-----------------------------------------------------------------------" << "\n";
571
572 Handle(Geom2d_Circle) C2d1 = new Geom2d_Circle(Ax2, 1.0);
573 Handle(Geom2d_TrimmedCurve) C2d1Trimmed = new Geom2d_TrimmedCurve(C2d1, 0.0, M_PI/2.0);
574 TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(C2d1Trimmed, Plane);
575
576 DBRep::Set("e1", E1);
577
578 BRepPrimAPI_MakeRevol aRevolBuilder1(E1, RotoAx);
579 TopoDS_Face F1 = TopoDS::Face( aRevolBuilder1.Shape() );
580
581 DBRep::Set("f1", F1);
582
583 di << "Result: f1" << "\n";
584
585 di << "<<<< Preparing sample surface of revolution based on offset curve >>>>" << "\n";
586 di << "-----------------------------------------------------------------------" << "\n";
587
588 Handle(Geom2d_OffsetCurve) C2d2Offset = new Geom2d_OffsetCurve(C2d1Trimmed, -0.5);
589 TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(C2d2Offset, Plane);
590
591 DBRep::Set("e2", E2);
592
593 BRepPrimAPI_MakeRevol aRevolBuilder2(E2, RotoAx);
594 TopoDS_Face F2 = TopoDS::Face( aRevolBuilder2.Shape() );
595
596 DBRep::Set("f2", F2);
597
598 di << "Result: f2" << "\n";
599
600 return 0;
601}
602
2e9fd4bc 603#include <Geom_Curve.hxx>
604#include <Geom_Surface.hxx>
605#include <Precision.hxx>
606#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
607//=======================================================================
608//function : OCC24008
609//purpose :
610//=======================================================================
611static Standard_Integer OCC24008 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
612{
613 if (argc != 3) {
614 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
615 return 1;
616 }
617 Handle(Geom_Curve) aCurve = DrawTrSurf::GetCurve(argv[1]);
618 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[2]);
619 if (aCurve.IsNull()) {
620 di << "Curve was not read" << "\n";
621 return 1;
622 }
623 if (aSurf.IsNull()) {
624 di << "Surface was not read" << "\n";
625 return 1;
626 }
627 ShapeConstruct_ProjectCurveOnSurface aProj;
628 aProj.Init (aSurf, Precision::Confusion());
629 try {
630 Handle(Geom2d_Curve) aPCurve;
631 aProj.Perform (aCurve, aCurve->FirstParameter(), aCurve->LastParameter(), aPCurve);
632 if (aPCurve.IsNull()) {
633 di << "PCurve was not created" << "\n";
634 return 1;
635 }
636 } catch (...) {
637 di << "Exception was caught" << "\n";
638 }
639 return 0;
640}
641
470ebb43 642#include <GeomAdaptor_Surface.hxx>
643#include <Draw.hxx>
644//=======================================================================
645//function : OCC23945
646//purpose :
647//=======================================================================
648
35e08fe8 649static Standard_Integer OCC23945 (Draw_Interpretor& /*di*/,Standard_Integer n, const char** a)
470ebb43 650{
651 if (n < 5) return 1;
652
653 Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(a[1]);
654 if (aS.IsNull()) return 1;
655
656 GeomAdaptor_Surface GS(aS);
657
658 Standard_Real U = Draw::Atof(a[2]);
659 Standard_Real V = Draw::Atof(a[3]);
660
661 Standard_Boolean DrawPoint = ( n%3 == 2);
662 if ( DrawPoint) n--;
663
664 gp_Pnt P;
665 if (n >= 13) {
666 gp_Vec DU,DV;
667 if (n >= 22) {
668 gp_Vec D2U,D2V,D2UV;
669 GS.D2(U,V,P,DU,DV,D2U,D2V,D2UV);
670 Draw::Set(a[13],D2U.X());
671 Draw::Set(a[14],D2U.Y());
672 Draw::Set(a[15],D2U.Z());
673 Draw::Set(a[16],D2V.X());
674 Draw::Set(a[17],D2V.Y());
675 Draw::Set(a[18],D2V.Z());
676 Draw::Set(a[19],D2UV.X());
677 Draw::Set(a[20],D2UV.Y());
678 Draw::Set(a[21],D2UV.Z());
679 }
680 else
681 GS.D1(U,V,P,DU,DV);
682
683 Draw::Set(a[7],DU.X());
684 Draw::Set(a[8],DU.Y());
685 Draw::Set(a[9],DU.Z());
686 Draw::Set(a[10],DV.X());
687 Draw::Set(a[11],DV.Y());
688 Draw::Set(a[12],DV.Z());
689 }
690 else
691 GS.D0(U,V,P);
692
693 if ( n > 6) {
694 Draw::Set(a[4],P.X());
695 Draw::Set(a[5],P.Y());
696 Draw::Set(a[6],P.Z());
697 }
698 if ( DrawPoint) {
699 DrawTrSurf::Set(a[n],P);
700 }
701
702 return 0;
703}
704
4bee43a9
P
705#include <Voxel_BoolDS.hxx>
706#include <Voxel_FastConverter.hxx>
707#include <Voxel_BooleanOperation.hxx>
708static Standard_Integer OCC24019 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
709{
710 if ( argc != 2 ) {
711 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
712 return 1;
713 }
714
715 TCollection_AsciiString aFileName = argv[1];
716 TopoDS_Shape aShape;
717 BRep_Builder aBuilder;
718
719 if (!BRepTools::Read(aShape, aFileName.ToCString(), aBuilder)) {
720 di << "Error: Could not read a shape!" << "\n";
721 return 1;
722 }
723
724 TopoDS_Solid aShape1 = BRepPrimAPI_MakeSphere(gp_Pnt(20,25,35), 7);
725
726 Standard_Real deflection = 0.005;
727 Standard_Integer nbThreads = 1;
728 Standard_Integer nbx = 200, nby = 200, nbz = 200;
729 Voxel_BoolDS theVoxels(0,0,0, 50, 50, 50, nbx, nby, nbz);
730 Voxel_BoolDS theVoxels1(0,0,0, 50, 50, 50, nbx, nby, nbz);
731
732 Standard_Integer progress = 0;
733 Voxel_FastConverter fcp(aShape, theVoxels, deflection, nbx, nby, nbz, nbThreads);
734 fcp.ConvertUsingSAT(progress, 1);
735 fcp.FillInVolume(1);
736
737 Voxel_FastConverter fcp1(aShape1, theVoxels1, deflection, nbx, nby, nbz, nbThreads);
738 fcp1.ConvertUsingSAT(progress, 1);
739 fcp1.FillInVolume(1);
740
741 Voxel_BooleanOperation op;
742 Standard_Boolean result = op.Cut(theVoxels1, theVoxels);
743 if ( result != 1 ) {
744 di << "Error: invalid boolean operation" << "\n";
745 } else {
746 di << "OK: boolean operation is ok" << "\n";
747 }
748
749 return 0;
750}
751
29cb310a 752//=======================================================================
753//function : OCC11758
754//purpose :
755//=======================================================================
498ce76b 756static Standard_Integer OCC11758 (Draw_Interpretor& di, Standard_Integer n, const char**)
29cb310a 757{
758 if (n != 1) return 1;
759
760 const char* theStr = "0123456789";
761 Standard_Integer i, j;
762 for ( i = 0; i < 5; ++i ) {
763 // TCollection_AsciiString(const Standard_CString astring)
764 TCollection_AsciiString a(theStr+i);
765 // IsEqual (const Standard_CString other)const
766 //assert( a == theStr+i );
767 QCOMPARE ( a , theStr+i );
768
769 //TCollection_AsciiString(const Standard_CString astring,const Standard_Integer aLen )
770 TCollection_AsciiString b(theStr+i, 3);
771 //assert( b.Length() == 3 );
772 //assert( strncmp( b.ToCString(), theStr+i, 3 ) == 0 );
773 //assert( strlen( b.ToCString() ) == 3 );
774 QCOMPARE ( b.Length() , 3 );
775 QCOMPARE ( strncmp( b.ToCString() , theStr+i, 3 ) , 0 );
776 QCOMPARE ( b.Length() , 3 );
777
778 //TCollection_AsciiString(const Standard_Integer aValue)
779 TCollection_AsciiString c(i);
780 //assert( c.IsIntegerValue() );
781 //assert( c.IntegerValue() == i );
782 QCOMPARE ( c.IsIntegerValue() , Standard_True );
783 QCOMPARE ( c.IntegerValue() , i );
784
785 //TCollection_AsciiString(const Standard_Real aValue)
786 TCollection_AsciiString d( 0.1*i );
787 //assert( d.IsRealValue() );
788 //assert( TCollection_AsciiString(3.3) == "3.3");
789 QCOMPARE ( d.IsRealValue() , Standard_True );
790 QCOMPARE ( TCollection_AsciiString(3.3) , "3.3" );
791
792 //TCollection_AsciiString(const TCollection_AsciiString& astring)
793 TCollection_AsciiString e(d);
794 //assert( e == d );
795 //assert( e.Length() == d.Length() );
796 //assert( strcmp( e.ToCString(), d.ToCString() ) == 0 );
797 QCOMPARE ( e ,d );
798 QCOMPARE ( e.Length() , d.Length() );
799 QCOMPARE ( strcmp( e.ToCString(), d.ToCString() ) , 0 );
800
801 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
802 // const Standard_Character other )
803 TCollection_AsciiString f(e,'\a');
804 //assert( f.Length() == e.Length() + 1 );
805 //assert( strncmp( f.ToCString(), e.ToCString(), e.Length() ) == 0 );
806 //assert( f.Value( f.Length() ) == '\a');
807 QCOMPARE ( f.Length() , e.Length() + 1 );
808 QCOMPARE ( strncmp( f.ToCString(), e.ToCString(), e.Length() ) , 0 );
809 QCOMPARE ( f.Value( f.Length() ) , '\a' );
810
811 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
812 // const Standard_CString other )
813 TCollection_AsciiString g(f, theStr);
814 //assert( g.Length() == f.Length() + strlen( theStr ));
815 //assert( strncmp( g.ToCString(), f.ToCString(), f.Length() ) == 0 );
816 //assert( g.Search( theStr ) == f.Length() + 1 );
817 QCOMPARE ( g.Length() , f.Length() + (Standard_Integer)strlen( theStr ) );
818 QCOMPARE ( strncmp( g.ToCString(), f.ToCString(), f.Length() ) , 0 );
819 QCOMPARE ( g.Search( theStr ) , f.Length() + 1 );
820
821 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
822 // const TCollection_AsciiString& other )
823 TCollection_AsciiString h(d,a);
824 //assert( h.Length() == d.Length() + a.Length() );
825 //assert( strncmp( h.ToCString(), d.ToCString(), d.Length() ) == 0 );
826 //assert( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) == 0 );
827 QCOMPARE ( h.Length() , d.Length() + a.Length() );
828 QCOMPARE ( strncmp( h.ToCString(), d.ToCString(), d.Length() ) , 0 );
829 QCOMPARE ( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) , 0 );
830
831 // AssignCat(const Standard_CString other)
832 c.AssignCat( a.ToCString() );
833 //assert( c.Length() == 1 + a.Length() );
834 //assert( c.Search( a ) == 2 );
835 QCOMPARE ( c.Length() , 1 + a.Length() );
836 QCOMPARE ( c.Search( a ) , 2 );
837
838 // AssignCat(const TCollection_AsciiString& other)
839 Standard_Integer dl = d.Length();
840 d.AssignCat( a );
841 //assert( d.Length() == dl + a.Length() );
842 //assert( d.Search( a ) == dl + 1 );
843 QCOMPARE ( d.Length() , dl + a.Length() );
844 QCOMPARE ( d.Search( a ) , dl + 1 );
845
846 // Capitalize()
847 TCollection_AsciiString capitalize("aBC");
848 capitalize.Capitalize();
849 //assert( capitalize == "Abc" );
850 QCOMPARE ( capitalize , "Abc" );
851
852 // Copy(const Standard_CString fromwhere)
853 d = theStr+i;
854 //assert( d == theStr+i );
855 QCOMPARE ( d , theStr+i );
856
857 // Copy(const TCollection_AsciiString& fromwhere)
858 d = h;
859 // IsEqual (const TCollection_AsciiString& other)const
860 //assert( d == h );
861 QCOMPARE ( d , h );
862
863 // Insert(const Standard_Integer where, const Standard_CString what)
864 dl = d.Length();
865 d.Insert( 2, theStr );
866 //assert( d.Length() == dl + strlen( theStr ));
867 //assert( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) == 0 );
868 QCOMPARE ( d.Length() , dl + (Standard_Integer)strlen( theStr ) );
869 QCOMPARE ( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) , 0 );
870
871 //Insert(const Standard_Integer where,const Standard_Character what)
872 d = theStr;
873 d.Insert( i+1, 'i' );
874 //assert( d.Length() == strlen( theStr ) + 1 );
875 //assert( d.Value( i+1 ) == 'i');
876 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
877 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
878 QCOMPARE ( d.Value( i+1 ) , 'i' );
879 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
880
881 //Insert(const Standard_Integer where,const TCollection_AsciiString& what)
882 d = theStr;
883 d.Insert( i+1, TCollection_AsciiString( "i" ));
884 //assert( d.Length() == strlen( theStr ) + 1 );
885 //assert( d.Value( i+1 ) == 'i');
886 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
887 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
888 QCOMPARE ( d.Value( i+1 ) , 'i' );
889 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
890
891 // IsDifferent (const Standard_CString other)const
892 //assert( d.IsDifferent( theStr ));
893 //assert( d.IsDifferent( "theStr" ));
894 //assert( d.IsDifferent( "" ));
895 //assert( !d.IsDifferent( d.ToCString() ));
896 QCOMPARE ( d.IsDifferent( theStr ) , Standard_True );
897 QCOMPARE ( d.IsDifferent( "theStr" ) , Standard_True );
898 QCOMPARE ( d.IsDifferent( "" ) , Standard_True );
899 QCOMPARE ( !d.IsDifferent( d.ToCString() ) , Standard_True );
900
901 // IsDifferent (const TCollection_AsciiString& other)const
902 //assert( d.IsDifferent( TCollection_AsciiString() ));
903 //assert( d.IsDifferent( a ));
904 //assert( d.IsDifferent( h ));
905 //assert( !d.IsDifferent( d ));
906 QCOMPARE ( d.IsDifferent( TCollection_AsciiString() ) , Standard_True );
907 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
908 QCOMPARE ( d.IsDifferent( h ) , Standard_True );
909 QCOMPARE ( !d.IsDifferent( d ) , Standard_True );
910
911 // IsLess (const Standard_CString other)const
912 //assert( TCollection_AsciiString ("0"). IsLess("1"));
913 //assert( TCollection_AsciiString ("0"). IsLess("00"));
914 //assert( TCollection_AsciiString (""). IsLess("0"));
915 //assert( !TCollection_AsciiString("1"). IsLess("0"));
916 //assert( !TCollection_AsciiString("00").IsLess("0"));
917 //assert( !TCollection_AsciiString("0"). IsLess(""));
918 //assert( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1));
919 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("1") , Standard_True );
920 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("00") , Standard_True );
921 QCOMPARE ( TCollection_AsciiString (""). IsLess("0") , Standard_True );
922 QCOMPARE ( !TCollection_AsciiString("1"). IsLess("0"), Standard_True );
923 QCOMPARE ( !TCollection_AsciiString("00").IsLess("0") , Standard_True );
924 QCOMPARE ( !TCollection_AsciiString("0"). IsLess("") , Standard_True );
925 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1) , Standard_True );
926
927 // IsLess (const TCollection_AsciiString& other)const
928 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )));
929 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")));
930 //assert( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )));
931 //assert( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )));
932 //assert( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )));
933 //assert( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )));
934 //assert( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)));
935 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )) , Standard_True );
936 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")) , Standard_True );
937 QCOMPARE ( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )) , Standard_True );
938 QCOMPARE ( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )) , Standard_True );
939 QCOMPARE ( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )) , Standard_True );
940 QCOMPARE ( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )) , Standard_True );
941 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)) , Standard_True );
942
943 // IsGreater (const Standard_CString other)const
944 //assert( !TCollection_AsciiString("0"). IsGreater("1"));
945 //assert( !TCollection_AsciiString("0"). IsGreater("00"));
946 //assert( !TCollection_AsciiString(""). IsGreater("0"));
947 //assert( TCollection_AsciiString ("1"). IsGreater("0"));
948 //assert( TCollection_AsciiString ("00").IsGreater("0"));
949 //assert( TCollection_AsciiString ("0"). IsGreater(""));
950 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i));
951 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("1") , Standard_True );
952 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("00") , Standard_True );
953 QCOMPARE ( !TCollection_AsciiString(""). IsGreater("0") , Standard_True );
954 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater("0") , Standard_True );
955 QCOMPARE ( TCollection_AsciiString ("00").IsGreater("0") , Standard_True );
956 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater("") , Standard_True );
957 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i) , Standard_True );
958
959 // IsGreater (const TCollection_AsciiString& other)const
960 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )));
961 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")));
962 //assert( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )));
963 //assert( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )));
964 //assert( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )));
965 //assert( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )));
966 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)));
967 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )) , Standard_True );
968 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")) , Standard_True );
969 QCOMPARE ( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
970 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
971 QCOMPARE ( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )) , Standard_True );
972 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )) , Standard_True );
973 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)) , Standard_True );
974
975 // void Read(Standard_IStream& astream)
976 std::istringstream is( theStr );
977 e.Read( is );
978 //assert( e == theStr );
979 QCOMPARE ( e , theStr );
980
981 // Standard_Integer SearchFromEnd (const Standard_CString what)const
982 //assert( e.SearchFromEnd( theStr + i ) == i + 1 );
983 QCOMPARE ( e.SearchFromEnd( theStr + i ) , i + 1 );
984
985 // SetValue(const Standard_Integer where, const Standard_CString what)
986 e.SetValue( i+1, "what");
987 //assert( e.Search( "what" ) == i+1 );
988 //assert( e.Length() == strlen( theStr ));
989 QCOMPARE ( e.Search( "what" ) , i+1 );
990 QCOMPARE ( e.Length() , (Standard_Integer)strlen( theStr ) );
991
992 // TCollection_AsciiString Split (const Standard_Integer where)
993 e = theStr;
994 d = e.Split( i+1 );
995 //assert( d.Length() + e.Length() == strlen( theStr ));
996 QCOMPARE ( d.Length() + e.Length() , (Standard_Integer)strlen( theStr ) );
997
998 // TCollection_AsciiString SubString (const Standard_Integer FromIndex,
999 // const Standard_Integer ToIndex) const
1000 e = theStr;
1001 d = e.SubString( (unsigned int)i+1, (unsigned int)i+3 );
1002 //assert( d.Length() == 3 );
1003 //assert( d.Value(1) == theStr[ i ]);
1004 QCOMPARE ( d.Length() , 3 );
1005 QCOMPARE ( d.Value(1) , theStr[ i ] );
1006
1007 // TCollection_AsciiString Token (const Standard_CString separators,
1008 // const Standard_Integer whichone) const
1009 e = " ";
1010 for ( j = 0; j < i; ++j ) {
1011 e += TCollection_AsciiString( theStr[j] ) + " ";
1012 //assert( e.Token(" ", j+1 ) == TCollection_AsciiString( theStr+j, 1 ));
1013 QCOMPARE ( e.Token(" ", j+1 ) , TCollection_AsciiString( theStr+j, 1 ) );
1014 }
1015 }
1016 for ( i = 0; i < 5; ++i )
1017 {
1018 // TCollection_ExtendedString (const Standard_CString astring,
1019 // const Standard_Boolean isMultiByte)
1020 const TCollection_ExtendedString a( theStr+i );
1021 //assert( TCollection_AsciiString( a ) == theStr+i );
1022 QCOMPARE ( TCollection_AsciiString( a ) , theStr+i );
1023
1024 //TCollection_ExtendedString (const Standard_ExtString astring)
1025 const TCollection_ExtendedString b( a.ToExtString() );
1026 //assert( a == b );
1027 QCOMPARE ( a , b );
1028
1029 // TCollection_ExtendedString (const Standard_Integer length,
1030 // const Standard_ExtCharacter filler )
1031 const TCollection_ExtendedString c( i, 1 );
1032 //assert( c.Length() == i );
1033 QCOMPARE ( c.Length() , i );
1034 if ( c.Length() > 0 ) {
1035 //assert( c.Value( i ) == 1 );
1036 QCOMPARE ( c.Value( i ) , 1 );
1037 }
1038
1039 // TCollection_ExtendedString (const Standard_Integer aValue)
1040 TCollection_ExtendedString d( i );
1041 const TCollection_AsciiString da( d );
1042 //assert( da.IsIntegerValue() );
1043 //assert( da.IntegerValue() == i );
1044 QCOMPARE ( da.IsIntegerValue() , Standard_True );
1045 QCOMPARE ( da.IntegerValue(), i );
1046
1047 // TCollection_ExtendedString (const Standard_Real aValue)
1048 const TCollection_ExtendedString e( 0.1 * i );
1049 const TCollection_AsciiString ea( e );
1050 //assert( ea.IsRealValue() );
1051 //assert( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 );
1052 QCOMPARE ( ea.IsRealValue() , Standard_True );
1053 QCOMPARE ( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 , Standard_True );
1054
1055 // TCollection_ExtendedString (const TCollection_ExtendedString& astring)
1056 const TCollection_ExtendedString f(e);
1057 //assert( f.Length() == e.Length());
1058 //assert( f == e );
1059 QCOMPARE ( f.Length() , e.Length() );
1060 QCOMPARE ( f , e );
1061
1062 // TCollection_ExtendedString (const TCollection_AsciiString& astring)
1063 const TCollection_ExtendedString g( ea );
1064 //assert( g.Length() == ea.Length() );
1065 //assert( TCollection_AsciiString( g ) == ea );
1066 QCOMPARE ( g.Length() , ea.Length() );
1067 QCOMPARE ( TCollection_AsciiString( g ) , ea );
1068
1069 // AssignCat (const TCollection_ExtendedString& other)
1070 const TCollection_ExtendedString sep(",");
1071 d.AssignCat( sep );
1072 d.AssignCat( g );
1073 //assert( d.Length() == 2 + g.Length() );
1074 //assert( d.Token( sep.ToExtString(), 1 ) == TCollection_ExtendedString( i ));
1075 //assert( d.Token( sep.ToExtString(), 2 ) == g );
1076 QCOMPARE ( d.Length() , 2 + g.Length() );
1077 QCOMPARE ( d.Token( sep.ToExtString(), 1 ) , TCollection_ExtendedString( i ) );
1078 QCOMPARE ( d.Token( sep.ToExtString(), 2 ) , g );
1079
1080 // TCollection_ExtendedString Cat (const TCollection_ExtendedString& other) const
1081 const TCollection_ExtendedString cat = a.Cat( sep );
1082 //assert( cat.Length() == a.Length() + sep.Length() );
1083 //assert( cat.Search( a ) == 1 );
1084 //assert( cat.Search( sep ) == a.Length() + 1 );
1085 QCOMPARE ( cat.Length() , a.Length() + sep.Length() );
1086 QCOMPARE ( cat.Search( a ) , 1 );
1087 QCOMPARE ( cat.Search( sep ) , a.Length() + 1 );
1088
1089 // Copy (const TCollection_ExtendedString& fromwhere)
1090 d = cat;
1091 //assert( d.Length() == cat.Length() );
1092 //assert( d == cat );
1093 QCOMPARE ( d.Length() , cat.Length() );
1094 QCOMPARE ( d , cat );
1095
1096 // IsEqual (const Standard_ExtString other) const
1097 //assert( d.IsEqual( d.ToExtString() ));
1098 QCOMPARE ( d.IsEqual( d.ToExtString() ) , Standard_True );
1099
1100 // IsDifferent (const Standard_ExtString other ) const
1101 //assert( d.IsDifferent( a.ToExtString() ));
1102 QCOMPARE ( d.IsDifferent( a.ToExtString() ) , Standard_True );
1103
1104 // IsDifferent (const TCollection_ExtendedString& other) const
1105 //assert( d.IsDifferent( a ));
1106 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
1107
1108 // IsLess (const Standard_ExtString other) const
1109 const TCollection_ExtendedString l0("0"), l1("1"), l00("00"), l, ls(theStr+i), ls1(theStr+i+1);
1110 //assert( l0. IsLess( l1.ToExtString() ));
1111 //assert( l0. IsLess( l00.ToExtString() ));
1112 //assert( l. IsLess( l0.ToExtString() ));
1113 //assert( ! l1. IsLess( l0.ToExtString() ));
1114 //assert( ! l00.IsLess( l0.ToExtString() ));
1115 //assert( ! l0. IsLess( l.ToExtString() ));
1116 //assert( ls.IsLess( ls1.ToExtString() ));
1117 QCOMPARE ( l0. IsLess( l1.ToExtString() ) , Standard_True );
1118 QCOMPARE ( l0. IsLess( l00.ToExtString() ) , Standard_True );
1119 QCOMPARE ( l. IsLess( l0.ToExtString() ) , Standard_True );
1120 QCOMPARE ( ! l1. IsLess( l0.ToExtString() ) , Standard_True );
1121 QCOMPARE ( ! l00.IsLess( l0.ToExtString() ) , Standard_True );
1122 QCOMPARE ( ! l0. IsLess( l.ToExtString() ) , Standard_True );
1123 QCOMPARE ( ls.IsLess( ls1.ToExtString() ) , Standard_True );
1124
1125 // IsLess (const TCollection_ExtendedString& other) const
1126 //assert( l0. IsLess( l1 ));
1127 //assert( l0. IsLess( l00 ));
1128 //assert( l. IsLess( l0 ));
1129 //assert( ! l1. IsLess( l0 ));
1130 //assert( ! l00.IsLess( l0 ));
1131 //assert( ! l0. IsLess( l ));
1132 //assert( ls.IsLess( ls1 ));
1133 QCOMPARE ( l0. IsLess( l1 ) , Standard_True );
1134 QCOMPARE ( l0. IsLess( l00 ) , Standard_True );
1135 QCOMPARE ( l. IsLess( l0 ) , Standard_True );
1136 QCOMPARE ( ! l1. IsLess( l0 ) , Standard_True );
1137 QCOMPARE ( ! l00.IsLess( l0 ) , Standard_True );
1138 QCOMPARE ( ! l0. IsLess( l ) , Standard_True );
1139 QCOMPARE ( ls.IsLess( ls1 ) , Standard_True );
1140
1141 // IsGreater (const Standard_ExtString other) const
1142 //assert( ! l0.IsGreater( l1.ToExtString() ));
1143 //assert( ! l0.IsGreater( l00.ToExtString() ));
1144 //assert( ! l. IsGreater( l0.ToExtString() ));
1145 //assert( l1. IsGreater( l0.ToExtString() ));
1146 //assert( l00.IsGreater( l0.ToExtString() ));
1147 //assert( l0. IsGreater( l.ToExtString() ));
1148 //assert( ls1.IsGreater( ls.ToExtString() ));
1149 QCOMPARE ( ! l0.IsGreater( l1.ToExtString() ) , Standard_True );
1150 QCOMPARE ( ! l0.IsGreater( l00.ToExtString() ) , Standard_True );
1151 QCOMPARE ( ! l. IsGreater( l0.ToExtString() ) , Standard_True );
1152 QCOMPARE ( l1. IsGreater( l0.ToExtString() ) , Standard_True );
1153 QCOMPARE ( l00.IsGreater( l0.ToExtString() ) , Standard_True );
1154 QCOMPARE ( l0. IsGreater( l.ToExtString() ) , Standard_True );
1155 QCOMPARE ( ls1.IsGreater( ls.ToExtString() ) ,Standard_True );
1156
1157 // IsGreater (const TCollection_ExtendedString& other) const
1158 //assert( ! l0.IsGreater( l1));
1159 //assert( ! l0.IsGreater( l00));
1160 //assert( ! l. IsGreater( l0));
1161 //assert( l1. IsGreater( l0));
1162 //assert( l00.IsGreater( l0));
1163 //assert( l0. IsGreater( l));
1164 //assert( ls1.IsGreater( ls));
1165 QCOMPARE ( ! l0.IsGreater( l1) , Standard_True );
1166 QCOMPARE ( ! l0.IsGreater( l00) , Standard_True );
1167 QCOMPARE ( ! l. IsGreater( l0) , Standard_True );
1168 QCOMPARE ( l1. IsGreater( l0) , Standard_True );
1169 QCOMPARE ( l00.IsGreater( l0) , Standard_True );
1170 QCOMPARE ( l0. IsGreater( l) , Standard_True );
1171 QCOMPARE ( ls1.IsGreater( ls) , Standard_True );
1172
1173 // ==========================
1174 //TCollection_HAsciiString::
1175 // ==========================
1176
1177 // IsDifferent(const Handle(TCollection_HAsciiString)& S)
1178 Handle(TCollection_HAsciiString) ha1 = new TCollection_HAsciiString( theStr+i );
1179 Handle(TCollection_HAsciiString) ha2 = new TCollection_HAsciiString( theStr+i+1 );
1180 //assert( ha1->IsDifferent( ha2 ));
1181 //assert( !ha1->IsDifferent( ha1 ));
1182 QCOMPARE ( ha1->IsDifferent( ha2 ) , Standard_True );
1183 QCOMPARE ( !ha1->IsDifferent( ha1 ) , Standard_True );
1184
1185 // IsSameString (const Handle(TCollection_HAsciiString)& S)
1186 //assert( !ha1->IsSameString( ha2 ));
1187 //assert( ha1->IsSameString( ha1 ));
1188 QCOMPARE ( !ha1->IsSameString( ha2 ) , Standard_True );
1189 QCOMPARE ( ha1->IsSameString( ha1 ) , Standard_True );
1190
1191 // IsSameState (const Handle(TCollection_HAsciiString)& other) const
1192 //assert( !ha1->IsSameState( ha2 ));
1193 //assert( ha1->IsSameState( ha1 ));
1194 QCOMPARE ( !ha1->IsSameState( ha2 ) , Standard_True );
1195 QCOMPARE ( ha1->IsSameState( ha1 ) , Standard_True );
1196
1197 // IsSameString (const Handle(TCollection_HAsciiString)& S ,
1198 // const Standard_Boolean CaseSensitive) const
1199 //assert( !ha1->IsSameString( ha2, true ));
1200 //assert( ha1->IsSameString( ha1, true ));
1201 //assert( !ha1->IsSameString( ha2, false ));
1202 //assert( ha1->IsSameString( ha1, false ));
1203 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1204 QCOMPARE ( ha1->IsSameString( ha1, Standard_True ) , Standard_True );
1205 QCOMPARE ( !ha1->IsSameString( ha2, Standard_False ) , Standard_True );
1206 QCOMPARE ( ha1->IsSameString( ha1, Standard_False ) , Standard_True );
1207
1208 ha1->SetValue( 1, "AbC0000000");
1209 ha2->SetValue( 1, "aBc0000000");
1210 //assert( !ha1->IsSameString( ha2, true ));
1211 //assert( ha1->IsSameString( ha2, false ));
1212 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1213 QCOMPARE ( ha1->IsSameString( ha2, Standard_False ), Standard_True );
1214 }
1215 return 0;
1216}
1217
788cbaf4 1218#include <Geom_CylindricalSurface.hxx>
1219#include <IntTools_FaceFace.hxx>
1220#include <IntTools_Curve.hxx>
1221#include <IntTools_PntOn2Faces.hxx>
1222
1223static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
1224{
1225 if(theNArg < 2)
1226 {
1227 theDI << "Wrong a number of arguments!\n";
1228 return 1;
1229 }
1230
857ffd5e 1231 Handle(Geom_Plane) plane(new Geom_Plane(
788cbaf4 1232 gp_Ax3( gp_Pnt(-72.948737453424499, 754.30437716359393, 259.52151854671678),
1233 gp_Dir(6.2471473085930200e-007, -0.99999999999980493, 0.00000000000000000),
1234 gp_Dir(0.99999999999980493, 6.2471473085930200e-007, 0.00000000000000000))));
1235 Handle(Geom_CylindricalSurface) cylinder(
1236 new Geom_CylindricalSurface(
1237 gp_Ax3(gp_Pnt(-6.4812490053250649, 753.39408794522092, 279.16400974257465),
1238 gp_Dir(1.0000000000000000, 0.0, 0.00000000000000000),
1239 gp_Dir(0.0, 1.0000000000000000, 0.00000000000000000)),
1240 19.712534607908712));
1241
1242 DrawTrSurf::Set("pln", plane);
1243 theDI << "pln\n";
1244 DrawTrSurf::Set("cyl", cylinder);
1245 theDI << "cyl\n";
1246
1247 BRep_Builder builder;
1248 TopoDS_Face face1, face2;
1249 builder.MakeFace(face1, plane, Precision::Confusion());
1250 builder.MakeFace(face2, cylinder, Precision::Confusion());
1251 IntTools_FaceFace anInters;
1252 anInters.SetParameters(false, true, true, Precision::Confusion());
1253 anInters.Perform(face1, face2);
1254
1255 if (!anInters.IsDone())
1256 {
1257 theDI<<"No intersections found!"<<"\n";
1258
1259 return 1;
1260 }
1261
1262 //Handle(Geom_Curve) aResult;
1263 //gp_Pnt aPoint;
1264
1265 const IntTools_SequenceOfCurves& aCvsX=anInters.Lines();
1266 const IntTools_SequenceOfPntOn2Faces& aPntsX=anInters.Points();
1267
1268 char buf[1024];
1269 Standard_Integer aNbCurves, aNbPoints;
1270
1271 aNbCurves=aCvsX.Length();
1272 aNbPoints=aPntsX.Length();
1273
1274 if (aNbCurves >= 2)
1275 {
1276 for (Standard_Integer i=1; i<=aNbCurves; ++i)
1277 {
1278 Sprintf(buf, "%s_%d",theArgv[1],i);
1279 theDI << buf << " ";
1280
1281 const IntTools_Curve& aIC = aCvsX(i);
1282 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1283 DrawTrSurf::Set(buf,aC3D);
1284 }
1285 }
1286 else if (aNbCurves == 1)
1287 {
1288 const IntTools_Curve& aIC = aCvsX(1);
1289 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1290 Sprintf(buf, "%s",theArgv[1]);
1291 theDI << buf << " ";
1292 DrawTrSurf::Set(buf,aC3D);
1293 }
1294
1295 for (Standard_Integer i = 1; i<=aNbPoints; ++i)
1296 {
1297 const IntTools_PntOn2Faces& aPi=aPntsX(i);
1298 const gp_Pnt& aP=aPi.P1().Pnt();
1299
1300 Sprintf(buf,"%s_p_%d",theArgv[1],i);
1301 theDI << buf << " ";
1302 DrawTrSurf::Set(buf, aP);
1303 }
1304
1305 return 0;
1306}
1307
1b7602c8 1308#include <BRepAlgo_NormalProjection.hxx>
1309static Standard_Integer OCC24012 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1310{
1311 if (argc != 3) {
1312 di << "Usage : " << argv[0] << " should be 2 arguments (face and edge)";
1313 return 1;
1314 }
1315
1316 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
1317 if(myAISContext.IsNull()) {
1318 di << "use 'vinit' command before " << argv[0] << "\n";
1319 return 1;
1320 }
1321
1322 TopoDS_Face m_Face1 = TopoDS::Face(DBRep::Get(argv[1]));
1323 TopoDS_Edge m_Edge = TopoDS::Edge(DBRep::Get(argv[2]));
1324
1325 BRepAlgo_NormalProjection anormpro(m_Face1);
1326 anormpro.Add(m_Edge);
1327 anormpro.SetDefaultParams();
1328
1329 //anormpro.Compute3d();
1330 //anormpro.SetLimit();
1331
1332 anormpro.Build();
1333
1334 if (anormpro.IsDone())
1335 {
1336 TopoDS_Shape rshape = anormpro.Projection();
1337 Handle(AIS_InteractiveObject) myShape = new AIS_Shape (rshape);
1338 myAISContext->SetColor(myShape, Quantity_Color(Quantity_NOC_YELLOW));
1339 myAISContext->Display(myShape, Standard_True);
1340 }
1341
1342 return 0;
1343}
1344
01ee00d9 1345#include <Voxel_FastConverter.hxx>
1346static Standard_Integer OCC24051 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1347{
1348 if (argc != 1) {
1349 di << "Usage : " << argv[0] << " should be one argument (command name only)";
1350 return 1;
1351 }
1352
1353 TopoDS_Shape shape = BRepPrimAPI_MakeBox(gp_Pnt(5, 10, 10), 10, 20, 30).Shape();
1354 Standard_Integer progress = 0;
1355 Standard_Real deflection = 0.005;
1356 Standard_Integer nbx = 200, nby = 200, nbz = 200;
1357 Voxel_BoolDS theVoxels(-50,-50,-30, 100, 100, 100, nbx, nby, nbz);
1358 Voxel_BoolDS theVoxels1(-50,-50,-30, 100, 100, 100, nbx, nby, nbz);
1359 Standard_Integer nbThreads = 5;
1360 Voxel_FastConverter fcp(shape, theVoxels, deflection, nbx, nby, nbz, nbThreads, Standard_True);
1361
1362 #ifdef WNT
1363 #pragma omp parallel for
1364 for(int i = 0; i < nbThreads; i++)
1365 fcp.ConvertUsingSAT(progress, i+1);
1366 #endif
1367
1368 fcp.ConvertUsingSAT(progress);
1369
1370 return 0;
1371}
1372
69fd2d1b 1373#include <BRepFeat_SplitShape.hxx>
1374#include <ShapeAnalysis_ShapeContents.hxx>
1375#include <BRepAlgo.hxx>
1376static Standard_Integer OCC24086 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1377{
1378 if (argc != 3) {
1379 di << "Usage : " << argv[0] << " should be 2 arguments (face and wire)";
1380 return 1;
1381 }
1382
1383 Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
1384 if(myAISContext.IsNull()) {
1385 di << "use 'vinit' command before " << argv[0] << "\n";
1386 return 1;
1387 }
1388
1389 TopoDS_Shape result;
1390 TopoDS_Face face = TopoDS::Face(DBRep::Get(argv[1]));
1391 TopoDS_Wire wire = TopoDS::Wire(DBRep::Get(argv[2]));
1392
1393 BRepFeat_SplitShape asplit(face);
1394 asplit.Add(wire, face);
1395 asplit.Build();
1396 result = asplit.Shape();
1397 ShapeAnalysis_ShapeContents ana;
1398 ana.Perform(result);
1399 ana.NbFaces();
1400
1401 if (!(BRepAlgo::IsValid(result))) {
1402 di << "Result was checked and it is INVALID" << "\n";
1403 } else {
1404 di << "Result was checked and it is VALID" << "\n";
1405 }
1406
1407 Handle(AIS_InteractiveObject) myShape = new AIS_Shape (result);
1408 myAISContext->Display(myShape, Standard_True);
1409
1410 return 0;
1411}
1412
c764e804 1413#include <Geom_Circle.hxx>
1414#include <GeomAdaptor_Curve.hxx>
1415#include <Extrema_ExtPC.hxx>
1416#include <gp_Cylinder.hxx>
1417#include <ElSLib.hxx>
1418static Standard_Integer OCC24945 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1419{
1420 if (argc != 1) {
1421 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
1422 return 1;
1423 }
1424
1425 gp_Pnt aP3D( -1725.97, 843.257, -4.22741e-013 );
1426 gp_Ax2 aAxis( gp_Pnt( 0, 843.257, 0 ), gp_Dir( 0, -1, 0 ), gp::DX() );
1427 Handle(Geom_Circle) aCircle = new Geom_Circle( aAxis, 1725.9708621929999 );
1428 GeomAdaptor_Curve aC3D( aCircle );
1429
1430 Extrema_ExtPC aExtPC( aP3D, aC3D );
1431 //Standard_Real aParam = (aExtPC.Point(1)).Parameter();
1432 gp_Pnt aProj = (aExtPC.Point(1)).Value();
1433 di << "Projected point: X = " << aProj.X() << "; Y = " << aProj.Y() << "; Z = " << aProj.Z() << "\n";
1434
1435 // Result of deviation
1436 gp_Ax2 aCylAxis( gp_Pnt( 0, 2103.87, 0 ), -gp::DY(), -gp::DX() );
1437 gp_Cylinder aCylinder( aCylAxis, 1890. );
1438
1439 Standard_Real aU = 0., aV = 0.;
1440 ElSLib::Parameters( aCylinder, aProj, aU, aV );
1441 di << "Parameters on cylinder: U = " << aU << "; V = " << aV << "\n";
1442
1443 return 0;
1444}
1445
89d8607f 1446#include <Extrema_FuncExtPS.hxx>
1447#include <math_FunctionSetRoot.hxx>
1448#include <math_Vector.hxx>
1449#include <BRepBuilderAPI_MakeVertex.hxx>
1450static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
1451{
1452 Standard_Integer anArgIter = 1;
1453 if (theNArg < 5)
1454 {
1455 theDI <<"Usage: " << theArgv[0] << " face vertex U V [N]"<<"\n";
1456 return 1;
1457 }
1458
1459 // get target shape
1460 Standard_CString aFaceName = theArgv[anArgIter++];
1461 Standard_CString aVertName = theArgv[anArgIter++];
1462 const TopoDS_Shape aShapeF = DBRep::Get (aFaceName);
1463 const TopoDS_Shape aShapeV = DBRep::Get (aVertName);
1464 const Standard_Real aUFrom = Atof (theArgv[anArgIter++]);
1465 const Standard_Real aVFrom = Atof (theArgv[anArgIter++]);
1466 const Standard_Integer aNbIts = (anArgIter < theNArg) ? atol (theArgv[anArgIter++]) : 100;
1467 if (aShapeF.IsNull() || aShapeF.ShapeType() != TopAbs_FACE)
1468 {
1469 std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl;
1470 return 1;
1471 }
1472 if (aShapeV.IsNull() || aShapeV.ShapeType() != TopAbs_VERTEX)
1473 {
1474 std::cout << "Error: " << aVertName << " shape is null / not a vertex" << std::endl;
1475 return 1;
1476 }
1477 const TopoDS_Face aFace = TopoDS::Face (aShapeF);
1478 const TopoDS_Vertex aVert = TopoDS::Vertex (aShapeV);
1479 GeomAdaptor_Surface aSurf (BRep_Tool::Surface (aFace));
1480
1481 gp_Pnt aPnt = BRep_Tool::Pnt (aVert), aRes;
1482
1483 Extrema_FuncExtPS anExtFunc;
1484 math_FunctionSetRoot aRoot (anExtFunc, aNbIts);
1485
1486 math_Vector aTolUV (1, 2), aUVinf (1, 2), aUVsup (1, 2), aFromUV (1, 2);
1487 aTolUV (1) = Precision::Confusion(); aTolUV (2) = Precision::Confusion();
1488 aUVinf (1) = -Precision::Infinite(); aUVinf (2) = -Precision::Infinite();
1489 aUVsup (1) = Precision::Infinite(); aUVsup (2) = Precision::Infinite();
1490 aFromUV(1) = aUFrom; aFromUV(2) = aVFrom;
1491
1492 anExtFunc.Initialize (aSurf);
1493 anExtFunc.SetPoint (aPnt);
1494 aRoot.SetTolerance (aTolUV);
1495 aRoot.Perform (anExtFunc, aFromUV, aUVinf, aUVsup);
1496 if (!aRoot.IsDone())
1497 {
1498 std::cerr << "No results!\n";
1499 return 1;
1500 }
1501
1502 theDI << aRoot.Root()(1) << " " << aRoot.Root()(2) << "\n";
1503
1504 aSurf.D0 (aRoot.Root()(1), aRoot.Root()(2), aRes);
1505 DBRep::Set ("result", BRepBuilderAPI_MakeVertex (aRes));
1506 return 0;
1507}
1508
ab2db9a5 1509//! Check boolean operations on NCollection_Map
1510static Standard_Integer OCC24271 (Draw_Interpretor& di,
1511 Standard_Integer /*theArgNb*/,
1512 const char** /*theArgVec*/)
1513{
1514 // input data
1515 const Standard_Integer aLeftLower = 1;
1516 const Standard_Integer aLeftUpper = 10;
1517 const Standard_Integer aRightLower = 5;
1518 const Standard_Integer aRightUpper = 15;
1519
1520 // define arguments
1521 NCollection_Map<Standard_Integer> aMapLeft;
1522 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aLeftUpper; ++aKeyIter)
1523 {
1524 aMapLeft.Add (aKeyIter);
1525 }
1526
1527 NCollection_Map<Standard_Integer> aMapRight;
1528 for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aRightUpper; ++aKeyIter)
1529 {
1530 aMapRight.Add (aKeyIter);
1531 }
1532
1533 QCOMPARE (aMapLeft .Contains (aMapRight), Standard_False);
1534 QCOMPARE (aMapRight.Contains (aMapLeft), Standard_False);
1535
1536 // validate Union operation
1537 NCollection_Map<Standard_Integer> aMapUnion;
1538 aMapUnion.Union (aMapLeft, aMapRight);
1539 QCOMPARE (aMapUnion.Extent(), aRightUpper - aLeftLower + 1);
1540 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aRightUpper; ++aKeyIter)
1541 {
1542 QCOMPARE (aMapUnion.Contains (aKeyIter), Standard_True);
1543 }
1544
1545 // validate Intersection operation
1546 NCollection_Map<Standard_Integer> aMapSect;
1547 aMapSect.Intersection (aMapLeft, aMapRight);
1548 QCOMPARE (aMapSect.Extent(), aLeftUpper - aRightLower + 1);
1549 for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
1550 {
1551 QCOMPARE (aMapSect.Contains (aKeyIter), Standard_True);
1552 }
1553 QCOMPARE (aMapLeft .Contains (aMapSect), Standard_True);
1554 QCOMPARE (aMapRight.Contains (aMapSect), Standard_True);
1555
1556 // validate Substruction operation
1557 NCollection_Map<Standard_Integer> aMapSubsLR;
1558 aMapSubsLR.Subtraction (aMapLeft, aMapRight);
1559 QCOMPARE (aMapSubsLR.Extent(), aRightLower - aLeftLower);
1560 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
1561 {
1562 QCOMPARE (aMapSubsLR.Contains (aKeyIter), Standard_True);
1563 }
1564
1565 NCollection_Map<Standard_Integer> aMapSubsRL;
1566 aMapSubsRL.Subtraction (aMapRight, aMapLeft);
1567 QCOMPARE (aMapSubsRL.Extent(), aRightUpper - aLeftUpper);
1568 for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter)
1569 {
1570 QCOMPARE (aMapSubsRL.Contains (aKeyIter), Standard_True);
1571 }
1572
1573 // validate Difference operation
1574 NCollection_Map<Standard_Integer> aMapDiff;
1575 aMapDiff.Difference (aMapLeft, aMapRight);
1576 QCOMPARE (aMapDiff.Extent(), aRightLower - aLeftLower + aRightUpper - aLeftUpper);
1577 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
1578 {
1579 QCOMPARE (aMapDiff.Contains (aKeyIter), Standard_True);
1580 }
1581 for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter)
1582 {
1583 QCOMPARE (aMapDiff.Contains (aKeyIter), Standard_True);
1584 }
1585
1586 // validate Exchange operation
1587 NCollection_Map<Standard_Integer> aMapSwap;
1588 aMapSwap.Exchange (aMapSect);
1589 for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
1590 {
1591 QCOMPARE (aMapSwap.Contains (aKeyIter), Standard_True);
1592 }
1593 QCOMPARE (aMapSect.IsEmpty(), Standard_True);
1594 aMapSwap.Add (34);
1595 aMapSect.Add (43);
1596
1597 NCollection_Map<Standard_Integer> aMapCopy (aMapSwap);
1598 QCOMPARE (aMapCopy.IsEqual (aMapSwap), Standard_True);
1599 aMapCopy.Remove (34);
1600 aMapCopy.Add (43);
1601 QCOMPARE (aMapCopy.IsEqual (aMapSwap), Standard_False);
1602
1603 return 0;
1604}
1605
e6c9f595 1606#define QVERIFY(val1) \
1607 di << "Checking " #val1 " == Standard_True" << \
1608 ((val1) == Standard_True ? ": OK\n" : ": Error\n")
1609
1610#include <GeomInt_IntSS.hxx>
1611#include <Geom_ConicalSurface.hxx>
1612#include <Standard_ErrorHandler.hxx>
1613//=======================================================================
1614//function : OCC23972
1615//purpose :
1616//=======================================================================
1617static void DoGeomIntSSTest (const Handle(Geom_Surface)& theSurf1,
1618 const Handle(Geom_Surface)& theSurf2,
1619 const Standard_Integer theNbSol,
1620 Draw_Interpretor& di)
1621{
1622 try {
1623 OCC_CATCH_SIGNALS
1624 GeomInt_IntSS anInter;
1625 anInter.Perform (theSurf1, theSurf2, Precision::Confusion(), Standard_True);
1626 QVERIFY (anInter.IsDone());
1627 QCOMPARE (anInter.NbLines(), theNbSol);
1628 } catch (...) {
1629 QVERIFY (Standard_False);
1630 }
1631}
1632
1633namespace {
1634 static Handle(Geom_ConicalSurface) CreateCone (const gp_Pnt& theLoc,
1635 const gp_Dir& theDir,
1636 const gp_Dir& theXDir,
1637 const Standard_Real theRad,
1638 const Standard_Real theSin,
1639 const Standard_Real theCos)
1640 {
1641 const Standard_Real anA = atan (theSin / theCos);
1642 gp_Ax3 anAxis (theLoc, theDir, theXDir);
1643 Handle(Geom_ConicalSurface) aSurf = new Geom_ConicalSurface (anAxis, anA, theRad);
1644 return aSurf;
1645 }
1646}
1647
1648static Standard_Integer OCC23972 (Draw_Interpretor& di,Standard_Integer n, const char**)
1649{
1650 if (n != 1) return 1;
1651
1652 //process specific cones, cannot read them from files because due to rounding the original error
1653 //in math_FunctionRoots gets hidden
1654 Handle(Geom_Surface) aS1 = CreateCone (
1655 gp_Pnt (123.694345356663, 789.9, 68.15),
1656 gp_Dir (-1, 3.48029791472957e-016, -8.41302743359754e-017),
1657 gp_Dir (-3.48029791472957e-016, -1, -3.17572289932207e-016),
1658 3.28206830417112,
1659 0.780868809443031,
1660 0.624695047554424);
1661 Handle(Geom_Surface) aS2 = CreateCone (
1662 gp_Pnt (123.694345356663, 784.9, 68.15),
1663 gp_Dir (-1, -2.5209507537117e-016, -1.49772808948866e-016),
1664 gp_Dir (1.49772808948866e-016, 3.17572289932207e-016, -1),
1665 3.28206830417112,
1666 0.780868809443031,
1667 0.624695047554424);
1668
1669 DoGeomIntSSTest (aS1, aS2, 2, di);
1670
1671 return 0;
1672}
1673
e3096dec 1674#include <ShapeFix_EdgeProjAux.hxx>
1675static Standard_Integer OCC24370 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
1676{
1677 if (argc < 5) {
1678 di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
1679 return 1;
1680 }
1681
1682 TopoDS_Shape aSh = DBRep::Get(argv[1]);
1683 if (aSh.IsNull()) {
1684 di << argv[0] << " Error: Null input edge\n";
1685 return 1;
1686 }
1687 const TopoDS_Edge& anEdge = TopoDS::Edge (aSh);
1688
1689 Handle(Geom2d_Curve) aC = DrawTrSurf::GetCurve2d(argv[2]);
1690 if (aC.IsNull()) {
1691 di << argv[0] << " Error: Null input curve\n";
1692 return 1;
1693 }
1694
1695 Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(argv[3]);
1696 if (aS.IsNull()) {
1697 di << argv[0] << " Error: Null input surface\n";
1698 return 1;
1699 }
1700
1701 Standard_Real prec = Draw::Atof(argv[4]);
1702
1703 //prepare data
1704 TopoDS_Face aFace;
1705 BRep_Builder aB;
1706 aB.MakeFace (aFace, aS, Precision::Confusion());
1707 aB.UpdateEdge (anEdge, aC, aFace, Precision::Confusion());
1708 aB.Range (anEdge, aFace, aC->FirstParameter(), aC->LastParameter());
1709
1710 //call algorithm
1711 ShapeFix_EdgeProjAux aProj (aFace, anEdge);
1712 aProj.Compute (prec);
1713
1714 Standard_Boolean isfirstdone = aProj.IsFirstDone();
1715 Standard_Boolean islastdone = aProj.IsLastDone();
1716
1717 Standard_Real first = 0.;
1718 Standard_Real last = 0.;
1719 Standard_Integer isfirstdoneInteger = 0;
1720 Standard_Integer islastdoneInteger = 0;
1721
1722
1723 if (isfirstdone) {
1724 first = aProj.FirstParam();
1725 isfirstdoneInteger = 1;
1726 }
1727
1728 if (islastdone) {
1729 last= aProj.LastParam();
1730 islastdoneInteger = 1;
1731 }
1732
1733 di << isfirstdoneInteger << " "<< islastdoneInteger << " "<< first << " "<< last << " \n";
1734
1735 return 0;
1736}
1737
05d7de53 1738template<typename T, typename HT>
1739static void DoIsNull(Draw_Interpretor& di)
1740{
1741 HT aHandle;
1742 // QVERIFY (aHandle.IsNull());
1743 QCOMPARE (aHandle.IsNull(), Standard_True);
1744 const T* p = aHandle.Access();
1745#if OCC_VERSION_HEX > 0x060700
1746 //QVERIFY (!p);
1747 //QVERIFY (p == 0);
1748 QCOMPARE (!p, Standard_True);
1749 QCOMPARE (p == 0, Standard_True);
1750#endif
1751
1752 aHandle = new T;
1753 //QVERIFY (!aHandle.IsNull());
1754 QCOMPARE (!aHandle.IsNull(), Standard_True);
1755 p = aHandle.Access();
1756 //QVERIFY (p);
1757 //QVERIFY (p != 0);
1758 QCOMPARE (p != NULL, Standard_True);
1759 QCOMPARE (p != 0, Standard_True);
1760}
1761
1762//=======================================================================
1763//function : OCC24533
1764//purpose :
1765//=======================================================================
1766static Standard_Integer OCC24533 (Draw_Interpretor& di, Standard_Integer n, const char**)
1767{
1768 if (n != 1) return 1;
1769
857ffd5e 1770 DoIsNull<Standard_Transient, Handle(Standard_Transient)>(di);
1771 DoIsNull<Standard_Persistent, Handle(Standard_Persistent)>(di);
05d7de53 1772
1773 return 0;
1774}
1775
dda67c1c 1776// Dummy class to test interface for compilation issues
1777class QABugs_HandleClass : public Standard_Transient
1778{
1779public:
1780 Standard_Integer HandleProc (Draw_Interpretor& , Standard_Integer , const char** theArgVec)
1781 {
1782 std::cerr << "QABugs_HandleClass[" << this << "] " << theArgVec[0] << "\n";
1783 return 0;
1784 }
1785 DEFINE_STANDARD_RTTI(QABugs_HandleClass) // Type definition
1786};
1787DEFINE_STANDARD_HANDLE (QABugs_HandleClass, Standard_Transient)
1788IMPLEMENT_STANDARD_HANDLE (QABugs_HandleClass, Standard_Transient)
1789IMPLEMENT_STANDARD_RTTIEXT(QABugs_HandleClass, Standard_Transient)
1790
1791// Dummy class to test interface for compilation issues
1792struct QABugs_NHandleClass
1793{
1794 Standard_Integer NHandleProc (Draw_Interpretor& , Standard_Integer , const char** theArgVec)
1795 {
1796 std::cerr << "QABugs_NHandleClass[" << this << "] " << "" << theArgVec[0] << "\n";
1797 return 0;
1798 }
1799};
1800
574d7236 1801#include <XCAFDoc_ColorTool.hxx>
1802#include <STEPControl_StepModelType.hxx>
1803#include <STEPCAFControl_Writer.hxx>
1804static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1805{
7a7e8cf1 1806 if (argc != 2) {
574d7236 1807 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
1808 return 1;
1809 }
1810 Handle(TDocStd_Document) aDoc = new TDocStd_Document("dummy");;
1811 TopoDS_Shape s1 = BRepPrimAPI_MakeBox(1,1,1).Shape();
1812 TDF_Label lab1 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->NewShape();
1813 XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->SetShape(lab1, s1);
1814 TDataStd_Name::Set(lab1, "Box1");
1815
1816 Quantity_Color yellow(1,1,0, Quantity_TOC_RGB);
1817 XCAFDoc_DocumentTool::ColorTool (aDoc->Main())->SetColor(lab1, yellow, XCAFDoc_ColorGen);
1818 XCAFDoc_DocumentTool::ColorTool(aDoc->Main())->SetVisibility(lab1, 0);
1819
1820 STEPControl_StepModelType mode = STEPControl_AsIs;
1821 STEPCAFControl_Writer writer;
1822 if ( ! writer.Transfer (aDoc, mode ) )
1823 {
1824 di << "The document cannot be translated or gives no result" << "\n";
1825 return 1;
1826 }
1827
7a7e8cf1 1828 writer.Write(argv[1]);
574d7236 1829 return 0;
1830}
1831
1832
0c674248 1833//=======================================================================
1834//function : OCC23950
1835//purpose :
1836//=======================================================================
1837static Standard_Integer OCC23950 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
1838{
1fa7cb8c 1839 if (argc != 2) {
1840 di << "Usage : " << argv[0] << " step_file\n";
0c674248 1841 return 1;
1842 }
1843
1844 Handle(TDocStd_Document) aDoc = new TDocStd_Document ("dummy");
1845 TopoDS_Shape s6 = BRepBuilderAPI_MakeVertex (gp_Pnt (75, 0, 0));
1846 gp_Trsf t0;
1847 TopLoc_Location location0 (t0);
1848
1849 TDF_Label lab1 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->NewShape ();
1850 XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->SetShape (lab1, s6);
1851 TDataStd_Name::Set(lab1, "Point1");
1852
1853 TDF_Label labelA0 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->NewShape ();
1854 TDataStd_Name::Set(labelA0, "ASSEMBLY");
1855
1856 TDF_Label component01 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->AddComponent (labelA0, lab1, location0);
1857
1858 Quantity_Color yellow(1,1,0, Quantity_TOC_RGB);
1859 XCAFDoc_DocumentTool::ColorTool (labelA0)->SetColor (component01, yellow, XCAFDoc_ColorGen);
1860 XCAFDoc_DocumentTool::ColorTool (labelA0)->SetVisibility (component01, 0);
1861
1862 STEPControl_StepModelType mode = STEPControl_AsIs;
1863 STEPCAFControl_Writer writer;
1864 if (! writer.Transfer (aDoc, mode))
1865 {
1866 di << "The document cannot be translated or gives no result" << "\n";
1867 return 1;
1868 }
1869
1fa7cb8c 1870 writer.Write (argv[1]);
0c674248 1871 return 0;
1872}
1873
f376ac72 1874//=======================================================================
1875//function : OCC24622
1876//purpose : The command tests sourcing Image_PixMap to AIS_TexturedShape
1877//=======================================================================
1878static Standard_Integer OCC24622 (Draw_Interpretor& /*theDi*/, Standard_Integer theArgNb, const char** theArgVec)
1879{
1880 if (theArgNb != 2)
1881 {
1882 std::cout << "Usage : " << theArgVec[0] << " texture={1D|2D}";
1883 return 1;
1884 }
1885
1886 const Handle(AIS_InteractiveContext)& anAISContext = ViewerTest::GetAISContext();
1887 if (anAISContext.IsNull())
1888 {
1889 std::cout << "Please initialize view with \"vinit\".\n";
1890 return 1;
1891 }
1892
1893 Handle(Image_PixMap) anImage = new Image_PixMap();
1894
b56dd33f 1895 static const Image_ColorRGB aBitmap[8] =
1896 {
1897 {{255, 0, 0}}, {{0, 148, 255}}, {{ 0, 148, 255}}, {{255, 94, 0}},
1898 {{255, 121, 0}}, {{76, 255, 0}}, {{76, 255, 0}}, {{255, 202, 0}}
f376ac72 1899 };
1900
1901 TCollection_AsciiString aTextureTypeArg (theArgVec[1]);
1902 aTextureTypeArg.UpperCase();
1903 if (aTextureTypeArg == "1D")
1904 {
1905 anImage->InitWrapper (Image_PixMap::ImgRGB, (Standard_Byte*)aBitmap, 8, 1);
1906 }
1907 else if (aTextureTypeArg == "2D")
1908 {
1909 anImage->InitTrash (Image_PixMap::ImgRGB, 8, 8);
f376ac72 1910 for (Standard_Integer aRow = 0; aRow < 8; ++aRow)
1911 {
1912 for (Standard_Integer aCol = 0; aCol < 8; ++aCol)
1913 {
ca0c0b11 1914 anImage->ChangeValue<Image_ColorRGB> (aRow, aCol) = aBitmap[aRow];
f376ac72 1915 }
1916 }
1917 }
1918 else
1919 {
1920 std::cout << "Please specify type of texture to test {1D|2D}.\n";
1921 return 1;
1922 }
1923
1924 TopoDS_Shape aBlankShape = BRepPrimAPI_MakeBox (10.0, 10.0, 10.0).Shape();
1925
1926 Handle(AIS_TexturedShape) aTexturedShape = new AIS_TexturedShape (aBlankShape);
1927 aTexturedShape->SetTexturePixMap (anImage);
1928 anAISContext->Display (aTexturedShape, 3, 0);
1929
1930 return 0;
1931}
1932
2cd138b8 1933//=======================================================================
1934//function : OCC24667
1935//purpose :
1936//=======================================================================
1937static Standard_Integer OCC24667 (Draw_Interpretor& di, Standard_Integer n, const char** a)
1938{
1939 if (n == 1)
1940 {
1941 di << "OCC24667 result Wire_spine Profile [Mode [Approx]]" << "\n";
1942 di << "Mode = 0 - CorrectedFrenet," << "\n";
1943 di << " = 1 - Frenet," << "\n";
1944 di << " = 2 - DiscreteTrihedron" << "\n";
1945 di << "Approx - force C1-approximation if result is C0" << "\n";
1946 return 0;
1947 }
1948
1949 if (n > 1 && n < 4) return 1;
1950
1951 TopoDS_Shape Spine = DBRep::Get(a[2],TopAbs_WIRE);
1952 if ( Spine.IsNull()) return 1;
1953
1954 TopoDS_Shape Profile = DBRep::Get(a[3]);
1955 if ( Profile.IsNull()) return 1;
1956
1957 GeomFill_Trihedron Mode = GeomFill_IsCorrectedFrenet;
1958 if (n >= 5)
1959 {
1960 Standard_Integer iMode = atoi(a[4]);
1961 if (iMode == 1)
1962 Mode = GeomFill_IsFrenet;
1963 else if (iMode == 2)
1964 Mode = GeomFill_IsDiscreteTrihedron;
1965 }
1966
1967 Standard_Boolean ForceApproxC1 = Standard_False;
1968 if (n >= 6)
1969 ForceApproxC1 = Standard_True;
1970
1971 BRepOffsetAPI_MakePipe aPipe(TopoDS::Wire(Spine),
1972 Profile,
1973 Mode,
1974 ForceApproxC1);
1975
1976 TopoDS_Shape S = aPipe.Shape();
1977 TopoDS_Shape aSF = aPipe.FirstShape();
1978 TopoDS_Shape aSL = aPipe.LastShape();
1979
1980 DBRep::Set(a[1],S);
1981
1982 TCollection_AsciiString aStrF(a[1], "_f");
1983 TCollection_AsciiString aStrL(a[1], "_l");
1984
1985 DBRep::Set(aStrF.ToCString(), aSF);
1986 DBRep::Set(aStrL.ToCString(), aSL);
1987
1988 return 0;
1989}
1990
3497d552 1991#include <IGESControl_Reader.hxx>
1992#include <IGESControl_Controller.hxx>
1993#include <IGESData_IGESEntity.hxx>
1994#include <BRepCheck_Analyzer.hxx>
1995#include <PTColStd_TransientPersistentMap.hxx>
1996#include <PTopoDS_HShape.hxx>
1997#include <Storage_Data.hxx>
1998#include <TopExp_Explorer.hxx>
1999#include <MgtBRep.hxx>
2000#include <FSD_File.hxx>
2001#include <ShapeSchema.hxx>
2002#include <TColStd_HSequenceOfTransient.hxx>
2003#include <PTColStd_PersistentTransientMap.hxx>
2004#include <Storage_Root.hxx>
2005
2006static Standard_Integer OCC24565 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
2007{
2008 if (argc != 3) {
2009 di << "Usage : " << argv[0] << " FileNameIGS FileNameSTOR";
2010 return 1;
2011 }
2012
2013 Standard_CString sFileNameIGS = argv[1];
2014 Standard_CString sFileNameSTOR = argv[2];
2015
2016 IGESControl_Reader ICReader;
2017
2018 /* * * * * * *
2019 * Read the IGES file and make sure it is valid
2020 *
2021 * * * * * * */
2022 IGESControl_Controller::Init();
2023
2024 if (!ICReader.ReadFile(sFileNameIGS)) {
2025 printf("%s:%d - Error reading '%s'\n",__FUNCTION__,__LINE__,sFileNameIGS);fflush(stdout);
2026 return -1;
2027 }
2028
2029 int nbShapes = ICReader.NbShapes();
2030
2031 printf("%s:%d - nbShapes = '%d'\n",__FUNCTION__,__LINE__,nbShapes);fflush(stdout);
2032
2033 TopoDS_Shape Shape;
2034 if(nbShapes == 0)
2035 {
2036 Handle(TColStd_HSequenceOfTransient) faces=ICReader.GiveList("iges-faces");
2037 Handle(TColStd_HSequenceOfTransient) surfaceList=ICReader.GiveList("xst-transferrable-roots",faces);
2038
2039 if (surfaceList.IsNull())
2040 {
2041 printf("%s:%d - surfaceList.IsNull()\n",__FUNCTION__,__LINE__);fflush(stdout);
2042 return -1;
2043 }
2044 BRep_Builder builder;
2045 TopoDS_Compound* pC = new TopoDS_Compound();
2046 builder.MakeCompound(*pC);
2047
2048 for (int j=1;j<=surfaceList->Length();j++)
2049 {
2050 Handle(IGESData_IGESEntity) igesEntity=Handle(IGESData_IGESEntity)::DownCast(surfaceList->Value(j));
2051 if (igesEntity.IsNull()) continue;
2052 ICReader.ClearShapes();
2053 Standard_Boolean rv;
2054 try {
2055 rv=ICReader.TransferEntity(igesEntity);
2056 }
2057 catch (...) {
2058 rv=Standard_False;
2059 }
2060 if (!rv) {
2061 printf("%s:%d - Error transferring IGES entity\n",__FUNCTION__,__LINE__);fflush(stdout);
2062 printf("%s:%d - FormNumber = %d, TypeNumber = %d\n",__FUNCTION__,__LINE__,igesEntity->FormNumber(),igesEntity->TypeNumber());fflush(stdout);
2063 return -1;
2064 }
2065
2066 TopoDS_Shape S;
2067 try {
2068 S=ICReader.Shape();
2069 }
2070 catch(...) {
2071 printf("%s:%d - Error reading IGES entity\n",__FUNCTION__,__LINE__);fflush(stdout);
2072 printf("%s:%d - FormNumber = %d, TypeNumber = %d\n",__FUNCTION__,__LINE__,igesEntity->FormNumber(),igesEntity->TypeNumber());fflush(stdout);
2073 return -1;
2074 }
2075 if (S.IsNull()) {
2076 printf("%s:%d - NULL Surface encountered\n",__FUNCTION__,__LINE__);
2077 return -1;
2078 }
2079
2080 try
2081 {
2082 builder.Add(*pC,S);
2083 }
2084 catch(...)
2085 {
2086 printf("%s: Exception adding face.\n",__FUNCTION__);
2087 }
2088 }
2089 Shape = TopoDS_Shape(*pC);
2090 }
2091 else
2092 {
2093 Shape = ICReader.OneShape();
2094 }
2095 {
2096 BRepCheck_Analyzer brca(Shape);
2097
2098 if(!brca.IsValid())
2099 {
2100 printf("%s: Invalid shape after reading IGES file.\n",__FUNCTION__);
2101 }
2102 }
2103
2104 /* * * * * * *
2105 * Write the contents of the Shape to a STOR file
2106 *
2107 * * * * * * */
2108 PTColStd_TransientPersistentMap aMapTP;
2109 Handle(PTopoDS_HShape) aPShape_write;
2110 Handle(Storage_Data) d_write=new Storage_Data;
2111 char Name[32];
2112
2113 TopExp_Explorer Ex;
2114 int i;
2115 int max_i = 0;
2116
2117 for (i=0,Ex.Init(Shape,TopAbs_FACE);Ex.More();i++,Ex.Next())
2118 {
2119
2120 max_i = i;
2121 try {
2122 aPShape_write=MgtBRep::Translate(Ex.Current(),aMapTP,MgtBRep_WithoutTriangle);
2123 }
2124 catch (...) {
2125 printf("%s: Error translating surface '%d'\n",__FUNCTION__,i);
2126 }
2127
2128 sprintf(Name,"S%010d",i);
2129
2130 {
2131 BRepCheck_Analyzer brca(Ex.Current());
2132 if(!brca.IsValid())
2133 {
2134 printf("INVALID face '%s' in the shape, which will be written to the STOR file.\n",Name);
2135 }
2136 }
2137 try {
2138 d_write->AddRoot(Name,aPShape_write);
2139 }
2140 catch (...) {
2141 printf("%s: Error adding surface '%d', RootName = '%s'\n",__FUNCTION__,i,Name);
2142 }
2143 }
2144 printf("%s: Going to write %d surfaces.\n",__FUNCTION__,max_i+1);
2145
2146 FSD_File f_write;
2147 if(f_write.Open(sFileNameSTOR, Storage_VSWrite)!=Storage_VSOk)
2148 {
2149 printf("%s: Error opening file: %s\n", __FUNCTION__,sFileNameSTOR);
2150 return -1;
2151 }
2152 Handle(ShapeSchema) s_write=new ShapeSchema;
2153 s_write->Write(f_write,d_write);
2154 f_write.Close();
2155 printf("%s: Wrote to the STOR file.\n",__FUNCTION__);
2156
2157 /* * * * * * *
2158 * Read the contents of the Shape from a STOR file
2159 *
2160 * * * * * * */
2161 FSD_File f_read;
2162 if(f_read.Open(sFileNameSTOR, Storage_VSRead)!=Storage_VSOk)
2163 {
2164 printf("%s: Error opening file: %s\n", __FUNCTION__,sFileNameSTOR);
2165 return -1;
2166 }
2167 Handle(ShapeSchema) s_read=new ShapeSchema;
2168 Handle(Storage_Data) d_read=s_read->Read(f_read);
2169
2170 Handle(Standard_Persistent) p;
2171 Handle(Storage_Root) r;
2172 Handle(PTopoDS_HShape) aPShape_read;
2173 PTColStd_PersistentTransientMap aMapPT;
2174 TopoDS_Shape S_read;
2175
2176 printf("%s: Extracting %d faces from the STOR file.\n",__FUNCTION__,max_i+1);
2177 for(int i = 0; i <= max_i; ++i)
2178 {
2179 sprintf(Name,"S%010d",i);
2180 r=d_read->Find(Name);
2181 if(r.IsNull())
2182 {
2183 printf("%s:%d '%s' IsNull().\n",__FUNCTION__,__LINE__,Name);fflush(stdout);
2184 continue;
2185 }
2186 p=r->Object();
2187 aPShape_read = Handle(PTopoDS_HShape)::DownCast(p);
2188 try {
2189 MgtBRep::Translate(aPShape_read,aMapPT,S_read,MgtBRep_WithoutTriangle);
2190 }
2191 catch (Standard_Failure) {
2192 Handle(Standard_Failure) E=Standard_Failure::Caught();
2193 std::string str;
2194 str="Exception: ";
2195 str+=E->DynamicType()->Name();
2196 str+=" => ";
2197 str+=E->GetMessageString();
2198 printf("%s(1): %s: %s\n",__FUNCTION__,Name,str.c_str());fflush(stdout);
2199 }
2200 catch (...) {
2201 printf("%s(1): Unhandled exception in MgtBRep::Translate\n",__FUNCTION__);
2202 }
2203
2204 BRepCheck_Analyzer brca(S_read);
2205
2206 if(!brca.IsValid())
2207 {
2208 printf("%s: Read INVALID face (%s)!\n",__FUNCTION__,Name);
2209 }
2210 }
2211
2212 printf("Completed.\n");fflush(stdout);
2213
2214 return 0;
2215}
2216
70167e69
RL
2217#include <Handle_BRepTools_NurbsConvertModification.hxx>
2218#include <BRepPrimAPI_MakeCylinder.hxx>
2219#include <BRepBuilderAPI_Copy.hxx>
2220#include <BRepTools_NurbsConvertModification.hxx>
2221static TopoDS_Shape CreateTestShape (int& theShapeNb)
2222{
2223 TopoDS_Compound aComp;
2224 BRep_Builder aBuilder;
2225 aBuilder.MakeCompound (aComp);
2226 //NURBS modifier is used to increase footprint of each shape
2227 Handle_BRepTools_NurbsConvertModification aNurbsModif = new BRepTools_NurbsConvertModification;
2228 TopoDS_Shape aRefShape = BRepPrimAPI_MakeCylinder (50., 100.).Solid();
2229 BRepTools_Modifier aModifier (aRefShape, aNurbsModif);
2230 if (aModifier.IsDone()) {
2231 aRefShape = aModifier.ModifiedShape (aRefShape);
2232 }
2233 int aSiblingNb = 0;
2234 for (; theShapeNb > 0; --theShapeNb) {
2235 TopoDS_Shape aShape;
2236 if (++aSiblingNb <= 100) { //number of siblings is limited to avoid long lists
2237 aShape = BRepBuilderAPI_Copy (aRefShape, Standard_True /*CopyGeom*/).Shape();
2238 } else {
2239 aShape = CreateTestShape (theShapeNb);
2240 }
2241 aBuilder.Add (aComp, aShape);
2242 }
2243 return aComp;
2244}
2245
2246#include <AppStd_Application.hxx>
2247#include <TDataStd_Integer.hxx>
2248#include <TNaming_Builder.hxx>
2249static Standard_Integer OCC24931 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
2250{
7a7e8cf1 2251 if (argc != 2) {
70167e69
RL
2252 di << "Usage: " << argv[0] << " invalid number of arguments"<<"\n";
2253 return 1;
2254 }
7a7e8cf1 2255 TCollection_ExtendedString aFileName (argv[1]);
70167e69
RL
2256 PCDM_StoreStatus aSStatus = PCDM_SS_Failure;
2257
2258 Handle(TDocStd_Application) anApp = new AppStd_Application;
2259 {
2260 Handle(TDocStd_Document) aDoc;
2261 anApp->NewDocument ("XmlOcaf", aDoc);
2262 TDF_Label aLab = aDoc->Main();
2263 TDataStd_Integer::Set (aLab, 0);
2264 int n = 10000; //must be big enough
2265 TopoDS_Shape aShape = CreateTestShape (n);
2266 TNaming_Builder aBuilder (aLab);
2267 aBuilder.Generated (aShape);
2268
2269 aSStatus = anApp->SaveAs (aDoc, aFileName);
2270 anApp->Close (aDoc);
2271 }
2272 QCOMPARE (aSStatus, PCDM_SS_OK);
2273 return 0;
2274}
2275
d01cc61d 2276#include <AppStdL_Application.hxx>
2277#include <TDocStd_Application.hxx>
2278#include <TDataStd_Integer.hxx>
2279#include <TDF_AttributeIterator.hxx>
2280//=======================================================================
2281//function : OCC24755
2282//purpose :
2283//=======================================================================
2284static Standard_Integer OCC24755 (Draw_Interpretor& di, Standard_Integer n, const char** a)
2285{
2286 if (n != 1)
2287 {
2288 std::cout << "Usage : " << a[0] << "\n";
2289 return 1;
2290 }
2291
2292 Handle(TDocStd_Application) anApp = new AppStdL_Application;
2293 Handle(TDocStd_Document) aDoc;
2294 anApp->NewDocument ("MDTV-Standard", aDoc);
2295 TDF_Label aLab = aDoc->Main();
2296 TDataStd_Integer::Set (aLab, 0);
2297 TDataStd_Name::Set (aLab, "test");
2298
2299 TDF_AttributeIterator i (aLab);
2300 Handle(TDF_Attribute) anAttr = i.Value();
2301 QCOMPARE (anAttr->IsKind (STANDARD_TYPE (TDataStd_Integer)), Standard_True);
2302 i.Next();
2303 anAttr = i.Value();
2304 QCOMPARE (anAttr->IsKind (STANDARD_TYPE (TDataStd_Name)), Standard_True);
2305
2306 return 0;
2307}
2308
a73267f2 2309struct MyStubObject
2310{
2311 MyStubObject() : ptr(0L) {}
2312 MyStubObject(void* thePtr) : ptr(thePtr) {}
2313 char overhead[40];
2314 void* ptr;
2315};
2316
2317//=======================================================================
2318//function : OCC24834
2319//purpose :
2320//=======================================================================
2321static Standard_Integer OCC24834 (Draw_Interpretor& di, Standard_Integer n, const char** a)
2322{
2323 if (n != 1)
2324 {
2325 std::cout << "Usage : " << a[0] << "\n";
2326 return 1;
2327 }
5a89733f 2328
2329 int i = sizeof (char*);
2330 if (i > 4) {
2d7b28ac 2331 std::cout << "64-bit architecture is not supported.\n";
2332 return 0;
2333 }
a73267f2 2334
2335 NCollection_List<MyStubObject> aList;
2336 const Standard_Integer aSmallBlockSize = 40;
2337 const Standard_Integer aLargeBlockSize = 1500000;
2338
2339 // quick populate memory with large blocks
2340 try
2341 {
2342 for (;;)
2343 {
2344 aList.Append(MyStubObject(Standard::Allocate(aLargeBlockSize)));
2345 }
2346 }
2347 catch (Standard_Failure)
2348 {
2349 di << "caught out of memory for large blocks: OK\n";
2350 }
2351 catch (...)
2352 {
2353 di << "skept out of memory for large blocks: Error\n";
2354 }
2355
2356 // allocate small blocks
2357 try
2358 {
2359 for (;;)
2360 {
2361 aList.Append(MyStubObject(Standard::Allocate(aSmallBlockSize)));
2362 }
2363 }
2364 catch (Standard_Failure)
2365 {
2366 di << "caught out of memory for small blocks: OK\n";
2367 }
2368 catch (...)
2369 {
2370 di << "skept out of memory for small blocks: Error\n";
2371 }
2372
2373 // release all allocated blocks
2374 for (NCollection_List<MyStubObject>::Iterator it(aList); it.More(); it.Next())
2375 {
2376 Standard::Free(it.Value().ptr);
2377 }
2378 return 0;
2379}
2380
8696d65d 2381
2382#include <Geom2dAPI_InterCurveCurve.hxx>
2383#include <IntRes2d_IntersectionPoint.hxx>
2384//=======================================================================
2385//function : OCC24889
2386//purpose :
2387//=======================================================================
2388static Standard_Integer OCC24889 (Draw_Interpretor& theDI,
2389 Standard_Integer /*theNArg*/,
2390 const char** /*theArgs*/)
2391{
2392 // Curves
2393 Handle( Geom2d_Circle ) aCircle1 = new Geom2d_Circle(
2394 gp_Ax22d( gp_Pnt2d( 25, -25 ), gp_Dir2d( 1, 0 ), gp_Dir2d( -0, 1 ) ), 155 );
2395
2396 Handle( Geom2d_Circle ) aCircle2 = new Geom2d_Circle(
2397 gp_Ax22d( gp_Pnt2d( 25, 25 ), gp_Dir2d( 1, 0 ), gp_Dir2d( -0, 1 ) ), 155 );
2398
2399 Handle( Geom2d_TrimmedCurve ) aTrim[2] = {
2400 new Geom2d_TrimmedCurve( aCircle1, 1.57079632679490, 2.97959469729228 ),
2401 new Geom2d_TrimmedCurve( aCircle2, 3.30359060633978, 4.71238898038469 )
2402 };
2403
2404 DrawTrSurf::Set("c_1", aTrim[0]);
2405 DrawTrSurf::Set("c_2", aTrim[1]);
2406
2407 // Intersection
2408 const Standard_Real aTol = Precision::Confusion();
2409 Geom2dAPI_InterCurveCurve aIntTool( aTrim[0], aTrim[1], aTol );
2410
2411 const IntRes2d_IntersectionPoint& aIntPnt =
2412 aIntTool.Intersector().Point( 1 );
2413
2414 gp_Pnt2d aIntRes = aIntTool.Point( 1 );
2415 Standard_Real aPar[2] = {
2416 aIntPnt.ParamOnFirst(),
2417 aIntPnt.ParamOnSecond()
2418 };
2419
2420 //theDI.precision( 5 );
2421 theDI << "Int point: X = " << aIntRes.X() << "; Y = " << aIntRes.Y() << "\n";
2422 for (int i = 0; i < 2; ++i)
2423 {
2424 theDI << "Curve " << i << ": FirstParam = " << aTrim[i]->FirstParameter() <<
2425 "; LastParam = " << aTrim[i]->LastParameter() <<
2426 "; IntParameter = " << aPar[i] << "\n";
2427 }
2428
2429 return 0;
2430}
2431
5493d334 2432#include <math_GlobOptMin.hxx>
2433#include <math_MultipleVarFunctionWithHessian.hxx>
2434//=======================================================================
2435//function : OCC25004
2436//purpose : Check extremaCC on Branin function.
2437//=======================================================================
2438// Function is:
2439// f(u,v) = a*(v - b*u^2 + c*u-r)^2+s(1-t)*cos(u)+s
2440// Standard borders are:
2441// -5 <= u <= 10
2442// 0 <= v <= 15
2443class BraninFunction : public math_MultipleVarFunctionWithHessian
2444{
2445public:
2446 BraninFunction()
2447 {
2448 a = 1.0;
2449 b = 5.1 / (4.0 * M_PI * M_PI);
2450 c = 5.0 / M_PI;
2451 r = 6.0;
2452 s = 10.0;
2453 t = 1.0 / (8.0 * M_PI);
2454 }
2455 virtual Standard_Integer NbVariables() const
2456 {
2457 return 2;
2458 }
2459 virtual Standard_Boolean Value(const math_Vector& X,Standard_Real& F)
2460 {
2461 Standard_Real u = X(1);
2462 Standard_Real v = X(2);
2463
2464 Standard_Real aSqPt = (v - b * u * u + c * u - r); // Square Part of function.
2465 Standard_Real aLnPt = s * (1 - t) * cos(u); // Linear part of funcrtion.
2466 F = a * aSqPt * aSqPt + aLnPt + s;
2467 return Standard_True;
2468 }
2469 virtual Standard_Boolean Gradient(const math_Vector& X,math_Vector& G)
2470 {
2471 Standard_Real u = X(1);
2472 Standard_Real v = X(2);
2473
2474 Standard_Real aSqPt = (v - b * u * u + c * u - r); // Square Part of function.
2475 G(1) = 2 * a * aSqPt * (c - 2 * b * u) - s * (1 - t) * sin(u);
2476 G(2) = 2 * a * aSqPt;
2477
2478 return Standard_True;
2479 }
2480 virtual Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G)
2481 {
2482 Value(X,F);
2483 Gradient(X,G);
2484
2485 return Standard_True;
2486 }
2487 virtual Standard_Boolean Values(const math_Vector& X,Standard_Real& F,math_Vector& G,math_Matrix& H)
2488 {
2489 Value(X,F);
2490 Gradient(X,G);
2491
2492 Standard_Real u = X(1);
2493 Standard_Real v = X(2);
2494
2495 Standard_Real aSqPt = (v - b * u * u + c * u - r); // Square Part of function.
2496 Standard_Real aTmpPt = c - 2 * b *u; // Tmp part.
2497 H(1,1) = 2 * a * aTmpPt * aTmpPt - 4 * a * b * aSqPt - s * (1 - t) * cos(u);
2498 H(1,2) = 2 * a * aTmpPt;
2499 H(2,1) = H(1,2);
2500 H(2,2) = 2 * a;
2501
2502 return Standard_True;
2503 }
2504
2505private:
2506 // Standard parameters.
2507 Standard_Real a, b, c, r, s, t;
2508};
2509
2510static Standard_Integer OCC25004 (Draw_Interpretor& theDI,
2511 Standard_Integer /*theNArg*/,
2512 const char** /*theArgs*/)
2513{
2514 math_MultipleVarFunction* aFunc = new BraninFunction();
2515
2516 math_Vector aLower(1,2), aUpper(1,2);
2517 aLower(1) = -5;
2518 aLower(2) = 0;
2519 aUpper(1) = 10;
2520 aUpper(2) = 15;
2521
2522 Standard_Integer aGridOrder = 16;
2523 math_Vector aFuncValues(1, aGridOrder * aGridOrder);
2524
2525 Standard_Real aLipConst = 0;
2526 math_Vector aCurrPnt1(1, 2), aCurrPnt2(1, 2);
2527
2528 // Get Lipshitz constant estimation on regular grid.
2529 Standard_Integer i, j, idx = 1;
2530 for(i = 1; i <= aGridOrder; i++)
2531 {
2532 for(j = 1; j <= aGridOrder; j++)
2533 {
2534 aCurrPnt1(1) = aLower(1) + (aUpper(1) - aLower(1)) * (i - 1) / (aGridOrder - 1.0);
2535 aCurrPnt1(2) = aLower(2) + (aUpper(2) - aLower(2)) * (j - 1) / (aGridOrder - 1.0);
2536
2537 aFunc->Value(aCurrPnt1, aFuncValues(idx));
2538 idx++;
2539 }
2540 }
2541
2542 Standard_Integer k, l;
2543 Standard_Integer idx1, idx2;
2544 for(i = 1; i <= aGridOrder; i++)
2545 for(j = 1; j <= aGridOrder; j++)
2546 for(k = 1; k <= aGridOrder; k++)
2547 for(l = 1; l <= aGridOrder; l++)
2548 {
2549 if (i == k && j == l)
2550 continue;
2551
2552 aCurrPnt1(1) = aLower(1) + (aUpper(1) - aLower(1)) * (i - 1) / (aGridOrder - 1.0);
2553 aCurrPnt1(2) = aLower(2) + (aUpper(2) - aLower(2)) * (j - 1) / (aGridOrder - 1.0);
2554 idx1 = (i - 1) * aGridOrder + j;
2555
2556 aCurrPnt2(1) = aLower(1) + (aUpper(1) - aLower(1)) * (k - 1) / (aGridOrder - 1.0);
2557 aCurrPnt2(2) = aLower(2) + (aUpper(2) - aLower(2)) * (l - 1) / (aGridOrder - 1.0);
2558 idx2 = (k - 1) * aGridOrder + l;
2559
2560 aCurrPnt1.Add(-aCurrPnt2);
2561 Standard_Real dist = aCurrPnt1.Norm();
2562
2563 Standard_Real C = Abs(aFuncValues(idx1) - aFuncValues(idx2)) / dist;
2564 if (C > aLipConst)
2565 aLipConst = C;
2566 }
2567
2568 math_GlobOptMin aFinder(aFunc, aLower, aUpper, aLipConst);
2569 aFinder.Perform();
2570 //(-pi , 12.275), (pi , 2.275), (9.42478, 2.475)
2571
2572 Standard_Real anExtValue = aFinder.GetF();
2573 theDI << "F = " << anExtValue << "\n";
2574
2575 Standard_Integer aNbExt = aFinder.NbExtrema();
2576 theDI << "NbExtrema = " << aNbExt << "\n";
2577
2578 return 0;
2579}
8696d65d 2580
b6c0b841
RL
2581#include <OSD_Environment.hxx>
2582#include <Plugin.hxx>
2583#include <Plugin_Macro.hxx>
2584#include <Resource_Manager.hxx>
2585
2586#define THE_QATEST_DOC_FORMAT "My Proprietary Format"
2587
2588#define QA_CHECK(theDesc, theExpr, theValue) \
2589{\
2590 const bool isTrue = !!(theExpr); \
2591 std::cout << theDesc << (isTrue ? " TRUE " : " FALSE ") << (isTrue == theValue ? " is OK\n" : " is FAIL\n"); \
2592}
2593
2594class Test_TDocStd_Application : public TDocStd_Application
2595{
2596public:
2597
2598 static void initGlobalPluginMap (const TCollection_AsciiString& thePlugin,
2599 const TCollection_AsciiString& theSaver,
2600 const TCollection_AsciiString& theLoader)
2601 {
2602 const Handle(Resource_Manager)& aManager = Plugin::AdditionalPluginMap();
2603 aManager->SetResource ((theSaver + ".Location").ToCString(), thePlugin.ToCString());
2604 aManager->SetResource ((theLoader + ".Location").ToCString(), thePlugin.ToCString());
2605 }
2606
2607 Test_TDocStd_Application (const TCollection_AsciiString& thePlugin,
2608 const TCollection_AsciiString& theSaver,
2609 const TCollection_AsciiString& theLoader)
2610 {
2611 initGlobalPluginMap (thePlugin, theSaver, theLoader);
2612
2613 // explicitly initialize resource manager
2614 myResources = new Resource_Manager ("");
2615 myResources->SetResource ("xml.FileFormat", THE_QATEST_DOC_FORMAT);
2616 myResources->SetResource (THE_QATEST_DOC_FORMAT ".Description", "Test XML Document");
2617 myResources->SetResource (THE_QATEST_DOC_FORMAT ".FileExtension", "xml");
2618 myResources->SetResource (THE_QATEST_DOC_FORMAT ".StoragePlugin", theSaver.ToCString());
2619 myResources->SetResource (THE_QATEST_DOC_FORMAT ".RetrievalPlugin", theLoader.ToCString());
2620 }
2621
2622 virtual Standard_CString ResourcesName() { return ""; }
2623 virtual void Formats (TColStd_SequenceOfExtendedString& theFormats) { theFormats.Clear(); }
2624};
2625
2626//=======================================================================
2627//function : OCC24925
2628//purpose :
2629//=======================================================================
2630static Standard_Integer OCC24925 (Draw_Interpretor& theDI,
2631 Standard_Integer theArgNb,
2632 const char** theArgVec)
2633{
2634 if (theArgNb != 2
2635 && theArgNb != 5)
2636 {
2637 std::cout << "Error: wrong syntax! See usage:\n";
2638 theDI.PrintHelp (theArgVec[0]);
2639 return 1;
2640 }
2641
2642 Standard_Integer anArgIter = 1;
2643 TCollection_ExtendedString aFileName = theArgVec[anArgIter++];
2644 TCollection_AsciiString aPlugin = "TKXml";
2645 TCollection_AsciiString aSaver = "03a56820-8269-11d5-aab2-0050044b1af1"; // XmlStorageDriver in XmlDrivers.cxx
2646 TCollection_AsciiString aLoader = "03a56822-8269-11d5-aab2-0050044b1af1"; // XmlRetrievalDriver in XmlDrivers.cxx
2647 if (anArgIter < theArgNb)
2648 {
2649 aPlugin = theArgVec[anArgIter++];
2650 aSaver = theArgVec[anArgIter++];
2651 aLoader = theArgVec[anArgIter++];
2652 }
2653
2654 PCDM_StoreStatus aSStatus = PCDM_SS_Failure;
2655 PCDM_ReaderStatus aRStatus = PCDM_RS_OpenError;
2656
2657 Handle(TDocStd_Application) anApp = new Test_TDocStd_Application (aPlugin, aSaver, aLoader);
2658 {
2659 Handle(TDocStd_Document) aDoc;
2660 anApp->NewDocument (THE_QATEST_DOC_FORMAT, aDoc);
2661 TDF_Label aLab = aDoc->Main();
2662 TDataStd_Integer::Set (aLab, 0);
2663 TDataStd_Name::Set (aLab, "QABugs_19.cxx");
2664
2665 aSStatus = anApp->SaveAs (aDoc, aFileName);
2666 anApp->Close (aDoc);
2667 }
2668 QA_CHECK ("SaveAs()", aSStatus == PCDM_SS_OK, true);
2669
2670 {
2671 Handle(TDocStd_Document) aDoc;
2672 aRStatus = anApp->Open (aFileName, aDoc);
2673 anApp->Close (aDoc);
2674 }
2675 QA_CHECK ("Open() ", aRStatus == PCDM_RS_OK, true);
2676 return 0;
2677}
2678
a967f104 2679//=======================================================================
2680//function : OCC25043
2681//purpose :
2682//=======================================================================
2683#include <BRepAlgoAPI_Check.hxx>
2684static Standard_Integer OCC25043 (Draw_Interpretor& theDI,
2685 Standard_Integer theArgNb,
2686 const char** theArgVec)
2687{
2688 if (theArgNb != 2) {
2689 theDI << "Usage: " << theArgVec[0] << " shape\n";
2690 return 1;
2691 }
2692
2693 TopoDS_Shape aShape = DBRep::Get(theArgVec[1]);
2694 if (aShape.IsNull())
2695 {
2696 theDI << theArgVec[1] << " shape is NULL\n";
2697 return 1;
2698 }
2699
2700 BRepAlgoAPI_Check anAlgoApiCheck(aShape, Standard_True, Standard_True);
2701
2702 if (!anAlgoApiCheck.IsValid())
2703 {
2704 BOPAlgo_ListIteratorOfListOfCheckResult anCheckIter(anAlgoApiCheck.Result());
2705 for (; anCheckIter.More(); anCheckIter.Next())
2706 {
2707 const BOPAlgo_CheckResult& aCurCheckRes = anCheckIter.Value();
2708 const BOPCol_ListOfShape& aCurFaultyShapes = aCurCheckRes.GetFaultyShapes1();
2709 BOPCol_ListIteratorOfListOfShape aFaultyIter(aCurFaultyShapes);
2710 for (; aFaultyIter.More(); aFaultyIter.Next())
2711 {
2712 const TopoDS_Shape& aFaultyShape = aFaultyIter.Value();
2713
2714 Standard_Boolean anIsFaultyShapeFound = Standard_False;
2715 TopExp_Explorer anExp(aShape, aFaultyShape.ShapeType());
2716 for (; anExp.More() && !anIsFaultyShapeFound; anExp.Next())
2717 {
2718 if (anExp.Current().IsEqual(aFaultyShape))
2719 anIsFaultyShapeFound = Standard_True;
2720 }
2721
2722 if (!anIsFaultyShapeFound)
2723 {
2724 theDI << "Error. Faulty Shape is NOT found in source shape.\n";
2725 return 0;
2726 }
2727 else
2728 {
2729 theDI << "Info. Faulty shape if found in source shape\n";
2730 }
2731 }
2732 }
2733 }
2734 else
2735 {
2736 theDI << "Error. Problems are not detected. Test is not performed.";
2737 }
2738
2739 return 0;
2740}
2741
4a350f94 2742//=======================================================================
2743//function : OCC24606
2744//purpose :
2745//=======================================================================
2746static Standard_Integer OCC24606 (Draw_Interpretor& theDI,
2747 Standard_Integer theArgNb,
2748 const char** theArgVec)
2749{
2750 if (theArgNb > 1)
2751 {
2752 std::cerr << "Error: incorrect number of arguments.\n";
2753 theDI << "Usage : " << theArgVec[0] << "\n";
2754 return 1;
2755 }
2756
2757 Handle(V3d_View) aView = ViewerTest::CurrentView();
2758 if (aView.IsNull())
2759 {
2760 std::cerr << "Errro: no active view, please call 'vinit'.\n";
2761 return 1;
2762 }
2763
2764 aView->DepthFitAll();
2765 aView->FitAll();
2766
2767 return 0;
2768}
2769
e4b5c45a 2770//=======================================================================
2771//function : OCC23010
2772//purpose :
2773//=======================================================================
2774#include <STEPCAFControl_Reader.hxx>
2775
2776class mOcafApplication : public TDocStd_Application
2777{
2778 void Formats(TColStd_SequenceOfExtendedString& Formats)
2779 {
2780 Formats.Append(TCollection_ExtendedString("mOcafApplication"));
2781 }
2782 Standard_CString ResourcesName()
2783 {
2784 return Standard_CString("Resources");
2785 }
2786};
2787
2788static Standard_Integer OCC23010 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
2789{
2790 if (argc != 2) {
2791 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
2792 return 1;
2793 }
2794 std::string fileName=argv[1];
2795 mOcafApplication *mCasApp = new mOcafApplication();
2796 Handle(TDocStd_Document) doc;
2797 mCasApp->NewDocument("MDTV-XCAF", doc);
2798 STEPCAFControl_Reader stepReader;
2799 IFSelect_ReturnStatus status = stepReader.ReadFile (fileName.c_str());
2800 if (status != IFSelect_RetDone)
2801 return false;
2802 stepReader.SetColorMode(Standard_True);
2803 stepReader.SetLayerMode(Standard_True);
2804 stepReader.SetNameMode(Standard_True);
2805 stepReader.Transfer(doc); // ERROR HERE!!!
2806 delete mCasApp;
2807 return 0;
2808}
2809
ab860031 2810//=======================================================================
2811//function : OCC25202
2812//purpose :
2813//=======================================================================
2814#include <ShapeBuild_ReShape.hxx>
2815static Standard_Integer OCC25202 ( Draw_Interpretor& theDI,
2816 Standard_Integer theArgN,
2817 const char** theArgVal)
2818{
2819 // 0 1 2 3 4 5 6
2820 //reshape res shape numF1 face1 numF2 face2
2821 if(theArgN < 7)
2822 {
2823 theDI << "Use: reshape res shape numF1 face1 numF2 face2\n";
2824 return 1;
2825 }
2826
2827 TopoDS_Shape aShape = DBRep::Get(theArgVal[2]);
2828 const Standard_Integer aNumOfRE1 = Draw::Atoi(theArgVal[3]),
2829 aNumOfRE2 = Draw::Atoi(theArgVal[5]);
2830 TopoDS_Face aShapeForRepl1 = TopoDS::Face(DBRep::Get(theArgVal[4])),
2831 aShapeForRepl2 = TopoDS::Face(DBRep::Get(theArgVal[6]));
2832
2833 if(aShape.IsNull())
2834 {
2835 theDI << theArgVal[2] << " is null shape\n";
2836 return 1;
2837 }
2838
2839 if(aShapeForRepl1.IsNull())
2840 {
2841 theDI << theArgVal[4] << " is not a replaced type\n";
2842 return 1;
2843 }
2844
2845 if(aShapeForRepl2.IsNull())
2846 {
2847 theDI << theArgVal[6] << " is not a replaced type\n";
2848 return 1;
2849 }
2850
2851
2852 TopoDS_Shape aReplacedShape;
2853 ShapeBuild_ReShape aReshape;
2854
2855 //////////////////// explode (begin)
2856 TopTools_MapOfShape M;
2857 M.Add(aShape);
2858 Standard_Integer aNbShapes = 0;
2859 for (TopExp_Explorer ex(aShape,TopAbs_FACE); ex.More(); ex.Next())
2860 {
2861 const TopoDS_Shape& Sx = ex.Current();
2862 Standard_Boolean added = M.Add(Sx);
2863 if (added)
2864 {
2865 aNbShapes++;
2866 if(aNbShapes == aNumOfRE1)
2867 {
2868 aReplacedShape = Sx;
2869
2870 aReshape.Replace(aReplacedShape, aShapeForRepl1);
2871 }
2872
2873 if(aNbShapes == aNumOfRE2)
2874 {
2875 aReplacedShape = Sx;
2876
2877 aReshape.Replace(aReplacedShape, aShapeForRepl2);
2878 }
2879 }
2880 }
2881 //////////////////// explode (end)
2882
2883 if(aReplacedShape.IsNull())
2884 {
2885 theDI << "There is not any shape for replacing.\n";
2886 }
2887
2888 DBRep::Set (theArgVal[1],aReshape.Apply (aShape,TopAbs_WIRE,2));
2889
2890 return 0;
2891}
2892
c6037065 2893#include <ShapeFix_Wireframe.hxx>
2894//=======================================================================
2895//function : OCC7570
2896//purpose :
2897//=======================================================================
2898static Standard_Integer OCC7570 (Draw_Interpretor& di, Standard_Integer n, const char** a)
2899{
2900 if (n != 2) {
2901 di<<"Usage: "<<a[0]<<" invalid number of arguments"<<"\n";
2902 return 1;
2903 }
2904 TopoDS_Shape in_shape (DBRep::Get (a[1]));
2905 ShapeFix_Wireframe fix_tool (in_shape);
2906 fix_tool.ModeDropSmallEdges () = Standard_True;
2907 fix_tool.SetPrecision (1.e+6);
2908 fix_tool.SetLimitAngle (0.01);
2909 fix_tool.FixSmallEdges ();
2910 TopoDS_Shape new_shape = fix_tool.Shape ();
2911 return 0;
2912}
2913
54a16ee4 2914#include <AIS_TypeFilter.hxx>
5e452c37 2915//=======================================================================
2916//function : OCC25340
2917//purpose :
2918//=======================================================================
54a16ee4 2919static Standard_Integer OCC25340 (Draw_Interpretor& /*theDI*/,
2920 Standard_Integer /*theArgNb*/,
2921 const char** /*theArgVec*/)
2922{
2923 Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
2924 if (aCtx.IsNull())
2925 {
2926 std::cerr << "Error: No opened viewer!\n";
2927 return 1;
2928 }
2929 Handle(AIS_TypeFilter) aFilter = new AIS_TypeFilter (AIS_KOI_Shape);
2930 aCtx->AddFilter (aFilter);
2931 return 0;
2932}
2933
c7b59798 2934//=======================================================================
2935//function : OCC24826
2936//purpose :
2937//=======================================================================
2938class ParallelTest_Saxpy
2939{
2940public:
2941 typedef NCollection_Array1<Standard_Real> Vector;
2942
2943 //! Constructor
2944 ParallelTest_Saxpy(const Vector& theX, Vector& theY, Standard_Real theScalar)
2945 : myX(theX),
2946 myY(theY),
2947 myScalar(theScalar)
2948 {
2949 }
2950
2951 //! Dummy calculation
2952 void operator() (const Standard_Integer theIndex) const
2953 {
2954 myY(theIndex) = myScalar * myX(theIndex) + myY(theIndex);
2955 }
2956
2957private:
2958 ParallelTest_Saxpy( const ParallelTest_Saxpy& );
2959 ParallelTest_Saxpy& operator =( ParallelTest_Saxpy& );
2960
2961private:
2962 const Vector& myX;
2963 Vector& myY;
2964 const Standard_Real myScalar;
2965};
2966
2967//---------------------------------------------------------------------
2968static Standard_Integer OCC24826(Draw_Interpretor& theDI,
2969 Standard_Integer trheArgc,
2970 const char** theArgv)
2971{
2972 if ( trheArgc != 2 )
2973 {
2974 theDI << "Usage: "
2975 << theArgv[0]
2976 << " vec_length\n";
2977 return 1;
2978 }
2979
2980 // Generate data;
2981 Standard_Integer aLength = Draw::Atoi(theArgv[1]);
2982
2983 NCollection_Array1<Standard_Real> aX (0, aLength - 1);
2984 NCollection_Array1<Standard_Real> anY(0, aLength - 1);
2985
2986 for ( Standard_Integer i = 0; i < aLength; ++i )
2987 {
2988 aX(i) = anY(i) = (Standard_Real) i;
2989 }
2990
2991 OSD_Timer aTimer;
2992
2993 aTimer.Start();
2994
2995 //! Serial proccesing
2996 for ( Standard_Integer i = 0; i < aLength; ++i )
2997 {
2998 anY(i) = 1e-6 * aX(i) + anY(i);
2999 }
3000
3001 aTimer.Stop();
3002 cout << "Processing time (sequential mode):\n";
3003 aTimer.Show();
3004
3005 const ParallelTest_Saxpy aFunctor(aX, anY, 1e-6);
3006
3007 aTimer.Reset();
3008 aTimer.Start();
3009
3010 // Parallel processing
3011 OSD_Parallel::For(0, aLength, aFunctor);
3012
3013 aTimer.Stop();
3014 cout << "Processing time (parallel mode):\n";
3015 aTimer.Show();
3016
3017 return 0;
3018}
3019
b6c0b841 3020/*****************************************************************************/
8696d65d 3021
058f130e 3022#include <GeomAPI_IntSS.hxx>
3023//=======================================================================
3024//function : OCC25100
3025//purpose :
3026//=======================================================================
3027static Standard_Integer OCC25100 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
3028{
3029 if (argc < 2)
3030 {
3031 di << "the method requires a shape name\n";
3032 return 1;
3033 }
3034
3035 TopoDS_Shape S = DBRep::Get(argv[1]);
3036 if ( S.IsNull() )
3037 {
3038 di << "Shape is empty" << "\n";
3039 return 1;
3040 }
3041
3042 TopExp_Explorer aFaceExp(S, TopAbs_FACE);
3043 const Handle(Geom_Surface)& aSurf = BRep_Tool::Surface(TopoDS::Face(aFaceExp.Current()));
3044
3045 GeomAPI_IntSS anIntersector(aSurf, aSurf, Precision::Confusion());
3046
3047 if (!anIntersector.IsDone())
3048 {
3049 di << "Error. Intersection is not done\n";
3050 return 1;
3051 }
3052
3053 di << "Test complete\n";
3054
3055 return 0;
3056}
3057
5e452c37 3058//=======================================================================
3059//function : OCC25348
3060//purpose :
3061//=======================================================================
3062static Standard_Integer OCC25348 (Draw_Interpretor& theDI,
3063 Standard_Integer /*theArgNb*/,
3064 const char** /*theArgVec*/)
3065{
3066 Handle(NCollection_IncAllocator) anAlloc1;
3067 NCollection_List<int> aList1(anAlloc1);
3068 for (int i=0; i < 10; i++)
3069 {
3070 Handle(NCollection_IncAllocator) anAlloc2;
3071 NCollection_List<int> aList2(anAlloc2);
3072 aList2.Append(i);
3073 aList1.Assign(aList2);
3074 }
3075 theDI << "Test complete\n";
3076 return 0;
3077}
3078
6fb3418e 3079#include <IntCurvesFace_ShapeIntersector.hxx>
3080#include <BRepBndLib.hxx>
3081//=======================================================================
3082//function : OCC25413
3083//purpose :
3084//=======================================================================
3085static Standard_Integer OCC25413 (Draw_Interpretor& di, Standard_Integer narg , const char** a)
3086{
3087 if (narg != 2) {
3088 di << "Usage: " << a[0] << " invalid number of arguments" << "\n";
3089 return 1;
3090 }
3091 TopoDS_Shape aShape = DBRep::Get (a[1]);
3092
3093 IntCurvesFace_ShapeIntersector Inter;
3094 Inter.Load(aShape, Precision::Confusion());
3095
3096 Bnd_Box aBndBox;
3097 BRepBndLib::Add(aShape, aBndBox);
3098
3099 gp_Dir aDir(0., 1., 0.);
3100 const int N = 250;
3101 Standard_Real xMin = aBndBox.CornerMin().X();
3102 Standard_Real zMin = aBndBox.CornerMin().Z();
3103 Standard_Real xMax = aBndBox.CornerMax().X();
3104 Standard_Real zMax = aBndBox.CornerMax().Z();
3105 Standard_Real xStep = (xMax - xMin) / N;
3106 Standard_Real zStep = (zMax - zMin) / N;
3107
3108 for (Standard_Real x = xMin; x <= xMax; x += xStep)
3109 for (Standard_Real z = zMin; z <= zMax; z += zStep)
3110 {
3111 gp_Pnt aPoint(x, 0.0, z);
3112 gp_Lin aLine(aPoint, aDir);
3113 Inter.PerformNearest(aLine, -100., 100.);
3114 }
3115 return 0;
3116}
058f130e 3117
c088aa93 3118
3119#include <BOPAlgo_PaveFiller.hxx>
3120//
3121#include <BRepAlgoAPI_BooleanOperation.hxx>
3122#include <BRepAlgoAPI_Common.hxx>
3123#include <BRepAlgoAPI_Fuse.hxx>
3124#include <BRepAlgoAPI_Cut.hxx>
3125#include <BRepAlgoAPI_Section.hxx>
3126//
3127#include <BOPTools.hxx>
3128//
3129#include <BOPCol_MapOfShape.hxx>
3130#include <BOPCol_ListOfShape.hxx>
3131//=======================================================================
3132//function : OCC25446
3133//purpose :
3134//=======================================================================
3135static Standard_Integer OCC25446 (Draw_Interpretor& theDI,
3136 Standard_Integer argc,
3137 const char ** argv)
3138{
3139 if (argc != 5) {
3140 theDI << "Usage: OCC25446 res b1 b2 op\n";
3141 return 1;
3142 }
3143 //
3144 TopoDS_Shape aS1 = DBRep::Get(argv[2]);
3145 if (aS1.IsNull()) {
3146 theDI << argv[2] << " shape is NULL\n";
3147 return 1;
3148 }
3149 //
3150 TopoDS_Shape aS2 = DBRep::Get(argv[3]);
3151 if (aS2.IsNull()) {
3152 theDI << argv[3] << " shape is NULL\n";
3153 return 1;
3154 }
3155 //
3156 Standard_Integer iOp;
3157 BOPAlgo_Operation aOp;
3158 //
3159 iOp = Draw::Atoi(argv[4]);
3160 if (iOp < 0 || iOp > 4) {
3161 theDI << "Invalid operation type\n";
3162 return 1;
3163 }
3164 aOp = (BOPAlgo_Operation)iOp;
3165 //
3166 Standard_Integer iErr;
3167 BOPCol_ListOfShape aLS;
3168 BOPAlgo_PaveFiller aPF;
3169 //
3170 aLS.Append(aS1);
3171 aLS.Append(aS2);
3172 aPF.SetArguments(aLS);
3173 //
3174 aPF.Perform();
3175 iErr = aPF.ErrorStatus();
3176 if (iErr) {
3177 theDI << "Intersection failed with error status: " << iErr << "\n";
3178 return 1;
3179 }
3180 //
3181 BRepAlgoAPI_BooleanOperation* pBuilder = NULL;
3182 //
3183 switch (aOp) {
3184 case BOPAlgo_COMMON:
3185 pBuilder = new BRepAlgoAPI_Common(aS1, aS2, aPF);
3186 break;
3187 case BOPAlgo_FUSE:
3188 pBuilder = new BRepAlgoAPI_Fuse(aS1, aS2, aPF);
3189 break;
3190 case BOPAlgo_CUT:
3191 pBuilder = new BRepAlgoAPI_Cut (aS1, aS2, aPF);
3192 break;
3193 case BOPAlgo_CUT21:
3194 pBuilder = new BRepAlgoAPI_Cut(aS1, aS2, aPF, Standard_False);
3195 break;
3196 case BOPAlgo_SECTION:
3197 pBuilder = new BRepAlgoAPI_Section(aS1, aS2, aPF);
3198 break;
3199 default:
3200 break;
3201 }
3202 //
3203 iErr = pBuilder->ErrorStatus();
3204 if (!pBuilder->IsDone()) {
3205 theDI << "BOP failed with error status: " << iErr << "\n";
3206 return 1;
3207 }
3208 //
3209 const TopoDS_Shape& aRes = pBuilder->Shape();
3210 DBRep::Set(argv[1], aRes);
3211 //
3212 BOPCol_MapOfShape aMapArgs, aMapShape;
3213 BOPCol_MapIteratorOfMapOfShape aIt;
3214 Standard_Boolean bIsDeletedHist, bIsDeletedMap;
3215 TopAbs_ShapeEnum aType;
3216 //
3217 BOPTools::MapShapes(aS1, aMapArgs);
3218 BOPTools::MapShapes(aS2, aMapArgs);
3219 BOPTools::MapShapes(aRes, aMapShape);
3220 //
3221 aIt.Initialize(aMapArgs);
3222 for (; aIt.More(); aIt.Next()) {
3223 const TopoDS_Shape& aS = aIt.Value();
3224 aType = aS.ShapeType();
3225 if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE ||
3226 aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) {
3227 continue;
3228 }
3229 //
3230 bIsDeletedHist = pBuilder->IsDeleted(aS);
3231 bIsDeletedMap = !aMapShape.Contains(aS) &&
3232 (pBuilder->Modified(aS).Extent() == 0);
3233 //
3234 if (bIsDeletedHist != bIsDeletedMap) {
3235 theDI << "Error. Wrong value of IsDeleted flag.\n";
3236 return 1;
3237 }
3238 }
3239 //
3240 theDI << "Test complete\n";
3241 return 0;
3242}
3243
ee6bb37b 3244//====================================================
3245// Auxiliary functor class for the command OCC25545;
3246// it gets access to a vertex with the given index and
3247// checks that X coordinate of the point is equal to index;
3248// if it is not so then a data race is reported.
3249//====================================================
3250struct OCC25545_Functor
3251{
3252 OCC25545_Functor(const std::vector<TopoDS_Shape>& theShapeVec)
3253 : myShapeVec(&theShapeVec),
3254 myIsRaceDetected(0)
3255 {}
3256
3257 void operator()(size_t i) const
3258 {
3259 if (!myIsRaceDetected) {
3260 const TopoDS_Vertex& aV = TopoDS::Vertex (myShapeVec->at(i));
3261 gp_Pnt aP = BRep_Tool::Pnt (aV);
3262 if (aP.X () != static_cast<double> (i)) {
3263 Standard_Atomic_Increment(&myIsRaceDetected);
3264 }
3265 }
3266 }
3267
3268 const std::vector<TopoDS_Shape>* myShapeVec;
3269 mutable volatile int myIsRaceDetected;
3270};
3271
3272//=======================================================================
3273//function : OCC25545
3274//purpose : Tests data race when concurrently accessing TopLoc_Location::Transformation()
3275//=======================================================================
3276#ifdef HAVE_TBB
3277static Standard_Integer OCC25545 (Draw_Interpretor& di,
3278 Standard_Integer,
3279 const char **)
3280{
3281 // Place vertices in a vector, giving the i-th vertex the
3282 // transformation that translates it on the vector (i,0,0) from the origin.
3283 size_t n = 1000;
3284 std::vector<TopoDS_Shape> aShapeVec (n);
3285 std::vector<TopLoc_Location> aLocVec (n);
3286 TopoDS_Shape aShape = BRepBuilderAPI_MakeVertex (gp::Origin ());
3287 aShapeVec[0] = aShape;
3288 for (size_t i = 1; i < n; ++i) {
3289 gp_Trsf aT;
3290 aT.SetTranslation (gp_Vec (1, 0, 0));
3291 aLocVec[i] = aLocVec[i - 1] * aT;
3292 aShapeVec[i] = aShape.Moved (aLocVec[i]);
3293 }
3294
3295 // Evaluator function will access vertices geometry
3296 // concurrently
3297 OCC25545_Functor aFunc(aShapeVec);
3298
3299 //concurrently process
3300 tbb::parallel_for (size_t (0), n, aFunc, tbb::simple_partitioner ());
3301 QVERIFY (!aFunc.myIsRaceDetected);
3302 return 0;
3303}
3304#else
3305static Standard_Integer OCC25545 (Draw_Interpretor&,
3306 Standard_Integer,
3307 const char **argv)
3308{
3309 cout << "Test skipped: command " << argv[0] << " requires TBB library" << endl;
3310 return 0;
3311}
3312#endif
3313
d315303d 3314//=======================================================================
3315//function : OCC25547
3316//purpose :
3317//=======================================================================
3318#include <BRepMesh_GeomTool.hxx>
3319#include <BRepAdaptor_Curve.hxx>
3320#include <Geom_TrimmedCurve.hxx>
3321#include <BRepBuilderAPI_MakeFace.hxx>
3322#include <BRepAdaptor_HSurface.hxx>
3323#include <BRepAdaptor_Surface.hxx>
3324static Standard_Integer OCC25547(
3325 Draw_Interpretor& theDI,
3326 Standard_Integer /*argc*/,
3327 const char ** /*argv*/)
3328{
3329 // The general aim of this test is to prevent linkage errors due to missed
3330 // Standard_EXPORT attribute for static methods.
3331
3332 // However, start checking the main functionality at first.
3333 const Standard_Real aFirstP = 0., aLastP = M_PI;
3334 Handle(Geom_Circle) aCircle = new Geom_Circle(gp_Ax2(gp::Origin(), gp::DZ()), 10);
3335 Handle(Geom_TrimmedCurve) aHalf = new Geom_TrimmedCurve(aCircle, aFirstP, aLastP);
3336 TopoDS_Edge aEdge = BRepBuilderAPI_MakeEdge(aHalf);
3337 BRepAdaptor_Curve aAdaptor(aEdge);
3338 BRepMesh_GeomTool aGeomTool(aAdaptor, aFirstP, aLastP, 0.1, 0.5);
3339
3340 if (aGeomTool.NbPoints() == 0)
3341 {
3342 theDI << "Error. BRepMesh_GeomTool failed to discretize an arc.\n";
3343 return 1;
3344 }
3345
3346 // Test static methods.
3347 TopoDS_Face aFace = BRepBuilderAPI_MakeFace(gp_Pln(gp::Origin(), gp::DZ()));
3348 BRepAdaptor_Surface aSurf(aFace);
3349 Handle(BRepAdaptor_HSurface) aHSurf = new BRepAdaptor_HSurface(aSurf);
3350
3351 gp_Pnt aPnt;
3352 gp_Dir aNormal;
3353 if (!BRepMesh_GeomTool::Normal(aHSurf, 10., 10., aPnt, aNormal))
3354 {
3355 theDI << "Error. BRepMesh_GeomTool failed to take a normal of surface.\n";
3356 return 1;
3357 }
3358
3359 gp_XY aRefPnts[4] = {
3360 gp_XY(-10., -10.), gp_XY(10., 10.),
3361 gp_XY(-10., 10.), gp_XY(10., -10.)
3362 };
3363
3364 gp_Pnt2d aIntPnt;
3365 Standard_Real aParams[2];
3366 BRepMesh_GeomTool::IntFlag aIntFlag = BRepMesh_GeomTool::IntLinLin(
3367 aRefPnts[0], aRefPnts[1], aRefPnts[2], aRefPnts[3],
3368 aIntPnt.ChangeCoord(), aParams);
3369
3370 Standard_Real aDiff = aIntPnt.Distance(gp::Origin2d());
3371 if (aIntFlag != BRepMesh_GeomTool::Cross || aDiff > Precision::PConfusion())
3372 {
3373 theDI << "Error. BRepMesh_GeomTool failed to intersect two lines.\n";
3374 return 1;
3375 }
3376
3377 aIntFlag = BRepMesh_GeomTool::IntSegSeg(
3378 aRefPnts[0], aRefPnts[1], aRefPnts[2], aRefPnts[3],
3379 Standard_False, Standard_False, aIntPnt);
3380
3381 aDiff = aIntPnt.Distance(gp::Origin2d());
3382 if (aIntFlag != BRepMesh_GeomTool::Cross || aDiff > Precision::PConfusion())
3383 {
3384 theDI << "Error. BRepMesh_GeomTool failed to intersect two segments.\n";
3385 return 1;
3386 }
3387
3388
3389 theDI << "Test complete\n";
3390 return 0;
3391}
3392
2bfe59b6 3393#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
3394#include <TColStd_DataMapOfIntegerInteger.hxx>
3395#include <OSD.hxx>
3396#include <ShapeFix_Wire.hxx>
3397#include <ShapeExtend_Status.hxx>
3398#ifdef WNT
3399#define EXCEPTION ...
3400#else
3401#define EXCEPTION Standard_Failure
3402#endif
3403
3404static ShapeExtend_Status getStatusGap(const Handle(ShapeFix_Wire)& theFix,
3405 const Standard_Boolean theIs3d)
3406{
3407 for (Standard_Integer i=ShapeExtend_OK; i<=ShapeExtend_FAIL; i++)
3408 {
3409 Standard_Boolean isFound;
3410 if (theIs3d)
3411 isFound = theFix->StatusGaps3d( (ShapeExtend_Status) i );
3412 else
3413 isFound = theFix->StatusGaps2d( (ShapeExtend_Status) i );
3414 if (isFound) return ShapeExtend_Status(i);
3415 }
3416 return ShapeExtend_OK;
3417}
3418
3419//===================
3420//function : OCC24881
3421//purpose :
3422//===================
3423static Standard_Integer OCC24881 (Draw_Interpretor& di, Standard_Integer narg , const char** a)
3424{
3425 if (narg < 2) {
3426 di<<"Usage: "<<a[0]<<" invalid number of arguments"<<"\n";
3427 return 1;
3428 }
3429// cout <<"FileName1: " << argv[1] <<endl;
3430
3431 TopoDS_Shape aShape = DBRep::Get (a[1]);
3432
3433 OSD::SetSignal();
3434 Handle(ShapeFix_Wire) aWireFix = new ShapeFix_Wire;
3435
3436 // map FixStatus - NbSuchStatuses
3437 TColStd_DataMapOfIntegerInteger aStatusNbDMap;
3438 Standard_Integer nbFixed=0, nbOk=0;
3439
3440//Begin: STEP 7
3441 ShapeExtend_Status aStatus=ShapeExtend_OK;
3442 try {
3443 TopExp_Explorer aFaceExplorer(aShape, TopAbs_FACE);
3444 for (; aFaceExplorer.More(); aFaceExplorer.Next())
3445 {
3446 TopoDS_Shape aFace = aFaceExplorer.Current();
3447 // loop on wires
3448 TopoDS_Iterator aWireItr(aFace);
3449 for (; aWireItr.More(); aWireItr.Next() )
3450 {
3451 Standard_Boolean wasOk = Standard_False;
3452 TopoDS_Wire aSrcWire = TopoDS::Wire(aWireItr.Value());
3453
3454 aWireFix->Load (aSrcWire);
3455 aWireFix->SetFace (TopoDS::Face(aFace));
3456 aWireFix->FixReorder(); //correct order is a prerequisite
3457 // fix 3d
3458 if (!aWireFix->FixGaps3d())
3459 {
3460 // not fixed, why?
3461 aStatus = getStatusGap(aWireFix, Standard_True);
3462 if (aStatus == ShapeExtend_OK)
3463 wasOk = Standard_True;
3464 else
3465 {
3466 // keep 3d fail status
3467 if (aStatusNbDMap.IsBound (aStatus))
3468 aStatusNbDMap(aStatus)++;
3469 else
3470 aStatusNbDMap.Bind(aStatus,1);
3471 continue;
3472 }
3473 }
3474
3475 // fix 2d
3476 if (aWireFix->FixGaps2d())
3477 nbFixed++;
3478 else
3479 {
3480 aStatus = getStatusGap(aWireFix, Standard_False);
3481 if (aStatus == ShapeExtend_OK)
3482 {
3483 if (wasOk)
3484 {
3485 nbOk++;
3486 continue;
3487 }
3488 else
3489 nbFixed++;
3490 }
3491 else
3492 {
3493 // keep 2d fail status
3494 Standard_Integer aStatus2d = aStatus + ShapeExtend_FAIL;
3495 if (aStatusNbDMap.IsBound (aStatus2d))
3496 aStatusNbDMap(aStatus2d)++;
3497 else
3498 aStatusNbDMap.Bind(aStatus2d,1);
3499 continue;
3500 }
3501 }
3502 }
3503 }
3504//End: STEP 7
3505 } catch (EXCEPTION) {
3506 di << "Exception is raised = " <<aStatus << "\n";
3507 return 1;
3508
3509 }
3510// report what is done
3511
3512 if (nbFixed)
3513 {
3514 di <<"Fix_FillGaps_Fixed: nbFixed = "<<nbFixed <<"\n";
3515
3516 }
3517 if (nbOk)
3518 {
3519 di << "Fix_FillGaps_NothingToDo" <<"\n";
3520
3521 }
3522 TColStd_DataMapIteratorOfDataMapOfIntegerInteger aStatusItr(aStatusNbDMap);
3523 for (; aStatusItr.More(); aStatusItr.Next())
3524 {
3525 switch ((ShapeExtend_Status) aStatusItr.Key())
3526 {
3527 // treat 3d status
3528 case ShapeExtend_FAIL1:
3529 di <<"Fix_FillGaps_3dNoCurveFail, nb failed = ";
3530 break;
3531 case ShapeExtend_FAIL2:
3532 di <<"Fix_FillGaps_3dSomeGapsFail, nb failed = ";
3533 break;
3534 default:
3535 // treat 2d status
3536 switch ((ShapeExtend_Status) (aStatusItr.Key() - ShapeExtend_FAIL))
3537 {
3538 case ShapeExtend_FAIL1:
3539 di <<"Fix_FillGaps_2dNoPCurveFail, nb failed = ";
3540 break;
3541 case ShapeExtend_FAIL2:
3542 di <<"Fix_FillGaps_2dSomeGapsFail, nb failed = ";
3543 break;
3544 default:
3545 break;
3546 }
3547 }
3548 di <<aStatusItr.Value()<< "\n";
3549 }
3550 di << ("__________________________________") <<"\n";
3551
3552 return 0;
3553}
3554
c070aa39 3555//=======================================================================
3556//function : OCC26172
3557//purpose :
3558//=======================================================================
3559static Standard_Integer OCC26172 (Draw_Interpretor& theDI, Standard_Integer theArgNb, const char** theArgVec)
3560{
3561 if (theArgNb != 1)
3562 {
3563 std::cerr << "Error: wrong number of arguments! See usage:\n";
3564 theDI.PrintHelp (theArgVec[0]);
3565 return 1;
3566 }
3567
3568 Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext();
3569 if(anAISContext.IsNull())
3570 {
3571 std::cerr << "Error: no active view. Please call vinit.\n";
3572 return 1;
3573 }
3574
3575 gp_Pnt aStart (100, 100, 100);
3576 gp_Pnt anEnd (300, 400, 600);
3577 BRepBuilderAPI_MakeEdge anEdgeBuilder (aStart, anEnd);
3578 TopoDS_Edge anEdge = anEdgeBuilder.Edge();
3579 Handle(AIS_Shape) aTestAISShape = new AIS_Shape (anEdge);
3580 anAISContext->Display (aTestAISShape);
3581
3582 // 2. activate it in selection modes
3583 TColStd_SequenceOfInteger aModes;
3584 aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_VERTEX));
3585 aModes.Append (AIS_Shape::SelectionMode ((TopAbs_ShapeEnum) TopAbs_EDGE));
3586
3587 anAISContext->OpenLocalContext();
3588 anAISContext->Deactivate (aTestAISShape);
3589 anAISContext->Load (aTestAISShape, -1, true);
3590 for (Standard_Integer anIt = 1; anIt <= aModes.Length(); ++anIt)
3591 {
3592 anAISContext->Activate (aTestAISShape, aModes (anIt));
3593 }
3594
3595 // select entities in vertex selection mode
3596 Handle(SelectMgr_Selection) aSelection = aTestAISShape->Selection (aModes (1));
3597 for (aSelection->Init(); aSelection->More(); aSelection->Next())
3598 {
3599 Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
3600 if (anEntity.IsNull())
3601 {
3602 continue;
3603 }
3604
3605 Handle(SelectMgr_EntityOwner) anOwner =
3606 Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
3607
3608 if (anOwner.IsNull())
3609 {
3610 continue;
3611 }
3612
3613 anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
3614 }
3615
3616 // select entities in edge selection mode
3617 aSelection = aTestAISShape->Selection (aModes (2));
3618 for (aSelection->Init(); aSelection->More(); aSelection->Next())
3619 {
3620 Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive();
3621 if (anEntity.IsNull())
3622 {
3623 continue;
3624 }
3625
3626 Handle(SelectMgr_EntityOwner) anOwner =
3627 Handle(SelectMgr_EntityOwner)::DownCast (anEntity->OwnerId());
3628
3629 if (anOwner.IsNull())
3630 {
3631 continue;
3632 }
3633
3634 anAISContext->LocalContext()->AddOrRemoveSelected (anOwner);
3635 }
3636
3637 // deactivate vertex mode and check clearing of outdated selection
3638 anAISContext->Deactivate (aTestAISShape, aModes (1));
3639 anAISContext->LocalContext()->ClearOutdatedSelection (aTestAISShape, true);
3640
3641 return 0;
3642}
3643
9bf3177f 3644#include <IntTools_Context.hxx>
3645#include <GeomAPI_ProjectPointOnSurf.hxx>
3646
3647//=======================================================================
3648//function : xprojponf
3649//purpose :
3650//=======================================================================
3651Standard_Integer xprojponf (Draw_Interpretor& di,
3652 Standard_Integer n,
3653 const char** a)
3654{
3655 if (n!=3) {
3656 di<<" use xprojponf p f \n";
3657 return 0;
3658 }
3659 //
3660 gp_Pnt aP, aPS;
3661 TopoDS_Shape aS;
3662 TopoDS_Face aF;
3663 Handle(IntTools_Context) aCtx;
3664 //
3665 DrawTrSurf::GetPoint(a[1], aP);
3666 aS=DBRep::Get(a[2]);
3667 //
3668 if (aS.IsNull()) {
3669 di<<" null shape is not allowed\n";
3670 return 0;
3671 }
3672 //
3673 if (aS.ShapeType()!=TopAbs_FACE) {
3674 di << a[2] << " not a face\n";
3675 return 0;
3676 }
3677 //
3678 aCtx=new IntTools_Context;
3679 //
3680 aF=TopoDS::Face(aS);
3681 GeomAPI_ProjectPointOnSurf& aPPS=aCtx->ProjPS(aF);
3682 //
3683 aPPS.Perform(aP);
3684 if (!aPPS.IsDone()) {
3685 di<<" projection failed\n";
3686 return 0;
3687 }
3688 //
3689 aPS=aPPS.NearestPoint();
3690 di<< " point px " << aPS.X() << " " << aPS.Y() << " " << aPS.Z() << "\n";
3691 //
3692 return 0;
3693}
3694
ec26bf88 3695//=======================================================================
3696//function : OCC25547
3697//purpose :
3698//=======================================================================
3699#include <BRepMesh_CircleTool.hxx>
3700
3701static Standard_Boolean inspect_point(const gp_XY& thePoint,
3702 const gp_XY& theCenter,
3703 const Standard_Real theRadius)
3704{
3705 static Standard_Real aPrecision = Precision::PConfusion();
3706 static Standard_Real aSqPrecision = aPrecision * aPrecision;
3707 const gp_XY aDistVec = thePoint - theCenter;
3708 if (aDistVec.SquareModulus() - (theRadius * theRadius) < aSqPrecision)
3709 return Standard_True;
3710 else
3711 return Standard_False;
3712}
3713
3714static Standard_Integer OCC24923(
3715 Draw_Interpretor& theDI,
3716 Standard_Integer argc,
3717 const char ** argv)
3718{
3719 srand(static_cast<unsigned int>(time(NULL)));
3720
3721 const Standard_Real aMaxDeviation = (argc > 1) ? Draw::Atof(argv[1]) : 0.01;
3722 const Standard_Integer aPointsNb = 10000000;
3723 const Standard_Real aMinAngle = 5 * M_PI / 180.;
3724 static Standard_Real aSqPrecision = Precision::PConfusion() * Precision::PConfusion();
3725
3726 Standard_Integer aFailedNb = 0;
3727 for (Standard_Integer i = 0; i < aPointsNb; ++i)
3728 {
3729 gp_XY p[3];
3730 for (Standard_Integer j = 0; j < 3; ++j)
3731 p[j].SetCoord(((Standard_Real)rand())/RAND_MAX, ((Standard_Real)rand())/RAND_MAX);
3732
3733 // Check that points do not compose degenerated triangle.
3734 gp_XY aVec1 = p[1] - p[0];
3735 gp_XY aVec2 = p[2] - p[0];
3736 if (aVec1.SquareModulus() > aSqPrecision &&
3737 aVec2.SquareModulus() > aSqPrecision &&
3738 (aVec1 ^ aVec2) > aMinAngle)
3739 {
3740 gp_XY aCenter;
3741 Standard_Real aRadius;
3742 if (BRepMesh_CircleTool::MakeCircle(p[0], p[1], p[2], aCenter, aRadius))
3743 {
3744 if (!inspect_point(p[0], aCenter, aRadius) ||
3745 !inspect_point(p[1], aCenter, aRadius) ||
3746 !inspect_point(p[2], aCenter, aRadius))
3747 {
3748 /* theDI << "Missed: " <<
3749 "p1=(" << p1.X() << ", " << p1.Y() << "), " <<
3750 "p2=(" << p2.X() << ", " << p2.Y() << "), " <<
3751 "p3=(" << p3.X() << ", " << p3.Y() << "), " <<
3752 "c=(" << aCenter.X() << ", " << aCenter.Y() << "), " <<
3753 "r=" << aRadius << "\n";*/
3754
3755 ++aFailedNb;
3756 }
3757
3758 continue;
3759 }
3760 }
3761
3762 // Ensure that aPointsNb suitable for tests are generated
3763 --i;
3764 }
3765
3766 const Standard_Real aDeviation =
3767 1. - (Standard_Real)(aPointsNb - aFailedNb) / (Standard_Real)aPointsNb;
3768
3769 theDI << "Number of failed cases: " << aFailedNb << " (Total " << aPointsNb << ")\n";
3770 if (aDeviation > aMaxDeviation)
3771 {
3772 theDI << "Failed. Number of incorrect results is too huge: " <<
3773 aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)" << "\n";
3774 return 1;
3775 }
3776
3777 theDI << "Deviation of incorrect results is: " <<
3778 aDeviation * 100 << "% (Max " << aMaxDeviation * 100 << "%)" << "\n";
3779 theDI << "Test completed\n";
3780 return 0;
3781}
3782
1cd84fee 3783void QABugs::Commands_19(Draw_Interpretor& theCommands) {
1365140b 3784 const char *group = "QABugs";
7fd59977 3785
dda67c1c 3786 Handle(QABugs_HandleClass) aClassPtr = new QABugs_HandleClass();
3787 theCommands.Add ("OCC24202_1", "Test Handle-based procedure",
3788 __FILE__, aClassPtr, &QABugs_HandleClass::HandleProc, group);
3789 NCollection_Handle<QABugs_NHandleClass> aNClassPtr = new QABugs_NHandleClass();
3790 theCommands.Add ("OCC24202_2", "Test NCollection_Handle-based procedure",
3791 __FILE__, aNClassPtr, &QABugs_NHandleClass::NHandleProc, group);
3792
7fd59977 3793 theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
3794 theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
f6f03db9 3795 theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
1365140b
RL
3796 theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group);
3797 theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
e6aad0ee 3798 theCommands.Add ("OCC23595", "OCC23595", __FILE__, OCC23595, group);
5d1833ef 3799 theCommands.Add ("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group);
e187cc0a 3800 theCommands.Add ("OCC22595", "OCC22595", __FILE__, OCC22595, group);
bead40f2 3801 theCommands.Add ("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group);
06be28a4 3802 theCommands.Add ("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group);
1ef32e96
RL
3803 theCommands.Add ("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group);
3804 theCommands.Add ("OCC23952intersect", "OCC23952intersect nbsol shape1 shape2", __FILE__, OCC23952intersect, group);
1939140c 3805 theCommands.Add ("test_offset", "test_offset", __FILE__, test_offset, group);
05d7de53 3806 theCommands.Add ("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group);
2e9fd4bc 3807 theCommands.Add ("OCC24008", "OCC24008 curve surface", __FILE__, OCC24008, group);
4bee43a9 3808 theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
29cb310a 3809 theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
788cbaf4 3810 theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
89d8607f 3811 theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);
ab2db9a5 3812 theCommands.Add ("OCC24271", "Boolean operations on NCollection_Map", __FILE__, OCC24271, group);
e6c9f595 3813 theCommands.Add ("OCC23972", "OCC23972", __FILE__, OCC23972, group);
e3096dec 3814 theCommands.Add ("OCC24370", "OCC24370 edge pcurve surface prec", __FILE__, OCC24370, group);
05d7de53 3815 theCommands.Add ("OCC24533", "OCC24533", __FILE__, OCC24533, group);
1b7602c8 3816 theCommands.Add ("OCC24012", "OCC24012 face edge", __FILE__, OCC24012, group);
01ee00d9 3817 theCommands.Add ("OCC24051", "OCC24051", __FILE__, OCC24051, group);
69fd2d1b 3818 theCommands.Add ("OCC24086", "OCC24086 face wire", __FILE__, OCC24086, group);
2cd138b8 3819 theCommands.Add ("OCC24622", "OCC24622 texture={1D|2D}\n Tests sourcing of 1D/2D pixmaps for AIS_TexturedShape", __FILE__, OCC24622, group);
3820 theCommands.Add ("OCC24667", "OCC24667 result Wire_spine Profile [Mode [Approx]], no args to get help", __FILE__, OCC24667, group);
3497d552 3821 theCommands.Add ("OCC24565", "OCC24565 FileNameIGS FileNameSTOR", __FILE__, OCC24565, group);
d01cc61d 3822 theCommands.Add ("OCC24755", "OCC24755", __FILE__, OCC24755, group);
a73267f2 3823 theCommands.Add ("OCC24834", "OCC24834", __FILE__, OCC24834, group);
8696d65d 3824 theCommands.Add ("OCC24889", "OCC24889", __FILE__, OCC24889, group);
7a7e8cf1 3825 theCommands.Add ("OCC23951", "OCC23951 path to saved step file", __FILE__, OCC23951, group);
3826 theCommands.Add ("OCC24931", "OCC24931 path to saved xml file", __FILE__, OCC24931, group);
c764e804 3827 theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group);
1fa7cb8c 3828 theCommands.Add ("OCC23950", "OCC23950 step_file", __FILE__, OCC23950, group);
5493d334 3829 theCommands.Add ("OCC25004", "OCC25004", __FILE__, OCC25004, group);
b6c0b841
RL
3830 theCommands.Add ("OCC24925",
3831 "OCC24925 filename [pluginLib=TKXml storageGuid retrievalGuid]"
3832 "\nOCAF persistence without setting environment variables",
3833 __FILE__, OCC24925, group);
e4b5c45a 3834 theCommands.Add ("OCC23010", "OCC23010 STEP_file", __FILE__, OCC23010, group);
a967f104 3835 theCommands.Add ("OCC25043", "OCC25043 shape", __FILE__, OCC25043, group);
c7b59798 3836 theCommands.Add ("OCC24826,", "This test performs simple saxpy test.\n Usage: OCC24826 length", __FILE__, OCC24826, group);
4a350f94 3837 theCommands.Add ("OCC24606", "OCC24606 : Tests ::FitAll for V3d view ('vfit' is for NIS view)", __FILE__, OCC24606, group);
ab860031 3838 theCommands.Add ("OCC25202", "OCC25202 res shape numF1 face1 numF2 face2", __FILE__, OCC25202, group);
c6037065 3839 theCommands.Add ("OCC7570", "OCC7570 shape", __FILE__, OCC7570, group);
058f130e 3840 theCommands.Add ("OCC25100", "OCC25100 shape", __FILE__, OCC25100, group);
54a16ee4 3841 theCommands.Add ("OCC25340", "OCC25340", __FILE__, OCC25340, group);
5e452c37 3842 theCommands.Add ("OCC25348", "OCC25348", __FILE__, OCC25348, group);
6fb3418e 3843 theCommands.Add ("OCC25413", "OCC25413 shape", __FILE__, OCC25413, group);
c088aa93 3844 theCommands.Add ("OCC25446", "OCC25446 res b1 b2 op", __FILE__, OCC25446, group);
ee6bb37b 3845 theCommands.Add ("OCC25545",
3846 "no args; tests data race when concurrently accessing \n"
3847 "\t\tTopLoc_Location::Transformation()",
3848 __FILE__, OCC25545, group);
d315303d 3849 theCommands.Add ("OCC25547", "OCC25547", __FILE__, OCC25547, group);
2bfe59b6 3850 theCommands.Add ("OCC24881", "OCC24881 shape", __FILE__, OCC24881, group);
c070aa39 3851 theCommands.Add ("OCC26172", "OCC26172", __FILE__, OCC26172, group);
9bf3177f 3852 theCommands.Add ("xprojponf", "xprojponf p f", __FILE__, xprojponf, group);
ec26bf88 3853 theCommands.Add ("OCC24923", "OCC24923", __FILE__, OCC24923, group);
7fd59977 3854 return;
3855}