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 //=============================================================================
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.
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)
77 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
80 GetOperations()->SetNotDone();
83 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
84 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
95 //=============================================================================
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.
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)
119 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
121 //Set a not done flag
122 GetOperations()->SetNotDone();
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();
131 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3);
132 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
143 //=============================================================================
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.
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)
166 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
168 //Set a not done flag
169 GetOperations()->SetNotDone();
172 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
173 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
184 //=============================================================================
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.
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)
212 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
214 //Set a not done flag
215 GetOperations()->SetNotDone();
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);
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())
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)));
236 //=============================================================================
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.
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)
258 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
260 //Set a not done flag
261 GetOperations()->SetNotDone();
264 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
265 if (!GetOperations()->IsDone() || aHSeq.IsNull())
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)));
276 //=============================================================================
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.
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)
303 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
305 //Set a not done flag
306 GetOperations()->SetNotDone();
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);
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())
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)));
327 /*@@ insert new functions before this line @@*/