]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM_I/GEOM_IAdvancedOperations_i.cc
Salome HOME
0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape
[modules/geom.git] / src / GEOM_I / GEOM_IAdvancedOperations_i.cc
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : GEOM_IAdvancedOperations.cc
23 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24 //
25
26 #include <Standard_Stream.hxx>
27
28 #include "GEOM_IAdvancedOperations_i.hh"
29
30 #include <utilities.h>
31 #include <OpUtil.hxx>
32 #include <Utils_ExceptHandlers.hxx>
33
34 #include "GEOM_Engine.hxx"
35 #include "GEOM_Object.hxx"
36
37 //=============================================================================
38 /*!
39  *   constructor:
40  */
41 //=============================================================================
42 GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IAdvancedOperations* theImpl)
43 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
44 {
45   MESSAGE("GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i");
46 }
47
48 //=============================================================================
49 /*!
50  *  destructor
51  */
52 //=============================================================================
53 GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i()
54 {
55   MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i");
56 }
57
58 //=============================================================================
59 /*!
60  *  MakePipeTShape
61  *  Create a T-shape object with specified caracteristics for the main and
62  *  the incident pipes (radius, width, half-length).
63  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
64  *  \param theR1 Internal radius of main pipe
65  *  \param theW1 Width of main pipe
66  *  \param theL1 Half-length of main pipe
67  *  \param theR2 Internal radius of incident pipe (R2 < R1)
68  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
69  *  \param theL2 Half-length of incident pipe
70  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
71  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
72  */
73 //=============================================================================
74 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
75                                                               CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 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 = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
84   if (!GetOperations()->IsDone() || aHSeq.IsNull())
85     return aSeq._retn();
86   
87   Standard_Integer aLength = aHSeq->Length();
88   aSeq->length(aLength);
89   for (Standard_Integer i = 1; i <= aLength; i++)
90     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
91
92   return aSeq._retn();
93 }
94
95 //=============================================================================
96 /*!
97  *  MakePipeTShapeWithPosition
98  *  Create a T-shape object with specified caracteristics for the main and
99  *  the incident pipes (radius, width, half-length).
100  *  The extremities of the main pipe are located on junctions points P1 and P2.
101  *  The extremity of the incident pipe is located on junction point P3.
102  *  \param theR1 Internal radius of main pipe
103  *  \param theW1 Width of main pipe
104  *  \param theL1 Half-length of main pipe
105  *  \param theR2 Internal radius of incident pipe (R2 < R1)
106  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
107  *  \param theL2 Half-length of incident pipe
108  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
109  *  \param theP1 1st junction point of main pipe
110  *  \param theP2 2nd junction point of main pipe
111  *  \param theP3 Junction point of incident pipe
112  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
113  */
114 //=============================================================================
115 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
116                                                                               CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh,
117                                                                               GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
118 {
119   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
120
121   //Set a not done flag
122   GetOperations()->SetNotDone();
123
124   //Get the reference vertices
125   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
126   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
127   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
128   if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
129
130   //Create the TShape
131   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3);
132   if (!GetOperations()->IsDone() || aHSeq.IsNull())
133     return aSeq._retn();
134   
135   Standard_Integer aLength = aHSeq->Length();
136   aSeq->length(aLength);
137   for (Standard_Integer i = 1; i <= aLength; i++)
138     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
139
140   return aSeq._retn();
141 }
142
143 //=============================================================================
144 /*!
145  *  MakePipeTShapeChamfer
146  *  Create a T-shape object with specified caracteristics for the main and
147  *  the incident pipes (radius, width, half-length). A chamfer is created
148  *  on the junction of the pipes.
149  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
150  *  \param theR1 Internal radius of main pipe
151  *  \param theW1 Width of main pipe
152  *  \param theL1 Half-length of main pipe
153  *  \param theR2 Internal radius of incident pipe (R2 < R1)
154  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
155  *  \param theL2 Half-length of incident pipe
156  *  \param theH Height of chamfer.
157  *  \param theW Width of chamfer.
158  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
159  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
160  */
161 //=============================================================================
162 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
163                                                                         CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
164                                                                         CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
165 {
166   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
167
168   //Set a not done flag
169   GetOperations()->SetNotDone();
170
171   //Create the TShape
172   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
173   if (!GetOperations()->IsDone() || aHSeq.IsNull())
174     return aSeq._retn();
175   
176   Standard_Integer aLength = aHSeq->Length();
177   aSeq->length(aLength);
178   for (Standard_Integer i = 1; i <= aLength; i++)
179     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
180
181   return aSeq._retn();
182 }
183
184 //=============================================================================
185 /*!
186  *  MakePipeTShapeChamferWithPosition
187  *  Create a T-shape object with specified caracteristics for the main and
188  *  the incident pipes (radius, width, half-length). A chamfer is created
189  *  on the junction of the pipes.
190  *  The extremities of the main pipe are located on junctions points P1 and P2.
191  *  The extremity of the incident pipe is located on junction point P3.
192  *  \param theR1 Internal radius of main pipe
193  *  \param theW1 Width of main pipe
194  *  \param theL1 Half-length of main pipe
195  *  \param theR2 Internal radius of incident pipe (R2 < R1)
196  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
197  *  \param theL2 Half-length of incident pipe
198  *  \param theH Height of the chamfer.
199  *  \param theW Width of the chamfer.
200  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
201  *  \param theP1 1st junction point of main pipe
202  *  \param theP2 2nd junction point of main pipe
203  *  \param theP3 Junction point of incident pipe
204  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
205  */
206 //=============================================================================
207 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
208                                                                                      CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
209                                                                                      CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
210                                                                                      GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
211 {
212   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
213
214   //Set a not done flag
215   GetOperations()->SetNotDone();
216
217   //Get the reference vertices
218   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
219   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
220   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
221
222   //Create the TShape
223   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
224                                                                                     theHexMesh, aP1, aP2, aP3);
225   if (!GetOperations()->IsDone() || aHSeq.IsNull())
226     return aSeq._retn();
227   
228   Standard_Integer aLength = aHSeq->Length();
229   aSeq->length(aLength);
230   for (Standard_Integer i = 1; i <= aLength; i++)
231     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
232
233   return aSeq._retn();
234 }
235
236 //=============================================================================
237 /*!
238  *  MakePipeTShapeFillet
239  *  Create a T-shape object with specified caracteristics for the main and
240  *  the incident pipes (radius, width, half-length). A fillet is created
241  *  on the junction of the pipes.
242  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
243  *  \param theR1 Internal radius of main pipe
244  *  \param theW1 Width of main pipe
245  *  \param theL1 Half-length of main pipe
246  *  \param theR2 Internal radius of incident pipe (R2 < R1)
247  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
248  *  \param theL2 Half-length of incident pipe
249  *  \param theRF Radius of curvature of fillet.
250  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
251  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
252  */
253 //=============================================================================
254 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
255                                                                         CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
256                                                                         CORBA::Double theRF, CORBA::Boolean theHexMesh)
257 {
258   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
259
260   //Set a not done flag
261   GetOperations()->SetNotDone();
262
263   //Create the TShape
264   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
265   if (!GetOperations()->IsDone() || aHSeq.IsNull())
266     return aSeq._retn();
267   
268   Standard_Integer aLength = aHSeq->Length();
269   aSeq->length(aLength);
270   for (Standard_Integer i = 1; i <= aLength; i++)
271     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
272
273   return aSeq._retn();
274 }
275
276 //=============================================================================
277 /*!
278  *  MakePipeTShapeFilletWithPosition
279  *  Create a T-shape object with specified caracteristics for the main and
280  *  the incident pipes (radius, width, half-length). A fillet is created
281  *  on the junction of the pipes.
282  *  The extremities of the main pipe are located on junctions points P1 and P2.
283  *  The extremity of the incident pipe is located on junction point P3.
284  *  \param theR1 Internal radius of main pipe
285  *  \param theW1 Width of main pipe
286  *  \param theL1 Half-length of main pipe
287  *  \param theR2 Internal radius of incident pipe (R2 < R1)
288  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
289  *  \param theL2 Half-length of incident pipe
290  *  \param theRF Radius of curvature of fillet
291  *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
292  *  \param theP1 1st junction point of main pipe
293  *  \param theP2 2nd junction point of main pipe
294  *  \param theP3 Junction point of incident pipe
295  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
296  */
297 //=============================================================================
298 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
299                                                                                     CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
300                                                                                     CORBA::Double theRF, CORBA::Boolean theHexMesh,
301                                                                                     GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
302 {
303   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
304
305   //Set a not done flag
306   GetOperations()->SetNotDone();
307
308   //Get the reference vertices
309   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
310   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
311   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
312
313   //Create the TShape
314   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, 
315                                                                                    theHexMesh, aP1, aP2, aP3);
316   if (!GetOperations()->IsDone() || aHSeq.IsNull())
317     return aSeq._retn();
318   
319   Standard_Integer aLength = aHSeq->Length();
320   aSeq->length(aLength);
321   for (Standard_Integer i = 1; i <= aLength; i++)
322     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
323
324   return aSeq._retn();
325 }
326
327 /*@@ insert new functions before this line @@*/