Salome HOME
25bf63acb4675b4011b16a2c0d85254f025d5732
[modules/geom.git] / src / AdvancedEngine / AdvancedEngine_IOperations_i.cc
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
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 //  File   : GEOM_IAdvancedOperations.cc
21 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
22
23 #include <Standard_Stream.hxx>
24
25 #include "AdvancedEngine_IOperations_i.hh"
26 #include "AdvancedEngine_IOperations.hxx"
27
28 #include <utilities.h>
29 #include <OpUtil.hxx>
30 #include <Utils_ExceptHandlers.hxx>
31
32 #include "GEOM_Engine.hxx"
33 #include "GEOM_Object.hxx"
34
35 //=============================================================================
36 /*!
37  *   constructor:
38  */
39 //=============================================================================
40 AdvancedEngine_IOperations_i::AdvancedEngine_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, AdvancedEngine_IOperations* theImpl)
41 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
42 {
43   MESSAGE("AdvancedEngine_IOperations_i::AdvancedEngine_IOperations_i");
44 }
45
46 //=============================================================================
47 /*!
48  *  destructor
49  */
50 //=============================================================================
51 AdvancedEngine_IOperations_i::~AdvancedEngine_IOperations_i()
52 {
53   MESSAGE("AdvancedEngine_IOperations_i::~AdvancedEngine_IOperations_i");
54 }
55
56 //=============================================================================
57 /*!
58  *  MakePipeTShape
59  *  Create a T-shape object with specified caracteristics for the main and
60  *  the incident pipes (radius, width, half-length).
61  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
62  *  \param theR1 Internal radius of main pipe
63  *  \param theW1 Width of main pipe
64  *  \param theL1 Half-length of main pipe
65  *  \param theR2 Internal radius of incident pipe (R2 < R1)
66  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
67  *  \param theL2 Half-length of incident pipe
68  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
69  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
70  */
71 //=============================================================================
72 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShape
73                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
74                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
75                       CORBA::Boolean theHexMesh)
76 {
77   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
78
79   //Set a not done flag
80   GetOperations()->SetNotDone();
81
82   //Create the TShape
83   Handle(TColStd_HSequenceOfTransient) aHSeq =
84     GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2,
85                                     0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
86                                     theHexMesh);
87   if (!GetOperations()->IsDone() || aHSeq.IsNull())
88     return aSeq._retn();
89
90   Standard_Integer aLength = aHSeq->Length();
91   aSeq->length(aLength);
92   for (Standard_Integer i = 1; i <= aLength; i++)
93     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
94
95   return aSeq._retn();
96 }
97
98 //=============================================================================
99 /*!
100  *  MakePipeTShapeWithPosition
101  *  Create a T-shape object with specified caracteristics for the main and
102  *  the incident pipes (radius, width, half-length).
103  *  The extremities of the main pipe are located on junctions points P1 and P2.
104  *  The extremity of the incident pipe is located on junction point P3.
105  *  \param theR1 Internal radius of main pipe
106  *  \param theW1 Width of main pipe
107  *  \param theL1 Half-length of main pipe
108  *  \param theR2 Internal radius of incident pipe (R2 < R1)
109  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
110  *  \param theL2 Half-length of incident pipe
111  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
112  *  \param theP1 1st junction point of main pipe
113  *  \param theP2 2nd junction point of main pipe
114  *  \param theP3 Junction point of incident pipe
115  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
116  */
117 //=============================================================================
118 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeWithPosition
119                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
120                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
121                       CORBA::Boolean theHexMesh,
122                       GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
123 {
124   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
125
126   //Set a not done flag
127   GetOperations()->SetNotDone();
128
129   //Get the reference vertices
130   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
131   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
132   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
133   if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
134
135   //Create the TShape
136   Handle(TColStd_HSequenceOfTransient) aHSeq =
137     GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
138                                                 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
139                                                 theHexMesh, aP1, aP2, aP3);
140   if (!GetOperations()->IsDone() || aHSeq.IsNull())
141     return aSeq._retn();
142
143   Standard_Integer aLength = aHSeq->Length();
144   aSeq->length(aLength);
145   for (Standard_Integer i = 1; i <= aLength; i++)
146     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
147
148   return aSeq._retn();
149 }
150
151 //=============================================================================
152 /*!
153  *  MakePipeTShapeChamfer
154  *  Create a T-shape object with specified caracteristics for the main and
155  *  the incident pipes (radius, width, half-length). A chamfer is created
156  *  on the junction of the pipes.
157  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
158  *  \param theR1 Internal radius of main pipe
159  *  \param theW1 Width of main pipe
160  *  \param theL1 Half-length of main pipe
161  *  \param theR2 Internal radius of incident pipe (R2 < R1)
162  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
163  *  \param theL2 Half-length of incident pipe
164  *  \param theH Height of chamfer.
165  *  \param theW Width of chamfer.
166  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
167  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
168  */
169 //=============================================================================
170 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeChamfer
171                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
172                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
173                       CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
174 {
175   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
176
177   //Set a not done flag
178   GetOperations()->SetNotDone();
179
180   //Create the TShape
181   Handle(TColStd_HSequenceOfTransient) aHSeq =
182     GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
183                                            0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
184                                            theH, theW, theHexMesh);
185   if (!GetOperations()->IsDone() || aHSeq.IsNull())
186     return aSeq._retn();
187
188   Standard_Integer aLength = aHSeq->Length();
189   aSeq->length(aLength);
190   for (Standard_Integer i = 1; i <= aLength; i++)
191     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
192
193   return aSeq._retn();
194 }
195
196 //=============================================================================
197 /*!
198  *  MakePipeTShapeChamferWithPosition
199  *  Create a T-shape object with specified caracteristics for the main and
200  *  the incident pipes (radius, width, half-length). A chamfer is created
201  *  on the junction of the pipes.
202  *  The extremities of the main pipe are located on junctions points P1 and P2.
203  *  The extremity of the incident pipe is located on junction point P3.
204  *  \param theR1 Internal radius of main pipe
205  *  \param theW1 Width of main pipe
206  *  \param theL1 Half-length of main pipe
207  *  \param theR2 Internal radius of incident pipe (R2 < R1)
208  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
209  *  \param theL2 Half-length of incident pipe
210  *  \param theH Height of the chamfer.
211  *  \param theW Width of the chamfer.
212  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
213  *  \param theP1 1st junction point of main pipe
214  *  \param theP2 2nd junction point of main pipe
215  *  \param theP3 Junction point of incident pipe
216  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
217  */
218 //=============================================================================
219 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeChamferWithPosition
220                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
221                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
222                       CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
223                       GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
224 {
225   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
226
227   //Set a not done flag
228   GetOperations()->SetNotDone();
229
230   //Get the reference vertices
231   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
232   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
233   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
234
235   //Create the TShape
236   Handle(TColStd_HSequenceOfTransient) aHSeq =
237     GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
238                                                        0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
239                                                        theH, theW, theHexMesh, aP1, aP2, aP3);
240   if (!GetOperations()->IsDone() || aHSeq.IsNull())
241     return aSeq._retn();
242
243   Standard_Integer aLength = aHSeq->Length();
244   aSeq->length(aLength);
245   for (Standard_Integer i = 1; i <= aLength; i++)
246     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
247
248   return aSeq._retn();
249 }
250
251 //=============================================================================
252 /*!
253  *  MakePipeTShapeFillet
254  *  Create a T-shape object with specified caracteristics for the main and
255  *  the incident pipes (radius, width, half-length). A fillet is created
256  *  on the junction of the pipes.
257  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
258  *  \param theR1 Internal radius of main pipe
259  *  \param theW1 Width of main pipe
260  *  \param theL1 Half-length of main pipe
261  *  \param theR2 Internal radius of incident pipe (R2 < R1)
262  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
263  *  \param theL2 Half-length of incident pipe
264  *  \param theRF Radius of curvature of fillet.
265  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
266  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
267  */
268 //=============================================================================
269 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeFillet
270                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
271                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
272                       CORBA::Double theRF, CORBA::Boolean theHexMesh)
273 {
274   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
275
276   //Set a not done flag
277   GetOperations()->SetNotDone();
278
279   //Create the TShape
280   Handle(TColStd_HSequenceOfTransient) aHSeq =
281     GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2,
282                                           0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
283                                           theRF, theHexMesh);
284   if (!GetOperations()->IsDone() || aHSeq.IsNull())
285     return aSeq._retn();
286
287   Standard_Integer aLength = aHSeq->Length();
288   aSeq->length(aLength);
289   for (Standard_Integer i = 1; i <= aLength; i++)
290     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
291
292   return aSeq._retn();
293 }
294
295 //=============================================================================
296 /*!
297  *  MakePipeTShapeFilletWithPosition
298  *  Create a T-shape object with specified caracteristics for the main and
299  *  the incident pipes (radius, width, half-length). A fillet is created
300  *  on the junction of the pipes.
301  *  The extremities of the main pipe are located on junctions points P1 and P2.
302  *  The extremity of the incident pipe is located on junction point P3.
303  *  \param theR1 Internal radius of main pipe
304  *  \param theW1 Width of main pipe
305  *  \param theL1 Half-length of main pipe
306  *  \param theR2 Internal radius of incident pipe (R2 < R1)
307  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
308  *  \param theL2 Half-length of incident pipe
309  *  \param theRF Radius of curvature of fillet
310  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
311  *  \param theP1 1st junction point of main pipe
312  *  \param theP2 2nd junction point of main pipe
313  *  \param theP3 Junction point of incident pipe
314  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
315  */
316 //=============================================================================
317 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeFilletWithPosition
318                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
319                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
320                       CORBA::Double theRF, CORBA::Boolean theHexMesh,
321                       GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
322 {
323   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
324
325   //Set a not done flag
326   GetOperations()->SetNotDone();
327
328   //Get the reference vertices
329   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
330   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
331   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
332
333   //Create the TShape
334   Handle(TColStd_HSequenceOfTransient) aHSeq =
335     GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
336                                                       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
337                                                       theRF, theHexMesh, aP1, aP2, aP3);
338   if (!GetOperations()->IsDone() || aHSeq.IsNull())
339     return aSeq._retn();
340
341   Standard_Integer aLength = aHSeq->Length();
342   aSeq->length(aLength);
343   for (Standard_Integer i = 1; i <= aLength; i++)
344     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
345
346   return aSeq._retn();
347 }
348
349 //=============================================================================
350 /*!
351  *  MakePipeTShapeTR
352  *  Create a T-shape object with specified caracteristics for the main and
353  *  the incident pipes (radius, width, half-length).
354  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
355  *  \param theR1 Internal radius of main pipe
356  *  \param theW1 Width of main pipe
357  *  \param theL1 Half-length of main pipe
358  *  \param theR2 Internal radius of incident pipe (R2 < R1)
359  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
360  *  \param theL2 Half-length of incident pipe
361  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
362  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
363  */
364 //=============================================================================
365 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeTR
366                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
367                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
368                       CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
369                       CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
370                       CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
371                       CORBA::Boolean theHexMesh)
372 {
373   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
374
375   //Set a not done flag
376   GetOperations()->SetNotDone();
377
378   //Create the TShape
379   Handle(TColStd_HSequenceOfTransient) aHSeq =
380     GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2,
381                                     theRL, theWL, theLtransL, theLthinL,
382                                     theRR, theWR, theLtransR, theLthinR,
383                                     theRI, theWI, theLtransI, theLthinI,
384                                     theHexMesh);
385   if (!GetOperations()->IsDone() || aHSeq.IsNull())
386     return aSeq._retn();
387
388   Standard_Integer aLength = aHSeq->Length();
389   aSeq->length(aLength);
390   for (Standard_Integer i = 1; i <= aLength; i++)
391     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
392
393   return aSeq._retn();
394 }
395
396 //=============================================================================
397 /*!
398  *  MakePipeTShapeTRWithPosition
399  *  Create a T-shape object with specified caracteristics for the main and
400  *  the incident pipes (radius, width, half-length).
401  *  The extremities of the main pipe are located on junctions points P1 and P2.
402  *  The extremity of the incident pipe is located on junction point P3.
403  *  \param theR1 Internal radius of main pipe
404  *  \param theW1 Width of main pipe
405  *  \param theL1 Half-length of main pipe
406  *  \param theR2 Internal radius of incident pipe (R2 < R1)
407  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
408  *  \param theL2 Half-length of incident pipe
409  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
410  *  \param theP1 1st junction point of main pipe
411  *  \param theP2 2nd junction point of main pipe
412  *  \param theP3 Junction point of incident pipe
413  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
414  */
415 //=============================================================================
416 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeTRWithPosition
417                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
418                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
419                       CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
420                       CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
421                       CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
422                       CORBA::Boolean theHexMesh,
423                       GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
424 {
425   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
426
427   //Set a not done flag
428   GetOperations()->SetNotDone();
429
430   //Get the reference vertices
431   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
432   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
433   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
434   if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull()) return aSeq._retn();
435
436   //Create the TShape
437   Handle(TColStd_HSequenceOfTransient) aHSeq =
438     GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
439                                                 theRL, theWL, theLtransL, theLthinL,
440                                                 theRR, theWR, theLtransR, theLthinR,
441                                                 theRI, theWI, theLtransI, theLthinI,
442                                                 theHexMesh, aP1, aP2, aP3);
443   if (!GetOperations()->IsDone() || aHSeq.IsNull())
444     return aSeq._retn();
445
446   Standard_Integer aLength = aHSeq->Length();
447   aSeq->length(aLength);
448   for (Standard_Integer i = 1; i <= aLength; i++)
449     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
450
451   return aSeq._retn();
452 }
453
454 //=============================================================================
455 /*!
456  *  MakePipeTShapeTRChamfer
457  *  Create a T-shape object with specified caracteristics for the main and
458  *  the incident pipes (radius, width, half-length). A chamfer is created
459  *  on the junction of the pipes.
460  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
461  *  \param theR1 Internal radius of main pipe
462  *  \param theW1 Width of main pipe
463  *  \param theL1 Half-length of main pipe
464  *  \param theR2 Internal radius of incident pipe (R2 < R1)
465  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
466  *  \param theL2 Half-length of incident pipe
467  *  \param theH Height of chamfer.
468  *  \param theW Width of chamfer.
469  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
470  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
471  */
472 //=============================================================================
473 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeTRChamfer
474                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
475                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
476                       CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
477                       CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
478                       CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
479                       CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
480 {
481   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
482
483   //Set a not done flag
484   GetOperations()->SetNotDone();
485
486   //Create the TShape
487   Handle(TColStd_HSequenceOfTransient) aHSeq =
488     GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
489                                            theRL, theWL, theLtransL, theLthinL,
490                                            theRR, theWR, theLtransR, theLthinR,
491                                            theRI, theWI, theLtransI, theLthinI,
492                                            theH, theW, theHexMesh);
493   if (!GetOperations()->IsDone() || aHSeq.IsNull())
494     return aSeq._retn();
495
496   Standard_Integer aLength = aHSeq->Length();
497   aSeq->length(aLength);
498   for (Standard_Integer i = 1; i <= aLength; i++)
499     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
500
501   return aSeq._retn();
502 }
503
504 //=============================================================================
505 /*!
506  *  MakePipeTShapeTRChamferWithPosition
507  *  Create a T-shape object with specified caracteristics for the main and
508  *  the incident pipes (radius, width, half-length). A chamfer is created
509  *  on the junction of the pipes.
510  *  The extremities of the main pipe are located on junctions points P1 and P2.
511  *  The extremity of the incident pipe is located on junction point P3.
512  *  \param theR1 Internal radius of main pipe
513  *  \param theW1 Width of main pipe
514  *  \param theL1 Half-length of main pipe
515  *  \param theR2 Internal radius of incident pipe (R2 < R1)
516  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
517  *  \param theL2 Half-length of incident pipe
518  *  \param theH Height of the chamfer.
519  *  \param theW Width of the chamfer.
520  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
521  *  \param theP1 1st junction point of main pipe
522  *  \param theP2 2nd junction point of main pipe
523  *  \param theP3 Junction point of incident pipe
524  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
525  */
526 //=============================================================================
527 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeTRChamferWithPosition
528                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
529                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
530                       CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
531                       CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
532                       CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
533                       CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
534                       GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
535 {
536   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
537
538   //Set a not done flag
539   GetOperations()->SetNotDone();
540
541   //Get the reference vertices
542   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
543   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
544   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
545
546   //Create the TShape
547   Handle(TColStd_HSequenceOfTransient) aHSeq =
548     GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
549                                                        theRL, theWL, theLtransL, theLthinL,
550                                                        theRR, theWR, theLtransR, theLthinR,
551                                                        theRI, theWI, theLtransI, theLthinI,
552                                                        theH, theW, theHexMesh, aP1, aP2, aP3);
553   if (!GetOperations()->IsDone() || aHSeq.IsNull())
554     return aSeq._retn();
555
556   Standard_Integer aLength = aHSeq->Length();
557   aSeq->length(aLength);
558   for (Standard_Integer i = 1; i <= aLength; i++)
559     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
560
561   return aSeq._retn();
562 }
563
564 //=============================================================================
565 /*!
566  *  MakePipeTShapeTRFillet
567  *  Create a T-shape object with specified caracteristics for the main and
568  *  the incident pipes (radius, width, half-length). A fillet is created
569  *  on the junction of the pipes.
570  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
571  *  \param theR1 Internal radius of main pipe
572  *  \param theW1 Width of main pipe
573  *  \param theL1 Half-length of main pipe
574  *  \param theR2 Internal radius of incident pipe (R2 < R1)
575  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
576  *  \param theL2 Half-length of incident pipe
577  *  \param theRF Radius of curvature of fillet.
578  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
579  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
580  */
581 //=============================================================================
582 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeTRFillet
583                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
584                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
585                       CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
586                       CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
587                       CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
588                       CORBA::Double theRF, CORBA::Boolean theHexMesh)
589 {
590   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
591
592   //Set a not done flag
593   GetOperations()->SetNotDone();
594
595   //Create the TShape
596   Handle(TColStd_HSequenceOfTransient) aHSeq =
597     GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2,
598                                           theRL, theWL, theLtransL, theLthinL,
599                                           theRR, theWR, theLtransR, theLthinR,
600                                           theRI, theWI, theLtransI, theLthinI,
601                                           theRF, theHexMesh);
602   if (!GetOperations()->IsDone() || aHSeq.IsNull())
603     return aSeq._retn();
604
605   Standard_Integer aLength = aHSeq->Length();
606   aSeq->length(aLength);
607   for (Standard_Integer i = 1; i <= aLength; i++)
608     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
609
610   return aSeq._retn();
611 }
612
613 //=============================================================================
614 /*!
615  *  MakePipeTShapeTRFilletWithPosition
616  *  Create a T-shape object with specified caracteristics for the main and
617  *  the incident pipes (radius, width, half-length). A fillet is created
618  *  on the junction of the pipes.
619  *  The extremities of the main pipe are located on junctions points P1 and P2.
620  *  The extremity of the incident pipe is located on junction point P3.
621  *  \param theR1 Internal radius of main pipe
622  *  \param theW1 Width of main pipe
623  *  \param theL1 Half-length of main pipe
624  *  \param theR2 Internal radius of incident pipe (R2 < R1)
625  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
626  *  \param theL2 Half-length of incident pipe
627  *  \param theRF Radius of curvature of fillet
628  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
629  *  \param theP1 1st junction point of main pipe
630  *  \param theP2 2nd junction point of main pipe
631  *  \param theP3 Junction point of incident pipe
632  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
633  */
634 //=============================================================================
635 GEOM::ListOfGO* AdvancedEngine_IOperations_i::MakePipeTShapeTRFilletWithPosition
636                      (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
637                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
638                       CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
639                       CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
640                       CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
641                       CORBA::Double theRF, CORBA::Boolean theHexMesh,
642                       GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
643 {
644   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
645
646   //Set a not done flag
647   GetOperations()->SetNotDone();
648
649   //Get the reference vertices
650   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
651   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
652   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
653
654   //Create the TShape
655   Handle(TColStd_HSequenceOfTransient) aHSeq =
656     GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
657                                                       theRL, theWL, theLtransL, theLthinL,
658                                                       theRR, theWR, theLtransR, theLthinR,
659                                                       theRI, theWI, theLtransI, theLthinI,
660                                                       theRF, theHexMesh, aP1, aP2, aP3);
661   if (!GetOperations()->IsDone() || aHSeq.IsNull())
662     return aSeq._retn();
663
664   Standard_Integer aLength = aHSeq->Length();
665   aSeq->length(aLength);
666   for (Standard_Integer i = 1; i <= aLength; i++)
667     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
668
669   return aSeq._retn();
670 }
671
672 //=============================================================================
673 /*!
674  *  This function allows to create a disk already divided into blocks. It can be
675  *  use to create divided pipes for later meshing in hexaedra.
676  *  \param theR Radius of the disk
677  *  \param theRatio Relative size of the central square diagonal against the disk diameter
678  *  \return New GEOM_Object, containing the created shape.
679  */
680 //=============================================================================
681 GEOM::GEOM_Object_ptr AdvancedEngine_IOperations_i::MakeDividedDisk (CORBA::Double theR,
682                                                                      CORBA::Double theRatio,
683                                                                      CORBA::Short theOrientation,
684                                                                      GEOM::pattern thePattern)
685 {
686   GEOM::GEOM_Object_var aGEOMObject;
687
688   //Set a not done flag
689   GetOperations()->SetNotDone();
690
691   //Create the DividedDisk
692   Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation, thePattern);
693   if (!GetOperations()->IsDone() || anObject.IsNull())
694     return aGEOMObject._retn();
695
696   return GetObject(anObject);
697 }
698
699 //=============================================================================
700 /*!
701  *  MakeDividedDiskPntVecR
702  */
703 //=============================================================================
704 GEOM::GEOM_Object_ptr AdvancedEngine_IOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt,
705                                                                             GEOM::GEOM_Object_ptr theVec,
706                                                                             CORBA::Double theR,
707                                                                             CORBA::Double theRatio,
708                                                                             GEOM::pattern thePattern)
709 {
710   GEOM::GEOM_Object_var aGEOMObject;
711
712   //Set a not done flag
713   GetOperations()->SetNotDone();
714
715   //Get the reference points
716   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
717   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
718
719   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
720
721   // Make DividedDisk
722   Handle(GEOM_Object) anObject =
723     GetOperations()->MakeDividedDiskPntVecR(aPnt, aVec, theR, theRatio, thePattern);
724   if (!GetOperations()->IsDone() || anObject.IsNull())
725     return aGEOMObject._retn();
726
727   return GetObject(anObject);
728 }
729
730 //=============================================================================
731 /*!
732  *  Builds a cylinder prepared for hexa meshes
733  *  \param theR Radius of the cylinder
734  *  \param theH Height of the cylinder
735  *  \return New GEOM_Object, containing the created shape.
736  */
737 //=============================================================================
738 GEOM::GEOM_Object_ptr AdvancedEngine_IOperations_i::MakeDividedCylinder (CORBA::Double theR,
739                                                                          CORBA::Double theH,
740                                                                          GEOM::pattern thePattern)
741 {
742   GEOM::GEOM_Object_var aGEOMObject;
743
744   //Set a not done flag
745   GetOperations()->SetNotDone();
746
747   //Create the DividedCylinder
748   Handle(GEOM_Object) anObject = GetOperations()->MakeDividedCylinder(theR, theH, thePattern);
749   if (!GetOperations()->IsDone() || anObject.IsNull())
750     return aGEOMObject._retn();
751
752   return GetObject(anObject);
753 }
754
755 //=============================================================================
756 /*!
757  *  
758  *  \param thelPoints list of  points
759  *  \param theNbMax maximum number of Bezier pieces in the resulting surface.
760  *  \param theDegMax maximum degree of the resulting BSpline surface
761  *  \param theDMax specifies maximum value of the GeomPlate_PlateG0Criterion criterion.
762  *  \return New GEOM_Object, containing the created shape.
763  */
764 //=============================================================================
765 GEOM::GEOM_Object_ptr AdvancedEngine_IOperations_i::MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints,
766                                                                           CORBA::Long           theNbMax,
767                                                                           CORBA::Long           theDegMax,
768                                                                           CORBA::Double         theDMax)
769 {
770   GEOM::GEOM_Object_var aGEOMObject;
771
772   //Set a not done flag
773   GetOperations()->SetNotDone();
774
775   //Get the reference point
776   int ind = 0;
777   int aLen = thelPoints.length();
778   std::list<Handle(GEOM_Object)> aPoints;
779   for (; ind < aLen; ind++) {
780     Handle(GEOM_Object) aPnt = GetObjectImpl(thelPoints[ind]);
781     if (aPnt.IsNull()) return aGEOMObject._retn();
782     aPoints.push_back(aPnt);
783   }
784   //Create the SmoothingSurface
785   Handle(GEOM_Object) anObject = GetOperations()->MakeSmoothingSurface
786         (aPoints, theNbMax, theDegMax, theDMax);
787   if (!GetOperations()->IsDone() || anObject.IsNull())
788     return aGEOMObject._retn();
789
790   return GetObject(anObject);
791 }
792
793 AdvancedEngine_IOperations* AdvancedEngine_IOperations_i::GetOperations()
794 {
795   return (AdvancedEngine_IOperations*)GetImpl();
796 }
797