1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : GEOM_IAdvancedOperations.cc
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
26 #include <Standard_Stream.hxx>
28 #include "GEOM_IAdvancedOperations_i.hh"
30 #include <utilities.h>
32 #include <Utils_ExceptHandlers.hxx>
34 #include "GEOM_Engine.hxx"
35 #include "GEOM_Object.hxx"
37 //=============================================================================
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)
45 MESSAGE("GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i");
48 //=============================================================================
52 //=============================================================================
53 GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i()
55 MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i");
58 //=============================================================================
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.
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)
76 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
79 GetOperations()->SetNotDone();
82 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
83 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
94 //=============================================================================
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.
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)
113 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
115 //Set a not done flag
116 GetOperations()->SetNotDone();
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();
125 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3);
126 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
137 //=============================================================================
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.
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)
159 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
161 //Set a not done flag
162 GetOperations()->SetNotDone();
165 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
166 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
177 //=============================================================================
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.
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)
200 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
202 //Set a not done flag
203 GetOperations()->SetNotDone();
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);
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())
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)));
224 //=============================================================================
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.
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)
245 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
247 //Set a not done flag
248 GetOperations()->SetNotDone();
251 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
252 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
263 //=============================================================================
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.
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)
285 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
287 //Set a not done flag
288 GetOperations()->SetNotDone();
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);
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())
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)));
309 /*@@ insert new functions before this line @@*/