0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / QANIC / QANIC.cxx
CommitLineData
7fd59977 1// File: QANIC.cxx
2// Created: Tue May 28 17:13:48 2002
3// Author: QA Admin
4// <qa@russox>
5
6
7#include <QANIC.hxx>
8
9#include <Draw_Interpretor.hxx>
10#include <DBRep.hxx>
11#include <DrawTrSurf.hxx>
12#include <AIS_InteractiveContext.hxx>
13#include <ViewerTest.hxx>
14#include <AIS_Shape.hxx>
15#include <TopoDS_Shape.hxx>
16
17#include <BRepBuilderAPI_MakePolygon.hxx>
18#include <TopoDS_Face.hxx>
19#include <BRepBuilderAPI_MakeFace.hxx>
20#include <gp_Pnt.hxx>
21#include <gp_Dir.hxx>
22#include <gp_Ax1.hxx>
23#include <BRepPrimAPI_MakeRevol.hxx>
24
25#include <BRepAlgoAPI_Fuse.hxx>
26#include <BRepAlgo_Fuse.hxx>
27
28#include <GProp_GProps.hxx>
29#include <BRepGProp.hxx>
30#include <TopExp_Explorer.hxx>
31#include <TopoDS.hxx>
32#include <BRepMesh_IncrementalMesh.hxx>
33#include <BRep_Tool.hxx>
34#include <Poly_Triangulation.hxx>
35#include <TopExp.hxx>
36#include <ChFi3d_FilletShape.hxx>
37#include <BRepFilletAPI_MakeFillet.hxx>
38#include <Standard_ErrorHandler.hxx>
39
40static Standard_Integer OCC426 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
41{
42 if(argc < 7 || argc > 8) {
43 di << "Usage : " << argv[0] << " shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
44 return 1;
45 }
46 Standard_Boolean IsBRepAlgoAPI = Standard_True;
47 if (argc == 8) {
48 Standard_Integer IsB = atoi(argv[7]);
49 if (IsB != 1) {
50 IsBRepAlgoAPI = Standard_False;
51#if ! defined(BRepAlgo_def01)
52// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
53// return 1;
54#endif
55 }
56 }
57
58 BRepBuilderAPI_MakePolygon W1;
59 W1.Add(gp_Pnt(10, 0, 0));
60 W1.Add(gp_Pnt(20, 0, 0));
61 W1.Add(gp_Pnt(20, 0, 10));
62 W1.Add(gp_Pnt(10, 0, 10));
63 W1.Add(gp_Pnt(10, 0, 0));
64
65 Standard_Boolean OnlyPlane1 = Standard_False;
66 TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), OnlyPlane1);
67
68 gp_Pnt P1(0, 0, 0);
69 gp_Dir D1(0, 0, 30);
70 gp_Ax1 A1(P1,D1);
c6541a0c 71 Standard_Real angle1 = 360 * (M_PI / 180.0);
7fd59977 72 TopoDS_Shape rs1 = BRepPrimAPI_MakeRevol(F1, A1, angle1);
73
74 BRepBuilderAPI_MakePolygon W2;
75 Standard_Real f1 = 7.0710678118654752440;
76 Standard_Real f2 = 14.1421356237309504880;
77 W2.Add(gp_Pnt(f1, f1, 10));
78 W2.Add(gp_Pnt(f2, f2, 10));
79 W2.Add(gp_Pnt(f2, f2, 20));
80 W2.Add(gp_Pnt(f1, f1, 20));
81 W2.Add(gp_Pnt(f1, f1, 10));
82
83 Standard_Boolean OnlyPlane2 = Standard_False;
84 TopoDS_Face F2 = BRepBuilderAPI_MakeFace(W2.Wire(), OnlyPlane2);
85
86 gp_Pnt P2(0, 0, 0);
87 gp_Dir D2(0, 0, 30);
88 gp_Ax1 A2(P2,D2);
c6541a0c 89 Standard_Real angle2 = 270 * (M_PI / 180.0);
7fd59977 90 TopoDS_Shape rs2 = BRepPrimAPI_MakeRevol(F2, A2, angle2);
91
92 BRepBuilderAPI_MakePolygon W3;
93 W3.Add(gp_Pnt(10, 0, 20));
94 W3.Add(gp_Pnt(20, 0, 20));
95 W3.Add(gp_Pnt(20, 0, 30));
96 W3.Add(gp_Pnt(10, 0, 30));
97 W3.Add(gp_Pnt(10, 0, 20));
98
99 Standard_Boolean OnlyPlane3 = Standard_False;
100 TopoDS_Face F3 = BRepBuilderAPI_MakeFace(W3.Wire(), OnlyPlane3);
101
102 gp_Pnt P3(0, 0, 0);
103 gp_Dir D3(0, 0, 30);
104 gp_Ax1 A3(P3,D3);
c6541a0c 105 Standard_Real angle3 = 360 * (M_PI / 180.0);
7fd59977 106 TopoDS_Shape rs3 = BRepPrimAPI_MakeRevol(F3, A3, angle3);
107
108 TopoDS_Shape fuse32, fuse321;
109 if (IsBRepAlgoAPI) {
110 di << "fuse32 = BRepAlgoAPI_Fuse(rs3, rs2)" <<"\n";
111 di << "fuse321 = BRepAlgoAPI_Fuse(fuse32, rs1)" <<"\n";
112 fuse32 = BRepAlgoAPI_Fuse(rs3, rs2);
113 fuse321 = BRepAlgoAPI_Fuse(fuse32, rs1);
114 } else {
115 di << "fuse32 = BRepAlgo_Fuse(rs3, rs2)" <<"\n";
116 di << "fuse321 = BRepAlgo_Fuse(fuse32, rs1)" <<"\n";
117 fuse32 = BRepAlgo_Fuse(rs3, rs2);
118 fuse321 = BRepAlgo_Fuse(fuse32, rs1);
119 }
120
121 //Give the mass claculation of the shpae "fuse321"
122 GProp_GProps G;
123 BRepGProp::VolumeProperties(fuse321, G);
124 di<<" "<<"\n";
125 di<<"Mass: "<<G.Mass()<<"\n"<<"\n";
126
127 di << "Trianglating Faces ....." <<"\n";
128 TopExp_Explorer ExpFace;
129
130 for (ExpFace.Init (fuse321,TopAbs_FACE); ExpFace.More(); ExpFace.Next())
131 {
132 TopoDS_Face TopologicalFace = TopoDS::Face (ExpFace.Current());
133 TopologicalFace.Orientation (TopAbs_FORWARD) ;
134 BRepMesh_IncrementalMesh IM(TopologicalFace, 1);
135 TopLoc_Location loc;
136 Handle(Poly_Triangulation) facing = BRep_Tool::Triangulation(TopologicalFace, loc);
137 if (facing.IsNull())
138 {
139 di << "Triangulation FAILED for this face" << "\n";
140 continue;
141 }
142 di << "No of Triangles = " << facing->NbTriangles() << "\n";
143 }
144 di<<"Triangulation of all Faces Completed. "<< "\n" << "\n";
145
146 TopTools_IndexedDataMapOfShapeListOfShape edgemap;
147 TopExp::MapShapesAndAncestors(fuse321, TopAbs_EDGE, TopAbs_SOLID, edgemap);
148 di << "No. of Edges: " << edgemap.Extent() << "\n";
149 ChFi3d_FilletShape FShape = ChFi3d_Rational;
150 BRepFilletAPI_MakeFillet blend(fuse321,FShape);
151 di << "Adding Edges ..... " << "\n";
152 for(int i = 1; i <= edgemap.Extent(); i++)
153 {
154 // cout << "Adding Edge : " << i << endl;
155 TopoDS_Edge edg = TopoDS::Edge( edgemap.FindKey(i) );
156 if(!edg.IsNull()) blend.Add(1, edg);
157 }
158 di << "All Edges added ! Now Building the Blend ... " << "\n";
159 di<<" "<<"\n";
160 blend.Build();
161
162 //DBRep::Set ( argv[1], fuse321 );
163 DBRep::Set ( argv[1], blend );
164 DBRep::Set ( argv[2], rs1 );
165 DBRep::Set ( argv[3], rs2 );
166 DBRep::Set ( argv[4], rs3 );
167 DBRep::Set ( argv[5], fuse32 );
168 DBRep::Set ( argv[6], fuse321 );
169
170 return 0;
171}
172
173#include <Geom_SurfaceOfRevolution.hxx>
174//=======================================================================
175//function : isPeriodic
176//purpose :
177//=======================================================================
178static Standard_Integer isPeriodic(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
179{
180 try
181 {
182 OCC_CATCH_SIGNALS
183 // 1. Verify amount of arguments of the command
184 if (argc < 2) { di << "isperiodic FAULTY. Use : isperiodic surfaceOfRevolution"; return 0;}
185 // 2. Retrieve surface
186 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[1]);
187 if(aSurf.IsNull()) {di << "isperiodic FAULTY. argument of command is not a surface"; return 0;}
188 Handle(Geom_SurfaceOfRevolution) aRevolSurf = Handle(Geom_SurfaceOfRevolution)::DownCast(aSurf);
189 if(aRevolSurf.IsNull()) {di << "isperiodic FAULTY. argument of command is not a surface of revolution"; return 0;}
190 // 3. Verify whether entry surface is u-periodic and v-periodic
191 if(aRevolSurf->IsUPeriodic()) {di << "Surface is u-periodic \n";} else {di << "Surface is not u-periodic \n";}
192 if(aRevolSurf->IsVPeriodic()) {di << "Surface is v-periodic \n";} else {di << "Surface is not v-periodic \n";}
193 }
194 catch (Standard_Failure) {di << "isperiodic Exception \n" ;return 0;}
195
196 return 0;
197}
198
199#include <Precision.hxx>
200#include <Extrema_ExtPS.hxx>
201#include <GeomAdaptor_Surface.hxx>
202//=======================================================================
203//function : OCC486
204//purpose :
205//=======================================================================
206static Standard_Integer OCC486(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
207{
208 try
209 {
210 OCC_CATCH_SIGNALS
211 if (argc < 2) { di << "OCC486 FAULTY. Use : OCC486 surf x y z du dv"; return 1;}
212
213 Standard_Real du = 0;
214 Standard_Real dv = 0;
215
216 Handle(Geom_Surface) GS;
217 GS = DrawTrSurf::GetSurface(argv[1]);
218 if (GS.IsNull()) { di << "OCC486 FAULTY. Null surface /n";return 1;}
219 gp_Pnt P3D( atof(argv[2]),atof(argv[3]),atof(argv[4]) );
220
221 Standard_Real Tol = Precision::PConfusion();
222 Extrema_ExtPS myExtPS;
223 if (argc > 5) du = atof(argv[5]);
224 if (argc > 6) dv = atof(argv[6]);
225
226 Standard_Real uf, ul, vf, vl;
227 GS->Bounds(uf, ul, vf, vl);
228
229 GeomAdaptor_Surface aSurf(GS);
230 myExtPS.Initialize (aSurf, uf-du, ul+du, vf-dv, vl+dv, Tol, Tol );
231 myExtPS.Perform ( P3D );
232 Standard_Integer nPSurf = ( myExtPS.IsDone() ? myExtPS.NbExt() : 0 );
233
234 if ( nPSurf > 0 )
235 {
236
237 //Standard_Real distMin = myExtPS.Value ( 1 );
238 Standard_Real distMin = myExtPS.SquareDistance ( 1 );
239 Standard_Integer indMin=1;
240 for (Standard_Integer sol = 2; sol <= nPSurf ; sol++)
241 {
242 //Standard_Real dist = myExtPS.Value(sol);
243 Standard_Real dist = myExtPS.SquareDistance(sol);
244 if ( distMin > dist )
245 {
246 distMin = dist;
247 indMin = sol;
248 }
249 }
250//
251 distMin = sqrt(distMin);
252 Standard_Real S, T;
253 myExtPS.Point(indMin).Parameter ( S, T );
254 gp_Pnt aCheckPnt = aSurf.Value( S, T );
255 Standard_Real aCheckDist = P3D.Distance(aCheckPnt);
256 di << "Solution is : U = "<< S << "\t V = "<< T << "\n";
257 di << "Solution is : X = "<< aCheckPnt.X() << "\t Y = "<< aCheckPnt.Y() << "\t Z = "<< aCheckPnt.Z() << "\n";
258 di << "ExtremaDistance = " << distMin << "\n";
259 di << "CheckDistance = " << aCheckDist << "\n";
260
261 if(fabs(distMin - aCheckDist) < Precision::Confusion()) return 0;
262 else return 1;
263 }
264 else return 1;
265 }
266 catch (Standard_Failure) {di << "OCC486 Exception \n" ;return 1;}
267
268 return 0;
269}
270
271#include <GC_MakeArcOfCircle.hxx>
272#include <BRepBuilderAPI_MakeEdge.hxx>
273#include <BRepBuilderAPI_MakeWire.hxx>
274#include <TopoDS_Wire.hxx>
275#include <BRepBuilderAPI_MakeFace.hxx>
276#include <Geom_Plane.hxx>
277#include <gp_Pln.hxx>
278#include <BRepPrimAPI_MakePrism.hxx>
279#include <BRepOffsetAPI_DraftAngle.hxx>
280//=======================================================================
281//function : OCC712
282//purpose :
283//=======================================================================
284static Standard_Integer OCC712 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
285 if (argc != 3) {
286 di << "Usage : " << argv[0] << " draftAngle slabThick" << "\n";
287 return 1;
288 }
289 //NOTE: Case:1 - draftAngle = 15, slabThick = 30 --> Fails
290 // Case:2 draftAngle = 10, slabThick = 30 --> Ok
291 // Case:3 draftAngle = 10, slabThick = 40 --> Ok
292 //
293 // --------------------------------------------------
294 Standard_Real draftAngle = atof(argv[1]);
295 Standard_Real slabThick = atof(argv[2]);
296
297 Standard_Real f1 = 75;
298 Standard_Real f2 = 35;
299
300 gp_Pnt p1(-f2, f2, 0);
301 gp_Pnt p2( 0, f1, 0);
302 gp_Pnt p3( f2, f2, 0);
303 gp_Pnt p4( f1, 0, 0);
304 gp_Pnt p5( f2, -f2, 0);
305 gp_Pnt p6( 0, -f1, 0);
306 gp_Pnt p7(-f2, -f2, 0);
307 gp_Pnt p8(-f1, 0, 0);
308
309 GC_MakeArcOfCircle arc1(p1, p2, p3);
310 GC_MakeArcOfCircle arc2(p3, p4, p5);
311 GC_MakeArcOfCircle arc3(p5, p6, p7);
312 GC_MakeArcOfCircle arc4(p7, p8, p1);
313
314 TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(arc1.Value());
315 TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(arc2.Value());
316 TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(arc3.Value());
317 TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(arc4.Value());
318
319 BRepBuilderAPI_MakeWire MW;
320 MW.Add(e1);
321 MW.Add(e2);
322 MW.Add(e3);
323 MW.Add(e4);
324
325 if (!MW.IsDone())
326 {
327 di << "my Wire not done" << "\n";
328 return 1;
329 }
330 TopoDS_Wire W = MW.Wire();
331
332 TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
333 if ( F.IsNull())
334 {
335 di << " Error in Face creation " << "\n";
336 return 1;
337 }
338
339 Handle(Geom_Surface) surf = BRep_Tool::Surface(F);
340 Handle (Geom_Plane) P = Handle(Geom_Plane)::DownCast(surf);
341 gp_Pln slabPln = P->Pln();
342
343 try
344 {
345 OCC_CATCH_SIGNALS
346 gp_Dir slabDir(0, 0, 1);
347 gp_Vec slabVect(slabDir);
348 slabVect *= slabThick;
349
350 BRepPrimAPI_MakePrism slab(F, slabVect, Standard_True);
351 if ( ! slab.IsDone() )
352 {
353 di << " Error in Slab creation " << "\n";
354 return 1;
355 }
356
357 TopoDS_Shape slabShape = slab.Shape();
358 if (fabs(draftAngle) > 0.01)
359 {
c6541a0c 360 Standard_Real angle = draftAngle*(M_PI / 180.0);
7fd59977 361 BRepOffsetAPI_DraftAngle draftSlab(slabShape);
362
363 TopoDS_Shape fShape = slab.FirstShape();
364 TopoDS_Shape lShape = slab.LastShape();
365
366 TopExp_Explorer ex;
367 for(ex.Init(slabShape, TopAbs_FACE); ex.More(); ex.Next())
368 {
369 TopoDS_Face aFace = TopoDS::Face(ex.Current());
370 if(aFace.IsSame(fShape) || aFace.IsSame(lShape)) continue;
371 draftSlab.Add(aFace, slabDir, angle, slabPln);
372 if (!draftSlab.AddDone())
373 {
374 di << " Error in Add " << "\n";
375 return 1;
376 }
377 }
378
379 di << "All Faces added. Building... " << "\n"; //cout.flush();
380 draftSlab.Build();
381 di << "Build done..." << "\n"; //cout.flush();
382 if (!draftSlab.IsDone()) //--------------> STEP:1
383 {
384 di << " Error in Build " << "\n";
385 return 1;
386 }
387 slabShape = draftSlab.Shape();
388 DBRep::Set(argv[1], slabShape);
389 }
390 }
391 catch ( Standard_Failure ) //--------------------> STEP:2
392 {
393 di << " Error in Draft Slab " << "\n";
394 return 1;
395 }
396 return 0;
397}
398
399//=======================================================================
400// performTriangulation
401//=======================================================================
402
403Standard_Integer performTriangulation (TopoDS_Shape aShape, Draw_Interpretor& di)
404{
405 int failed=0, total=0;
406 TopExp_Explorer ExpFace;
407 Handle(Poly_Triangulation) facing;
408
409 for (ExpFace.Init(aShape,TopAbs_FACE); ExpFace.More(); ExpFace.Next())
410 {
411 total++;
412 TopoDS_Face TopologicalFace = TopoDS::Face (ExpFace.Current());
413 TopologicalFace.Orientation (TopAbs_FORWARD) ;
414 BRepMesh_IncrementalMesh IM(TopologicalFace, 1);
415 TopLoc_Location loc;
416 facing = BRep_Tool::Triangulation(TopologicalFace, loc);
417 di << "Face " << total << " - ";
418 if (facing.IsNull())
419 {
420 failed++;
421 di << "******************** FAILED during Triangulation " << "\n";
422 }
423 else
424 {
425 di << facing->NbTriangles() << " Triangles" <<"\n";
426 }
427 }
428 di<<"Triangulation of all Faces Completed: "<<"\n"<<"\n";
429 if (failed == 0) return 1;
430 di<<"***************************************************"<<"\n";
431 di<<"******* ********"<<"\n";
432 di<<"***** Triangulation FAILED for " << failed << " of " << total << " Faces ******"<<"\n";
433 di<<"******* ********"<<"\n";
434 di<<"***************************************************"<<"\n";
435 return 0;
436}
437
438#include <BRepPrimAPI_MakeCylinder.hxx>
439#include <BRepPrimAPI_MakeCone.hxx>
440#include <BRepAlgoAPI_Cut.hxx>
441#include <BRepAlgo_Cut.hxx>
442//=======================================================================
443//function : OCC822_1
444//purpose :
445//=======================================================================
446static Standard_Integer OCC822_1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
447
448 if(argc < 4 || argc > 5) {
449 di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
450 return 1;
451 }
452 Standard_Boolean IsBRepAlgoAPI = Standard_True;
453 if (argc == 5) {
454 Standard_Integer IsB = atoi(argv[4]);
455 if (IsB != 1) {
456 IsBRepAlgoAPI = Standard_False;
457#if ! defined(BRepAlgo_def01)
458// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
459// return 1;
460#endif
461#if ! defined(BRepAlgo_def02)
462// di << "Error: There is not BRepAlgo_Cut class" << "\n";
463// return 1;
464#endif
465 }
466 }
467
468 int index = 1;
469
470 gp_Pnt P1(0, 0, 0);
471 gp_Dir D1(0, 0, 1);
472 gp_Ax2 A1(P1,D1);
473
474 BRepPrimAPI_MakeCylinder cylMakerIn(A1, 40, 110);
475 BRepPrimAPI_MakeCylinder cylMakerOut(A1, 50, 100);
476 TopoDS_Shape cylIn = cylMakerIn.Shape();
477 TopoDS_Shape cylOut = cylMakerOut.Shape();
478
479 gp_Pnt P2(0, 0, 0);
480 gp_Dir D2(0, 0, -1);
481 gp_Ax2 A2(P2,D2);
482
483 BRepPrimAPI_MakeCone conMakerIn(A2, 40, 60, 110);
484 BRepPrimAPI_MakeCone conMakerOut(A2, 50, 70, 100);
485 TopoDS_Shape conIn = conMakerIn.Shape();
486 TopoDS_Shape conOut = conMakerOut.Shape();
487
488 di << "All primitives created..... Creating Boolean" << "\n";
489
490 TopoDS_Shape theIn, theOut, theRes;
491 try
492 {
493 OCC_CATCH_SIGNALS
494 if (IsBRepAlgoAPI) {
495 di << "theIn = BRepAlgoAPI_Fuse(cylIn, conIn)" <<"\n";
496 di << "theOut = BRepAlgoAPI_Fuse(cylOut, conOut)" <<"\n";
497 di << "theRes = BRepAlgoAPI_Cut(theOut, theIn)" <<"\n";
498 theIn = BRepAlgoAPI_Fuse(cylIn, conIn);
499 theOut = BRepAlgoAPI_Fuse(cylOut, conOut);
500 theRes = BRepAlgoAPI_Cut(theOut, theIn);
501 } else {
502 di << "theIn = BRepAlgo_Fuse(cylIn, conIn)" <<"\n";
503 di << "theOut = BRepAlgo_Fuse(cylOut, conOut)" <<"\n";
504 theIn = BRepAlgo_Fuse(cylIn, conIn);
505 theOut = BRepAlgo_Fuse(cylOut, conOut);
506 di << "theRes = BRepAlgo_Cut(theOut, theIn)" <<"\n";
507 theRes = BRepAlgo_Cut(theOut, theIn);
508 }
509
510 if (index < argc) DBRep::Set(argv[index++], theIn);
511 if (index < argc) DBRep::Set(argv[index++], theOut);
512 if (index < argc) DBRep::Set(argv[index++], theRes);
513 di << "Booleans Created ! Triangulating !" <<"\n";
514
515 performTriangulation(theRes, di);
516 }
517 catch ( Standard_Failure )
518 {
519 di<<"*********************************************************"<<"\n";
520 di<<"***** ******"<<"\n";
521 di<<"***** Standard_Failure : Exception in Shoe Function *****"<<"\n";
522 di<<"***** ******"<<"\n";
523 di<<"*********************************************************"<<"\n";
524 return 1;
525 }
526 return 0;
527
528}
529
530#include <BRepPrimAPI_MakeBox.hxx>
531#include <BRepPrimAPI_MakeSphere.hxx>
532//=======================================================================
533// OCC822_2
534//=======================================================================
535
536static Standard_Integer OCC822_2 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
537{
538 if(argc < 4 || argc > 5) {
539 di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
540 return 1;
541 }
542 Standard_Boolean IsBRepAlgoAPI = Standard_True;
543 if (argc == 5) {
544 Standard_Integer IsB = atoi(argv[4]);
545 if (IsB != 1) {
546 IsBRepAlgoAPI = Standard_False;
547#if ! defined(BRepAlgo_def01)
548// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
549// return 1;
550#endif
551 }
552 }
553
554 int index = 1;
555
556 gp_Dir xDir(1, 0, 0);
557 gp_Dir zDir(0, 0, 1);
558 gp_Pnt cen1(0, 0, 0);
559 gp_Ax2 cor1(cen1, zDir, xDir);
560 BRepPrimAPI_MakeBox boxMaker(cor1, 100, 100, 100);
561 TopoDS_Shape box = boxMaker.Shape();
562 if (index < argc) DBRep::Set(argv[index++], box);
563
564 BRepPrimAPI_MakeSphere sphereMaker(gp_Pnt(100.0, 50.0, 50.0), 25.0);
565 TopoDS_Shape sph = sphereMaker.Shape();
566 if (index < argc) DBRep::Set(argv[index++], sph);
567
568 di << "All primitives created..... Creating Cut Objects" << "\n";
569
570 TopoDS_Shape fuse;
571 try
572 {
573 OCC_CATCH_SIGNALS
574 if (IsBRepAlgoAPI) {
575 di << "fuse = BRepAlgoAPI_Fuse(box, sph)" <<"\n";
576 fuse = BRepAlgoAPI_Fuse(box, sph);
577 } else {
578 di << "fuse = BRepAlgo_Fuse(box, sph)" <<"\n";
579 fuse = BRepAlgo_Fuse(box, sph);
580 }
581 if (index < argc) DBRep::Set(argv[index++], fuse);
582 di << "Object Created ! Now Triangulating !" ;
583
584 performTriangulation(fuse, di);
585 }
586 catch ( Standard_Failure )
587 {
588 di<<"*********************************************************"<<"\n";
589 di<<"***** ******"<<"\n";
590 di<<"***** Standard_Failure : Exception in HSP Function ******"<<"\n";
591 di<<"***** ******"<<"\n";
592 di<<"*********************************************************"<<"\n";
593 return 1;
594 }
595
596 return 0;
597}
598
599//=======================================================================
600// OCC823
601//=======================================================================
602
603static Standard_Integer OCC823 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
604{
605 if(argc < 4 || argc > 5) {
606 di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
607 return 1;
608 }
609 Standard_Boolean IsBRepAlgoAPI = Standard_True;
610 if (argc == 5) {
611 Standard_Integer IsB = atoi(argv[4]);
612 if (IsB != 1) {
613 IsBRepAlgoAPI = Standard_False;
614#if ! defined(BRepAlgo_def01)
615// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
616// return 1;
617#endif
618 }
619 }
620 int index = 1;
621 Standard_Real size = 0.001;
622
623 gp_Pnt P1(40, 50, 0);
624 gp_Dir D1(100, 0, 0);
625 gp_Ax2 A1(P1,D1);
626 BRepPrimAPI_MakeCylinder mkCyl1(A1, 20, 100);
627 TopoDS_Shape cyl1 = mkCyl1.Shape();
628 if (index < argc) DBRep::Set(argv[index++], cyl1);
629
630 gp_Pnt P2(100, 50, size);
631 gp_Dir D2(0, size, 80);
632 gp_Ax2 A2(P2,D2);
633 BRepPrimAPI_MakeCylinder mkCyl2(A2, 20, 80);
634 TopoDS_Shape cyl2 = mkCyl2.Shape();
635 if (index < argc) DBRep::Set(argv[index++], cyl2);
636
637 di << "All primitives created..... Creating Boolean" << "\n";
638
639 TopoDS_Shape fuse;
640 try
641 {
642 OCC_CATCH_SIGNALS
643 if (IsBRepAlgoAPI) {
644 di << "fuse = BRepAlgoAPI_Fuse(cyl2, cyl1)" <<"\n";
645 fuse = BRepAlgoAPI_Fuse(cyl2, cyl1);
646 } else {
647 di << "fuse = BRepAlgo_Fuse(cyl2, cyl1)" <<"\n";
648 fuse = BRepAlgo_Fuse(cyl2, cyl1);
649 }
650 if (index < argc) DBRep::Set(argv[index++], fuse);
651 di << "Fuse Created ! Triangulating !" <<"\n";
652
653 performTriangulation(fuse, di);
654 }
655 catch ( Standard_Failure )
656 {
657 di<<"*********************************************************"<<"\n";
658 di<<"***** ******"<<"\n";
659 di<<"***** Standard_Failure : Exception in TEE Function ******"<<"\n";
660 di<<"***** ******"<<"\n";
661 di<<"*********************************************************"<<"\n";
662 return 1;
663 }
664 return 0;
665}
666
667//=======================================================================
668// OCC824
669//=======================================================================
670
671static Standard_Integer OCC824 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
672{
673 if(argc < 4 || argc > 5) {
674 di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
675 return 1;
676 }
677 Standard_Boolean IsBRepAlgoAPI = Standard_True;
678 if (argc == 5) {
679 Standard_Integer IsB = atoi(argv[4]);
680 if (IsB != 1) {
681 IsBRepAlgoAPI = Standard_False;
682#if ! defined(BRepAlgo_def01)
683// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
684// return 1;
685#endif
686 }
687 }
688 int index = 1;
689
690 gp_Pnt P1(100, 0, 0);
691 gp_Dir D1(-1, 0, 0);
692 gp_Ax2 A1(P1,D1);
693 BRepPrimAPI_MakeCylinder mkCyl(A1, 20, 100);
694 TopoDS_Shape cyl = mkCyl.Shape();
695 if (index < argc) DBRep::Set(argv[index++], cyl);
696
697 BRepPrimAPI_MakeSphere sphere(P1, 20.0);
698 TopoDS_Shape sph = sphere.Shape();
699 if (index < argc) DBRep::Set(argv[index++], sph);
700
701 di << "All primitives created..... Creating Boolean" << "\n";
702
703 TopoDS_Shape fuse;
704 try
705 {
706 OCC_CATCH_SIGNALS
707 if (IsBRepAlgoAPI) {
708 di << "fuse = BRepAlgoAPI_Fuse(cyl, sph)" <<"\n";
709 fuse = BRepAlgoAPI_Fuse(cyl, sph);
710 } else {
711 di << "fuse = BRepAlgo_Fuse(cyl, sph)" <<"\n";
712 fuse = BRepAlgo_Fuse(cyl, sph);
713 }
714 di << "Fuse Created ! Triangulating !" <<"\n";
715 if (index < argc) DBRep::Set(argv[index++], fuse);
716
717 performTriangulation(fuse, di);
718 }
719 catch ( Standard_Failure )
720 {
721 di<<"*********************************************************"<<"\n";
722 di<<"***** ******"<<"\n";
723 di<<"***** Standard_Failure : Exception in YOU Function ******"<<"\n";
724 di<<"***** ******"<<"\n";
725 di<<"*********************************************************"<<"\n";
726 return 1;
727 }
728 return 0;
729}
730
731#include <TColgp_Array2OfPnt.hxx>
732#include <GeomConvert.hxx>
733#include <Geom_BezierSurface.hxx>
734#include <BRepPrimAPI_MakeHalfSpace.hxx>
735
736//=======================================================================
737// OCC825
738//=======================================================================
739
740static Standard_Integer OCC825 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
741{
742 if(argc < 6 || argc > 7) {
743 di << "Usage : " << argv[0] << " name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
744 return 1;
745 }
746 Standard_Boolean IsBRepAlgoAPI = Standard_True;
747 if (argc == 7) {
748 Standard_Integer IsB = atoi(argv[6]);
749 if (IsB != 1) {
750 IsBRepAlgoAPI = Standard_False;
751#if ! defined(BRepAlgo_def02)
752// di << "Error: There is not BRepAlgo_Cut class" << "\n";
753// return 1;
754#endif
755 }
756 }
757 int index = 1;
758
759 Standard_Real size = 50;
760 TColgp_Array2OfPnt poles(1, 2, 1, 2);
761
762 poles(1, 1).SetCoord(-size, 0, -size);
763 poles(1, 2).SetCoord(-size, 0, size);
764 poles(2, 1).SetCoord( size, 0, -size);
765 poles(2, 2).SetCoord( size, 0, size);
766
767 Handle(Geom_BezierSurface) BezSurf = new Geom_BezierSurface(poles);
768 Handle(Geom_BSplineSurface) BSpSurf = GeomConvert::SurfaceToBSplineSurface(BezSurf);
1c72dff6 769 BRepBuilderAPI_MakeFace faceMaker(BSpSurf, Precision::Confusion());
7fd59977 770 TopoDS_Face face = faceMaker.Face();
771
772 gp_Pnt pnt(0, size, 0);
773 BRepPrimAPI_MakeHalfSpace *hSpace = new BRepPrimAPI_MakeHalfSpace(face,pnt);
774 TopoDS_Shape hsp = hSpace->Solid();
775 if (index < argc) DBRep::Set(argv[index++], hsp);
776
777 BRepPrimAPI_MakeSphere sphere1(gp_Pnt(0.0, 0.0, 0.0), 25.0);
778 TopoDS_Shape sph1 = sphere1.Shape();
779 if (index < argc) DBRep::Set(argv[index++], sph1);
780
781 BRepPrimAPI_MakeSphere sphere2(gp_Pnt(0.0, 0.00001, 0.0), 25.0);
782 TopoDS_Shape sph2 = sphere2.Shape();
783 if (index < argc) DBRep::Set(argv[index++], sph2);
784
785 di << "All primitives created..... Creating Cut Objects" << "\n";
786
787 TopoDS_Shape cut1, cut2;
788 try
789 {
790 OCC_CATCH_SIGNALS
791 if (IsBRepAlgoAPI) {
792 di << "cut1 = BRepAlgoAPI_Cut(sph1, hsp)" << "\n";
793 cut1 = BRepAlgoAPI_Cut(sph1, hsp);
794 } else {
795 di << "cut1 = BRepAlgo_Cut(sph1, hsp)" << "\n";
796 cut1 = BRepAlgo_Cut(sph1, hsp);
797 }
798 if (index < argc) DBRep::Set(argv[index++], cut1);
799 di << "CUT 1 Created ! " ;
800
801 if (IsBRepAlgoAPI) {
802 di << "cut2 = BRepAlgoAPI_Cut(sph2, hsp)" << "\n";
803 cut2 = BRepAlgoAPI_Cut(sph2, hsp);
804 } else {
805 di << "cut2 = BRepAlgo_Cut(sph2, hsp)" << "\n";
806 cut2 = BRepAlgo_Cut(sph2, hsp);
807 }
808 if (index < argc) DBRep::Set(argv[index++], cut2);
809 di << "CUT 2 Created !" << "\n" << "\n";
810
811 GProp_GProps G;
812 BRepGProp::VolumeProperties(cut1, G);
813 di<<"CUT 1 Mass = "<<G.Mass()<< "\n" << "\n";
814 BRepGProp::VolumeProperties(cut2, G);
815 di<<"CUT 2 Mass = "<<G.Mass()<< "\n" << "\n";
816
817 di << "Trianglating Faces of CUT 1 ....." << "\n";
818 performTriangulation(cut1, di);
819
820 di << "Trianglating Faces of CUT 2 ....." << "\n";
821 performTriangulation(cut2, di);
822 }
823 catch ( Standard_Failure )
824 {
825 di<<"*********************************************************"<< "\n";
826 di<<"***** ******"<< "\n";
827 di<<"***** Standard_Failure : Exception in HSP Function ******"<< "\n";
828 di<<"***** ******"<< "\n";
829 di<<"*********************************************************"<< "\n";
830 return 1;
831 }
832
833 di<<"*************************************************************"<< "\n";
834 di<<" CUT 1 and CUT 2 gives entirely different results during"<< "\n";
835 di<<" mass computation and face triangulation, eventhough the"<< "\n";
836 di<<" two spheres are located more or less at the same position."<< "\n";
837 di<<"*************************************************************"<< "\n";
838
839 return 0;
840}
841
842//=======================================================================
843// OCC826
844//=======================================================================
845
846static Standard_Integer OCC826 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
847{
848 if(argc < 4 || argc > 5) {
849 di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
850 return 1;
851 }
852 Standard_Boolean IsBRepAlgoAPI = Standard_True;
853 if (argc == 5) {
854 Standard_Integer IsB = atoi(argv[4]);
855 if (IsB != 1) {
856 IsBRepAlgoAPI = Standard_False;
857#if ! defined(BRepAlgo_def01)
858// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
859// return 1;
860#endif
861 }
862 }
863 int index = 1;
864
865 Standard_Real x1 = 181.82808;
866 Standard_Real x2 = 202.39390;
867 Standard_Real y1 = 31.011970;
868 Standard_Real y2 = 123.06856;
869
870 BRepBuilderAPI_MakePolygon W1;
871 W1.Add(gp_Pnt(x1, y1, 0));
872 W1.Add(gp_Pnt(x2, y1, 0));
873 W1.Add(gp_Pnt(x2, y2, 0));
874 W1.Add(gp_Pnt(x1, y2, 0));
875 W1.Add(gp_Pnt(x1, y1, 0));
876
877 Standard_Boolean myFalse = Standard_False;
878 TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), myFalse);
879
880 gp_Pnt P1(0, 0, 0);
881 gp_Dir D1(0, 30, 0);
882 gp_Ax1 A1(P1,D1);
c6541a0c 883 Standard_Real angle1 = 360 * (M_PI / 180.0);
7fd59977 884 TopoDS_Shape rev = BRepPrimAPI_MakeRevol(F1, A1, angle1);
885 if (index < argc) DBRep::Set(argv[index++], rev);
886
887 BRepPrimAPI_MakeSphere sphere(gp_Pnt(166.373, 77.0402, 96.0555), 23.218586);
888 TopoDS_Shape sph = sphere.Shape();
889 if (index < argc) DBRep::Set(argv[index++], sph);
890
891 di << "All primitives created..... Creating Boolean" << "\n";
892
893 TopoDS_Shape fuse;
894 try
895 {
896 OCC_CATCH_SIGNALS
897 if (IsBRepAlgoAPI) {
898 di << "fuse = BRepAlgoAPI_Fuse(rev, sph)" << "\n";
899 fuse = BRepAlgoAPI_Fuse(rev, sph);
900 } else {
901 di << "fuse = BRepAlgo_Fuse(rev, sph)" << "\n";
902 fuse = BRepAlgo_Fuse(rev, sph);
903 }
904 if (index < argc) DBRep::Set(argv[index++], fuse);
905 di << "Fuse Created ! Triangulating !" << "\n";
906 performTriangulation(fuse, di);
907 }
908 catch ( Standard_Failure )
909 {
910 di<<"*********************************************************"<< "\n";
911 di<<"***** ******"<< "\n";
912 di<<"***** Standard_Failure : Exception in SPH Function ******"<< "\n";
913 di<<"***** ******"<< "\n";
914 di<<"*********************************************************"<< "\n";
915 return 1;
916 }
917 return 0;
918}
919
920#include <BRepPrimAPI_MakeTorus.hxx>
921//=======================================================================
922// OCC827
923//=======================================================================
924
925static Standard_Integer OCC827 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
926{
927 if(argc < 6 || argc > 7) {
928 di << "Usage : " << argv[0] << " name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
929 return 1;
930 }
931 Standard_Boolean IsBRepAlgoAPI = Standard_True;
932 if (argc == 7) {
933 Standard_Integer IsB = atoi(argv[6]);
934 if (IsB != 1) {
935 IsBRepAlgoAPI = Standard_False;
936#if ! defined(BRepAlgo_def01)
937// di << "Error: There is not BRepAlgo_Fuse class" << "\n";
938// return 1;
939#endif
940 }
941 }
942 int index = 1;
943
944 BRepBuilderAPI_MakePolygon W1;
945 W1.Add(gp_Pnt(10, 0, 0));
946 W1.Add(gp_Pnt(20, 0, 0));
947 W1.Add(gp_Pnt(20, 0, 50));
948 W1.Add(gp_Pnt(10, 0, 50));
949 W1.Add(gp_Pnt(10, 0, 0));
950
951 Standard_Boolean myFalse = Standard_False;
952 TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), myFalse);
953
954 gp_Pnt P1(0, 0, 0);
955 gp_Dir D1(0, 0, 30);
956 gp_Ax1 A1(P1,D1);
c6541a0c 957 Standard_Real angle1 = 360 * (M_PI / 180.0);
7fd59977 958 TopoDS_Shape rev = BRepPrimAPI_MakeRevol(F1, A1, angle1);
959 if (index < argc) DBRep::Set(argv[index++], rev);
960
961 gp_Pnt P2(0, 0, 50);
962 gp_Dir D2(0, 0, 30);
963 gp_Ax2 A2(P2,D2);
964 Standard_Real majRad = 15;
965 Standard_Real minRad = 5;
966 BRepPrimAPI_MakeTorus Torus1(A2, majRad, minRad);
967 TopoDS_Shape tor1 = Torus1.Shape();
968 if (index < argc) DBRep::Set(argv[index++], tor1);
969
970 gp_Pnt P3(0, 0, 10);
971 gp_Dir D3(0, 0, 30);
972 gp_Ax2 A3(P3,D3);
973 BRepPrimAPI_MakeTorus Torus2(A3, majRad, minRad);
974 TopoDS_Shape tor2 = Torus2.Shape();
975 if (index < argc) DBRep::Set(argv[index++], tor2);
976
977 di << "All primitives created..... Creating Boolean" << "\n";
978
979 TopoDS_Shape fuse1, fuse2;
980 try
981 {
982 OCC_CATCH_SIGNALS
983 if (IsBRepAlgoAPI) {
984 di << "Fuse1 = BRepAlgoAPI_Fuse(tor1, rev)" << "\n";
985 fuse1 = BRepAlgoAPI_Fuse(tor1, rev);
986 } else {
987 di << "Fuse1 = BRepAlgo_Fuse(tor1, rev)" << "\n";
988 fuse1 = BRepAlgo_Fuse(tor1, rev);
989 }
990 if (index < argc) DBRep::Set(argv[index++], fuse1);
991 di << "Fuse1 Created ! Creating Fuse 2" << "\n";
992 if (IsBRepAlgoAPI) {
993 di << "Fuse2 = BRepAlgoAPI_Fuse(tor2, fuse1)" << "\n";
994 fuse2 = BRepAlgoAPI_Fuse(tor2, fuse1);
995 } else {
996 di << "Fuse2 = BRepAlgo_Fuse(tor2, fuse1)" << "\n";
997 fuse2 = BRepAlgo_Fuse(tor2, fuse1);
998 }
999 if (index < argc) DBRep::Set(argv[index++], fuse2);
1000 di << "Fuse2 Created ! Triangulating !" << "\n";
1001
1002 performTriangulation(fuse2, di);
1003 }
1004 catch ( Standard_Failure )
1005 {
1006 di<<"*********************************************************"<< "\n";
1007 di<<"***** ******"<< "\n";
1008 di<<"***** Standard_Failure : Exception in REV Function ******"<< "\n";
1009 di<<"***** ******"<< "\n";
1010 di<<"*********************************************************"<< "\n";
1011 return 1;
1012 }
1013 return 0;
1014}
1015
1016//=======================================================================
1017// performBlend
1018//=======================================================================
1019
1020int performBlend (TopoDS_Shape aShape, Standard_Real rad, TopoDS_Shape& bShape, Draw_Interpretor& di)
1021{
1022 Standard_Integer status = 0;
1023 TopoDS_Shape newShape;
1024 TopTools_IndexedDataMapOfShapeListOfShape edgemap;
1025 TopExp::MapShapesAndAncestors(aShape,TopAbs_EDGE,TopAbs_SOLID,edgemap);
1026 di << "Blending All Edges: No. of Edges: " << edgemap.Extent() << "\n";
1027 ChFi3d_FilletShape FShape = ChFi3d_Rational;
1028 BRepFilletAPI_MakeFillet blend(aShape,FShape);
1029 for(int i = 1; i <= edgemap.Extent(); i++)
1030 {
1031 TopoDS_Edge edg = TopoDS::Edge( edgemap.FindKey(i) );
1032 if(!edg.IsNull()) blend.Add(rad, edg);
1033 }
1034
1035 try
1036 {
1037 OCC_CATCH_SIGNALS
1038 blend.Build();
1039 if(!blend.HasResult() || blend.Shape().IsNull()) {
1040 status = 1;
1041 }
1042 }
1043 catch ( Standard_Failure )
1044 {
1045 status = 1;
1046 }
1047 if(status) {
1048 di<<"*******************************************************"<< "\n";
1049 di<<"****** *******"<< "\n";
1050 di<<"****** Blending Failed (Radius = " << rad << ") *******"<< "\n";
1051 di<<"****** *******"<< "\n";
1052 di<<"*******************************************************"<< "\n";
1053 return 1;
1054 } else {
1055 di<<"Blending successfully performed on all Edges: "<< "\n" << "\n";
1056 }
1057 bShape = blend.Shape();
1058 return 0;
1059}
1060
1061#include <GC_MakeSegment.hxx>
1062//=======================================================================
1063// OCC828
1064//=======================================================================
1065
1066static Standard_Integer OCC828 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
1067{
1068 if(argc != 2) {
1069 di << "Usage : " << argv[0] << " shape" << "\n";
1070 }
1071 int index = 1;
1072
1073 Standard_Real slabThick = 111;
1074
1075 gp_Pnt p11(-27.598139, -7.0408573, 0.0);
1076 gp_Pnt p12(-28.483755, -17.487625, 0.0);
1077 gp_Pnt p13(-19.555504, -22.983587, 0.0);
1078 GC_MakeArcOfCircle arc1(p11, p12, p13);
1079
1080 gp_Pnt p21(12.125083, -22.983587, 0.0);
1081 gp_Pnt p22(21.1572, -17.27554, 0.0);
1082 gp_Pnt p23(19.878168, -6.6677585, 0.0);
1083 GC_MakeArcOfCircle arc2(p21, p22, p23);
1084
1085 gp_Pnt p31(3.265825, 13.724955, 0.0);
1086 gp_Pnt p32(-4.7233953, 17.406338, 0.0);
1087 gp_Pnt p33(-12.529893, 13.351856, 0.0);
1088 GC_MakeArcOfCircle arc3(p31, p32, p33);
1089
1090 GC_MakeSegment ln1(p13, p21);
1091 GC_MakeSegment ln2(p23, p31);
1092 GC_MakeSegment ln3(p33, p11);
1093
1094 TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(arc1.Value());
1095 TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(arc2.Value());
1096 TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(arc3.Value());
1097
1098 TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(ln1.Value());
1099 TopoDS_Edge e5 = BRepBuilderAPI_MakeEdge(ln2.Value());
1100 TopoDS_Edge e6 = BRepBuilderAPI_MakeEdge(ln3.Value());
1101
1102 BRepBuilderAPI_MakeWire MW;
1103 MW.Add(e1);
1104 MW.Add(e4);
1105 MW.Add(e2);
1106 MW.Add(e5);
1107 MW.Add(e3);
1108 MW.Add(e6);
1109
1110 if (!MW.IsDone())
1111 {
1112 di << "my Wire not done" << "\n";
1113 return 1;
1114 }
1115
1116 TopoDS_Wire W = MW.Wire();
1117 TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
1118 if ( F.IsNull())
1119 {
1120 di << " Error in Face creation " << "\n";
1121 return 1;
1122 }
1123
1124 try
1125 {
1126 OCC_CATCH_SIGNALS
1127 gp_Dir slabDir(0, 0, 1);
1128 gp_Vec slabVect(slabDir);
1129 slabVect *= slabThick;
1130
1131 BRepPrimAPI_MakePrism slab(F, slabVect, Standard_True);
1132 if ( ! slab.IsDone() )
1133 {
1134 di << " Error in Slab creation " << "\n";
1135 return 1;
1136 }
1137 if (index < argc) DBRep::Set(argv[index++], slab.Shape());
1138
1139// cout << "Slab Successfully Created ! Now Blending ..." << endl;
1140// TopoDS_Shape aShape;
1141// int ret = performBlend(slab.Shape(), radius, aShape);
1142// if (ret) return 1;
1143// if (index < argc) DBRep::Set(argv[index++], aShape);
1144
1145// cout << "Blending Successfully Done ! Now Triangulating ..." << endl;
1146// performTriangulation(aShape);
1147 }
1148 catch ( Standard_Failure )
1149 {
1150 di << " Error in Draft Slab " << "\n";
1151 return 1;
1152 }
1153 return 0;
1154}
1155
1156void QANIC::Commands(Draw_Interpretor& theCommands) {
1157 char *group = "QANIC";
1158
1159 theCommands.Add ("OCC426", "OCC426 shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC426, group);
1160
1161 theCommands.Add("isperiodic", "Use : isperiodic surfaceOfRevolution", __FILE__, isPeriodic, group);
1162 theCommands.Add("OCC486", "Use : OCC486 surf x y z du dv ", __FILE__, OCC486, group);
1163 theCommands.Add("OCC712", "OCC712 draftAngle slabThick", __FILE__, OCC712, group);
1164 theCommands.Add("OCC822_1", "OCC822_1 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC822_1, group);
1165 theCommands.Add("OCC822_2", "OCC822_2 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC822_2, group);
1166 theCommands.Add("OCC823", "OCC823 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC823, group);
1167 theCommands.Add("OCC824", "OCC824 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC824, group);
1168 theCommands.Add("OCC825", "OCC825 name1 name2 name3 name4 name5 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC825, group);
1169 theCommands.Add("OCC826", "OCC826 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC826, group);
1170 theCommands.Add("OCC827", "OCC827 name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC827, group);
1171 theCommands.Add("OCC828", "OCC828 redius shape result ", __FILE__,OCC828, group);
1172
1173 return;
1174}