]> 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  *  Create a T-shape object with specified caracteristics for the main and the
61  *  incident pipes (radius, width, half-length).
62  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
63  *  \param theR1 Internal radius of main pipe
64  *  \param theW1 Width of main pipe
65  *  \param theL1 Half-length of main pipe
66  *  \param theR2 Internal radius of incident pipe (R2 < R1)
67  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
68  *  \param theL2 Half-length of incident pipe
69  *  \param theHexMesh false = no partition, true = with partition
70  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
71  */
72 //=============================================================================
73 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
74                                                               CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 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 = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
83   if (!GetOperations()->IsDone() || aHSeq.IsNull())
84     return aSeq._retn();
85   
86   Standard_Integer aLength = aHSeq->Length();
87   aSeq->length(aLength);
88   for (Standard_Integer i = 1; i <= aLength; i++)
89     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
90
91   return aSeq._retn();
92 }
93
94 //=============================================================================
95 /*!
96  *  Create a T-shape object with specified caracteristics for the main and the
97  *  incident pipes (radius, width, half-length).
98  *  The T-shape is placed at junction points P1, P2 and P3.
99  *  \param theR1 Internal radius of main pipe
100  *  \param theW1 Width of main pipe
101  *  \param theL1 Half-length of main pipe
102  *  \param theR2 Internal radius of incident pipe (R2 < R1)
103  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
104  *  \param theL2 Half-length of incident pipe
105  *  \param theHexMesh false = no partition, true = with partition
106  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
107  */
108 //=============================================================================
109 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
110                                                                               CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh,
111                                                                               GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
112 {
113   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
114
115   //Set a not done flag
116   GetOperations()->SetNotDone();
117
118   //Get the reference vertices
119   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
120   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
121   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
122   if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
123
124   //Create the TShape
125   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3);
126   if (!GetOperations()->IsDone() || aHSeq.IsNull())
127     return aSeq._retn();
128   
129   Standard_Integer aLength = aHSeq->Length();
130   aSeq->length(aLength);
131   for (Standard_Integer i = 1; i <= aLength; i++)
132     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
133
134   return aSeq._retn();
135 }
136
137 //=============================================================================
138 /*!
139  *  Create a T-shape object with specified caracteristics for the main and the
140  *  incident pipes (radius, width, half-length). A chamfer is created on
141  *  the junction of the pipes.
142  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
143  *  \param theR1 Internal radius of main pipe
144  *  \param theW1 Width of main pipe
145  *  \param theL1 Half-length of main pipe
146  *  \param theR2 Internal radius of incident pipe (R2 < R1)
147  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
148  *  \param theL2 Half-length of incident pipe
149  *  \param theH Height of the chamfer.
150  *  \param theW Width of the chamfer.
151  *  \param theHexMesh false = no partition, true = with partition
152  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
153  */
154 //=============================================================================
155 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
156                                                                         CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
157                                                                         CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
158 {
159   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
160
161   //Set a not done flag
162   GetOperations()->SetNotDone();
163
164   //Create the TShape
165   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
166   if (!GetOperations()->IsDone() || aHSeq.IsNull())
167     return aSeq._retn();
168   
169   Standard_Integer aLength = aHSeq->Length();
170   aSeq->length(aLength);
171   for (Standard_Integer i = 1; i <= aLength; i++)
172     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
173
174   return aSeq._retn();
175 }
176
177 //=============================================================================
178 /*!
179  *  Create a T-shape object with specified caracteristics for the main and the
180  *  incident pipes (radius, width, half-length). A chamfer is created on
181  *  the junction of the pipes.
182  *  The T-shape is placed at junction points P1, P2 and P3.
183  *  \param theR1 Internal radius of main pipe
184  *  \param theW1 Width of main pipe
185  *  \param theL1 Half-length of main pipe
186  *  \param theR2 Internal radius of incident pipe (R2 < R1)
187  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
188  *  \param theL2 Half-length of incident pipe
189  *  \param theH Height of the chamfer.
190  *  \param theW Width of the chamfer.
191  *  \param theHexMesh false = no partition, true = with partition
192  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
193  */
194 //=============================================================================
195 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
196                                                                                      CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
197                                                                                      CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
198                                                                                      GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
199 {
200   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
201
202   //Set a not done flag
203   GetOperations()->SetNotDone();
204
205   //Get the reference vertices
206   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
207   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
208   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
209
210   //Create the TShape
211   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
212                                                                                     theHexMesh, aP1, aP2, aP3);
213   if (!GetOperations()->IsDone() || aHSeq.IsNull())
214     return aSeq._retn();
215   
216   Standard_Integer aLength = aHSeq->Length();
217   aSeq->length(aLength);
218   for (Standard_Integer i = 1; i <= aLength; i++)
219     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
220
221   return aSeq._retn();
222 }
223
224 //=============================================================================
225 /*!
226  *  Create a T-shape object with specified caracteristics for the main and the
227  *  incident pipes (radius, width, half-length). A fillet is created on
228  *  the junction of the pipes.
229  *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
230  *  \param theR1 Internal radius of main pipe
231  *  \param theW1 Width of main pipe
232  *  \param theL1 Half-length of main pipe
233  *  \param theR2 Internal radius of incident pipe (R2 < R1)
234  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
235  *  \param theL2 Half-length of incident pipe
236  *  \param theRF Radius of curvature of fillet.
237  *  \param theHexMesh false = no partition, true = with partition
238  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
239  */
240 //=============================================================================
241 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
242                                                                         CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
243                                                                         CORBA::Double theRF, CORBA::Boolean theHexMesh)
244 {
245   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
246
247   //Set a not done flag
248   GetOperations()->SetNotDone();
249
250   //Create the TShape
251   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
252   if (!GetOperations()->IsDone() || aHSeq.IsNull())
253     return aSeq._retn();
254   
255   Standard_Integer aLength = aHSeq->Length();
256   aSeq->length(aLength);
257   for (Standard_Integer i = 1; i <= aLength; i++)
258     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
259
260   return aSeq._retn();
261 }
262
263 //=============================================================================
264 /*!
265  *  Create a T-shape object with specified caracteristics for the main and the
266  *  incident pipes (radius, width, half-length). A fillet is created on
267  *  the junction of the pipes.
268  *  The T-shape is placed at junction points P1, P2 and P3.
269  *  \param theR1 Internal radius of main pipe
270  *  \param theW1 Width of main pipe
271  *  \param theL1 Half-length of main pipe
272  *  \param theR2 Internal radius of incident pipe (R2 < R1)
273  *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
274  *  \param theL2 Half-length of incident pipe
275  *  \param theRF Radius of curvature of fillet.
276  *  \param theHexMesh false = no partition, true = with partition
277  *  \return List of GEOM_Objects, containing the created shape and propagation groups.
278  */
279 //=============================================================================
280 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
281                                                                                     CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
282                                                                                     CORBA::Double theRF, CORBA::Boolean theHexMesh,
283                                                                                     GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
284 {
285   GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
286
287   //Set a not done flag
288   GetOperations()->SetNotDone();
289
290   //Get the reference vertices
291   Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
292   Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
293   Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
294
295   //Create the TShape
296   Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, 
297                                                                                    theHexMesh, aP1, aP2, aP3);
298   if (!GetOperations()->IsDone() || aHSeq.IsNull())
299     return aSeq._retn();
300   
301   Standard_Integer aLength = aHSeq->Length();
302   aSeq->length(aLength);
303   for (Standard_Integer i = 1; i <= aLength; i++)
304     aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
305
306   return aSeq._retn();
307 }
308
309 /*@@ insert new functions before this line @@*/