Salome HOME
d93c238ba657bf4b5a2fa2f715bac326b2e98d6a
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeAPI.cpp
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "GeomAlgoAPI_ShapeAPI.h"
21
22 #include <GeomAlgoAPI_Box.h>
23 #include <GeomAlgoAPI_CompoundBuilder.h>
24 #include <GeomAlgoAPI_Cone.h>
25 #include <GeomAlgoAPI_ConeSegment.h>
26 #include <GeomAlgoAPI_Cylinder.h>
27 #include <GeomAlgoAPI_EdgeBuilder.h>
28 #include <GeomAlgoAPI_Rotation.h>
29 #include <GeomAlgoAPI_Scale.h>
30 #include <GeomAlgoAPI_Sphere.h>
31 #include <GeomAlgoAPI_Symmetry.h>
32 #include <GeomAlgoAPI_Torus.h>
33 #include <GeomAlgoAPI_Translation.h>
34
35 #include <GeomAPI_Lin.h>
36
37 #include <math.h>
38
39 static GeomShapePtr runAlgo(GeomAlgoAPI_MakeShape& theAlgo)
40 {
41   if (!theAlgo.check())
42     throw GeomAlgoAPI_Exception(theAlgo.getError());
43
44   theAlgo.build();
45
46   if (!theAlgo.isDone())
47     throw GeomAlgoAPI_Exception(theAlgo.getError());
48
49   return theAlgo.shape();
50 }
51
52 static GeomShapePtr runAlgoAndCheckShape(GeomAlgoAPI_MakeShape& theAlgo, const std::string& theMsg)
53 {
54   if (!theAlgo.check())
55     throw GeomAlgoAPI_Exception(theAlgo.getError());
56
57   theAlgo.build();
58
59   if (!theAlgo.isDone() || !theAlgo.checkValid(theMsg))
60     throw GeomAlgoAPI_Exception(theAlgo.getError());
61
62   return theAlgo.shape();
63 }
64
65 namespace GeomAlgoAPI_ShapeAPI
66 {
67   //===============================================================================================
68   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeBox(
69     const double theDx, const double theDy,
70     const double theDz)
71   {
72     static const std::string aMsg("Box builder with dimensions");
73     GeomAlgoAPI_Box aBoxAlgo(theDx,theDy,theDz);
74     return runAlgoAndCheckShape(aBoxAlgo, aMsg);
75   }
76
77   //===============================================================================================
78   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeBox(
79     std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
80     std::shared_ptr<GeomAPI_Pnt> theSecondPoint)
81   {
82     static const std::string aMsg("Box builder with two points");
83     GeomAlgoAPI_Box aBoxAlgo(theFirstPoint, theSecondPoint);
84     return runAlgoAndCheckShape(aBoxAlgo, aMsg);
85   }
86
87   //===============================================================================================
88   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeCylinder(
89     std::shared_ptr<GeomAPI_Pnt> theBasePoint, std::shared_ptr<GeomAPI_Edge> theEdge,
90     double theRadius, double theHeight)
91   {
92     // Check if the base point is OK
93     if (!theBasePoint) {
94       throw GeomAlgoAPI_Exception("Cylinder builder :: the base point is not valid.");
95     }
96     // Check if the edge is OK
97     if (!theEdge) {
98       throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid.");
99     }
100
101     std::shared_ptr<GeomAPI_Ax2> anAxis;
102     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
103                                                           theEdge->line()->direction()));
104
105     GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight);
106
107     static const std::string aMsg("Cylinder builder");
108     return runAlgoAndCheckShape(aCylinderAlgo, aMsg);
109   }
110
111   //===============================================================================================
112   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeCylinder(
113     std::shared_ptr<GeomAPI_Pnt> theBasePoint, std::shared_ptr<GeomAPI_Edge> theEdge,
114     double theRadius, double theHeight, double theAngle)
115   {
116     // Check if the base point is OK
117     if (!theBasePoint) {
118       throw GeomAlgoAPI_Exception("Cylinder builder :: the base point is not valid.");
119     }
120     // Check if the edge is OK
121     if (!theEdge) {
122       throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid.");
123     }
124
125     std::shared_ptr<GeomAPI_Ax2> anAxis;
126     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
127                                                           theEdge->line()->direction()));
128
129     GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight, theAngle);
130
131     static const std::string aMsg("Cylinder portion builder");
132     return runAlgoAndCheckShape(aCylinderAlgo, aMsg);
133   }
134
135   //===============================================================================================
136   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeCylinder(
137     double theRadius, double theHeight)
138   {
139     std::shared_ptr<GeomAPI_Pnt> aBasePoint =
140       std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(0.,0.,0.));
141     std::shared_ptr<GeomAPI_Edge> aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.);
142     std::shared_ptr<GeomAPI_Ax2> anAxis;
143     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
144                                                           aEdge->line()->direction()));
145
146     GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight);
147
148     static const std::string aMsg("Cylinder builder");
149     return runAlgoAndCheckShape(aCylinderAlgo, aMsg);
150   }
151
152   //===============================================================================================
153   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeCylinder(
154     double theRadius, double theHeight, double theAngle)
155   {
156     std::shared_ptr<GeomAPI_Pnt> aBasePoint =
157       std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(0.,0.,0.));
158     std::shared_ptr<GeomAPI_Edge> aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.);
159     std::shared_ptr<GeomAPI_Ax2> anAxis;
160     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
161                                                           aEdge->line()->direction()));
162
163     GeomAlgoAPI_Cylinder aCylinderAlgo(anAxis, theRadius, theHeight, theAngle);
164
165     static const std::string aMsg("Cylinder portion builder");
166     return runAlgoAndCheckShape(aCylinderAlgo, aMsg);
167   }
168
169   //===============================================================================================
170   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSphere(
171       std::shared_ptr<GeomAPI_Pnt> theCenterPoint, double theRadius)
172   {
173     static const std::string aMsg("Sphere builder");
174     GeomAlgoAPI_Sphere aSphereAlgo(theCenterPoint, theRadius);
175     return runAlgoAndCheckShape(aSphereAlgo, aMsg);
176   }
177
178   //===============================================================================================
179   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSphere(double theRadius)
180   {
181     std::shared_ptr<GeomAPI_Pnt> aCenterPoint =
182       std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(0.,0.,0.));
183
184     GeomAlgoAPI_Sphere aSphereAlgo(aCenterPoint, theRadius);
185
186     static const std::string aMsg("Sphere builder");
187     return runAlgoAndCheckShape(aSphereAlgo, aMsg);
188   }
189
190   //===============================================================================================
191   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTorus(
192       std::shared_ptr<GeomAPI_Pnt> theBasePoint,
193       std::shared_ptr<GeomAPI_Edge> theEdge,double theRadius, double theRingRadius)
194   {
195     // Check if the base point is OK
196     if (!theBasePoint) {
197       throw GeomAlgoAPI_Exception("Torus builder :: the base point is not valid.");
198     }
199     // Check if the edge is OK
200     if (!theEdge) {
201       throw GeomAlgoAPI_Exception("Torus builder :: the axis is not valid.");
202     }
203
204     std::shared_ptr<GeomAPI_Ax2> anAxis;
205     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
206                                                           theEdge->line()->direction()));
207
208     GeomAlgoAPI_Torus aTorusAlgo(anAxis, theRadius, theRingRadius);
209
210     static const std::string aMsg("Torus builder");
211     return runAlgoAndCheckShape(aTorusAlgo, aMsg);
212   }
213
214   //===============================================================================================
215   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTorus(double theRadius,
216       double theRingRadius)
217   {
218     std::shared_ptr<GeomAPI_Pnt> aBasePoint =
219       std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(0.,0.,0.));
220     std::shared_ptr<GeomAPI_Edge> aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.);
221     std::shared_ptr<GeomAPI_Ax2> anAxis;
222     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
223                                                           aEdge->line()->direction()));
224
225     GeomAlgoAPI_Torus aTorusAlgo(anAxis, theRadius, theRingRadius);
226
227     static const std::string aMsg("Torus builder");
228     return runAlgoAndCheckShape(aTorusAlgo, aMsg);
229   }
230
231   //===============================================================================================
232   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeCone(
233       std::shared_ptr<GeomAPI_Pnt> theBasePoint,
234       std::shared_ptr<GeomAPI_Edge> theEdge,
235       double theBaseRadius, double theTopRadius,
236       double theHeight)
237   {
238     // Check if the base point is OK
239     if (!theBasePoint) {
240       throw GeomAlgoAPI_Exception("Cone builder :: the base point is not valid.");
241     }
242     // Check if the edge is OK
243     if (!theEdge) {
244       throw GeomAlgoAPI_Exception("Cone builder :: the axis is not valid.");
245     }
246
247     std::shared_ptr<GeomAPI_Ax2> anAxis;
248     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
249                                                           theEdge->line()->direction()));
250
251     GeomAlgoAPI_Cone aConeAlgo(anAxis, theBaseRadius, theTopRadius, theHeight);
252
253     static const std::string aMsg("Cone builder");
254     return runAlgoAndCheckShape(aConeAlgo, aMsg);
255   }
256
257   //===============================================================================================
258   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeCone(
259       double theBaseRadius, double theTopRadius,
260       double theHeight)
261   {
262     std::shared_ptr<GeomAPI_Pnt> aBasePoint =
263       std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(0.,0.,0.));
264     std::shared_ptr<GeomAPI_Edge> aEdge = GeomAlgoAPI_EdgeBuilder::line(0., 0., 1.);
265     std::shared_ptr<GeomAPI_Ax2> anAxis;
266     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
267                                                           aEdge->line()->direction()));
268
269     GeomAlgoAPI_Cone aConeAlgo(anAxis, theBaseRadius, theTopRadius, theHeight);
270
271     static const std::string aMsg("Cone builder");
272     return runAlgoAndCheckShape(aConeAlgo, aMsg);
273   }
274
275   //===============================================================================================
276   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTranslation(
277     std::shared_ptr<GeomAPI_Shape> theSourceShape,
278     std::shared_ptr<GeomAPI_Ax1>   theAxis,
279     const double theDistance)
280   {
281     GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theAxis, theDistance);
282     return runAlgo(aTranslationAlgo);
283   }
284
285   //===============================================================================================
286   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTranslation(
287     std::shared_ptr<GeomAPI_Shape> theSourceShape,
288     const double theDx,
289     const double theDy,
290     const double theDz)
291   {
292     GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theDx, theDy, theDz);
293     return runAlgo(aTranslationAlgo);
294   }
295
296   //===============================================================================================
297   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeTranslation(
298     std::shared_ptr<GeomAPI_Shape> theSourceShape,
299     std::shared_ptr<GeomAPI_Pnt>   theStartPoint,
300     std::shared_ptr<GeomAPI_Pnt>   theEndPoint)
301   {
302     GeomAlgoAPI_Translation aTranslationAlgo(theSourceShape, theStartPoint, theEndPoint);
303     return runAlgo(aTranslationAlgo);
304   }
305
306   //===============================================================================================
307   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeRotation(
308     std::shared_ptr<GeomAPI_Shape> theSourceShape,
309     std::shared_ptr<GeomAPI_Ax1> theAxis,
310     const double theAngle)
311   {
312     GeomAlgoAPI_Rotation aRotationAlgo(theSourceShape, theAxis, theAngle);
313     return runAlgo(aRotationAlgo);
314   }
315
316   //===============================================================================================
317   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeRotation(
318     std::shared_ptr<GeomAPI_Shape> theSourceShape,
319     std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
320     std::shared_ptr<GeomAPI_Pnt> theStartPoint,
321     std::shared_ptr<GeomAPI_Pnt> theEndPoint)
322   {
323     GeomAlgoAPI_Rotation aRotationAlgo(theSourceShape, theCenterPoint, theStartPoint, theEndPoint);
324     return runAlgo(aRotationAlgo);
325   }
326
327   //===============================================================================================
328   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSymmetry(
329     std::shared_ptr<GeomAPI_Shape> theSourceShape,
330     std::shared_ptr<GeomAPI_Pnt>   thePoint)
331   {
332     GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePoint);
333     return runAlgo(aSymmetryAlgo);
334   }
335
336   //===============================================================================================
337   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSymmetry(
338     std::shared_ptr<GeomAPI_Shape> theSourceShape,
339     std::shared_ptr<GeomAPI_Ax1>   theAxis)
340   {
341     GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, theAxis);
342     return runAlgo(aSymmetryAlgo);
343   }
344
345   //===============================================================================================
346   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeSymmetry(
347     std::shared_ptr<GeomAPI_Shape> theSourceShape,
348     std::shared_ptr<GeomAPI_Ax2>   thePlane)
349   {
350     GeomAlgoAPI_Symmetry aSymmetryAlgo(theSourceShape, thePlane);
351     return runAlgo(aSymmetryAlgo);
352   }
353
354   //===============================================================================================
355   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeScale(
356     std::shared_ptr<GeomAPI_Shape> theSourceShape,
357     std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
358     const double                   theScaleFactor)
359   {
360     GeomAlgoAPI_Scale aScaleAlgo(theSourceShape, theCenterPoint, theScaleFactor);
361     return runAlgo(aScaleAlgo);
362   }
363
364   //===============================================================================================
365   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeScale(
366     std::shared_ptr<GeomAPI_Shape> theSourceShape,
367     std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
368     const double                   theScaleFactorX,
369     const double                   theScaleFactorY,
370     const double                   theScaleFactorZ)
371   {
372     GeomAlgoAPI_Scale aScaleAlgo(theSourceShape, theCenterPoint,
373                                  theScaleFactorX, theScaleFactorY, theScaleFactorZ);
374     return runAlgo(aScaleAlgo);
375   }
376
377   //===============================================================================================
378   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeMultiTranslation(
379     std::shared_ptr<GeomAPI_Shape> theSourceShape,
380     std::shared_ptr<GeomAPI_Ax1> theAxis,
381     const double theStep,
382     const int theNumber)
383   {
384     if (!theAxis) {
385       std::string aError = "Multitranslation builder ";
386       aError+=":: the first axis is not valid";
387       throw GeomAlgoAPI_Exception(aError);
388     }
389
390     if (theNumber <=0) {
391       std::string aError = "Multitranslation builder ";
392       aError+=":: the number of copies for the first direction is null or negative.";
393       throw GeomAlgoAPI_Exception(aError);
394     }
395
396     ListOfShape aListOfShape;
397     for (int i=0; i<theNumber; i++) {
398       aListOfShape.
399         push_back(GeomAlgoAPI_ShapeAPI::makeTranslation(theSourceShape, theAxis, i*theStep));
400     }
401     return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
402   }
403
404   //===============================================================================================
405   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeMultiTranslation(
406     std::shared_ptr<GeomAPI_Shape> theSourceShape,
407     std::shared_ptr<GeomAPI_Ax1> theFirstAxis,
408     const double theFirstStep,
409     const int theFirstNumber,
410     std::shared_ptr<GeomAPI_Ax1> theSecondAxis,
411     const double theSecondStep,
412     const int theSecondNumber)
413   {
414     if (!theFirstAxis) {
415       std::string aError = "Multitranslation builder ";
416       aError+=":: the first axis is not valid";
417       throw GeomAlgoAPI_Exception(aError);
418     }
419
420     if (!theSecondAxis) {
421       std::string aError = "Multitranslation builder ";
422       aError+=":: the second axis is not valid";
423       throw GeomAlgoAPI_Exception(aError);
424     }
425
426     if (theFirstNumber <=0) {
427       std::string aError = "Multitranslation builder ";
428       aError+=":: the number of copies for the first direction is null or negative.";
429       throw GeomAlgoAPI_Exception(aError);
430     }
431
432     if (theSecondNumber <=0) {
433       std::string aError = "Multitranslation builder ";
434       aError+=":: the number of copies for the second direction is null or negative.";
435       throw GeomAlgoAPI_Exception(aError);
436     }
437
438     // Coord theFirstAxis
439     double x1 = theFirstAxis->dir()->x();
440     double y1 = theFirstAxis->dir()->y();
441     double z1 = theFirstAxis->dir()->z();
442     double norm1 = sqrt(x1*x1 + y1*y1 + z1*z1);
443
444     // Coord theSecondAxis
445     double x2 = theSecondAxis->dir()->x();
446     double y2 = theSecondAxis->dir()->y();
447     double z2 = theSecondAxis->dir()->z();
448     double norm2 = sqrt(x2*x2 + y2*y2 + z2*z2);
449
450     ListOfShape aListOfShape;
451     for (int j=0; j<theSecondStep; j++) {
452       for (int i=0; i<theFirstNumber; i++) {
453         double dx = i*theFirstStep*x1/norm1+j*theSecondStep*x2/norm2;
454         double dy = i*theFirstStep*y1/norm1+j*theSecondStep*y2/norm2;
455         double dz = i*theFirstStep*z1/norm1+j*theSecondStep*z2/norm2;
456         aListOfShape.push_back(GeomAlgoAPI_ShapeAPI::makeTranslation(theSourceShape, dx, dy, dz));
457       }
458     }
459     return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
460   }
461
462   //===============================================================================================
463   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeMultiRotation(
464     std::shared_ptr<GeomAPI_Shape> theSourceShape,
465     std::shared_ptr<GeomAPI_Ax1> theAxis,
466     const int theNumber)
467   {
468     if (!theAxis) {
469       std::string aError = "Multirotation builder ";
470       aError+=":: the axis is not valid";
471       throw GeomAlgoAPI_Exception(aError);
472     }
473
474     if (theNumber <=0) {
475       std::string aError = "Multirotation builder ";
476       aError+=":: the number of copies is null or negative.";
477       throw GeomAlgoAPI_Exception(aError);
478     }
479
480     double anAngle = 360./theNumber;
481
482     ListOfShape aListOfShape;
483     for (int i=0; i<theNumber; i++) {
484       aListOfShape.
485         push_back(GeomAlgoAPI_ShapeAPI::makeRotation(theSourceShape, theAxis, i*anAngle));
486     }
487     return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
488   }
489
490   //===============================================================================================
491   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeMultiRotation(
492     std::shared_ptr<GeomAPI_Shape> theSourceShape,
493     std::shared_ptr<GeomAPI_Ax1> theAxis,
494     const double theStep,
495     const int theNumber)
496   {
497     if (!theAxis) {
498       std::string aError = "Multirotation builder ";
499       aError+=":: the axis is not valid";
500       throw GeomAlgoAPI_Exception(aError);
501     }
502
503     if (theNumber <=0) {
504       std::string aError = "Multirotation builder ";
505       aError+=":: the number of copies is null or negative.";
506       throw GeomAlgoAPI_Exception(aError);
507     }
508
509     ListOfShape aListOfShape;
510     for (int i=0; i<theNumber; i++) {
511       aListOfShape.
512         push_back(GeomAlgoAPI_ShapeAPI::makeRotation(theSourceShape, theAxis, i*theStep));
513     }
514     return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
515   }
516
517   //===============================================================================================
518   std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeAPI::makeConeSegment(
519     const double theRMin1, const double theRMax1,
520     const double theRMin2, const double theRMax2,
521     const double theZ,
522     const double theStartPhi, const double theDeltaPhi)
523   {
524     GeomAlgoAPI_ConeSegment aConeSegmentAlgo(theRMin1, theRMax1, theRMin2, theRMax2,
525                                              theZ, theStartPhi, theDeltaPhi);
526
527     static const std::string aMsg("Cone Segment builder");
528     return runAlgoAndCheckShape(aConeSegmentAlgo, aMsg);
529   }
530 }