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