1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : GEOM_IAdvancedOperations.cc
21 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
23 #include <Standard_Stream.hxx>
25 #include "GEOM_IAdvancedOperations_i.hh"
27 #include <utilities.h>
29 #include <Utils_ExceptHandlers.hxx>
31 #include "GEOM_Engine.hxx"
32 #include "GEOM_Object.hxx"
34 //=============================================================================
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)
42 MESSAGE("GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i");
45 //=============================================================================
49 //=============================================================================
50 GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i()
52 MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i");
55 //=============================================================================
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.
70 //=============================================================================
71 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
72 CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh)
74 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
77 GetOperations()->SetNotDone();
80 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
81 if (!GetOperations()->IsDone() || aHSeq.IsNull())
84 Standard_Integer aLength = aHSeq->Length();
85 aSeq->length(aLength);
86 for (Standard_Integer i = 1; i <= aLength; i++)
87 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
92 //=============================================================================
94 * MakePipeTShapeWithPosition
95 * Create a T-shape object with specified caracteristics for the main and
96 * the incident pipes (radius, width, half-length).
97 * The extremities of the main pipe are located on junctions points P1 and P2.
98 * The extremity of the incident pipe is located on junction point 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 Boolean indicating if shape is prepared for hex mesh
106 * \param theP1 1st junction point of main pipe
107 * \param theP2 2nd junction point of main pipe
108 * \param theP3 Junction point of incident pipe
109 * \return List of GEOM_Objects, containing the created shape and propagation groups.
111 //=============================================================================
112 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
113 CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh,
114 GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
116 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
118 //Set a not done flag
119 GetOperations()->SetNotDone();
121 //Get the reference vertices
122 Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
123 Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
124 Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
125 if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
128 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3);
129 if (!GetOperations()->IsDone() || aHSeq.IsNull())
132 Standard_Integer aLength = aHSeq->Length();
133 aSeq->length(aLength);
134 for (Standard_Integer i = 1; i <= aLength; i++)
135 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
140 //=============================================================================
142 * MakePipeTShapeChamfer
143 * Create a T-shape object with specified caracteristics for the main and
144 * the incident pipes (radius, width, half-length). A chamfer is created
145 * on the junction of the pipes.
146 * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
147 * \param theR1 Internal radius of main pipe
148 * \param theW1 Width of main pipe
149 * \param theL1 Half-length of main pipe
150 * \param theR2 Internal radius of incident pipe (R2 < R1)
151 * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
152 * \param theL2 Half-length of incident pipe
153 * \param theH Height of chamfer.
154 * \param theW Width of chamfer.
155 * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
156 * \return List of GEOM_Objects, containing the created shape and propagation groups.
158 //=============================================================================
159 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
160 CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
161 CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
163 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
165 //Set a not done flag
166 GetOperations()->SetNotDone();
169 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
170 if (!GetOperations()->IsDone() || aHSeq.IsNull())
173 Standard_Integer aLength = aHSeq->Length();
174 aSeq->length(aLength);
175 for (Standard_Integer i = 1; i <= aLength; i++)
176 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
181 //=============================================================================
183 * MakePipeTShapeChamferWithPosition
184 * Create a T-shape object with specified caracteristics for the main and
185 * the incident pipes (radius, width, half-length). A chamfer is created
186 * on the junction of the pipes.
187 * The extremities of the main pipe are located on junctions points P1 and P2.
188 * The extremity of the incident pipe is located on junction point P3.
189 * \param theR1 Internal radius of main pipe
190 * \param theW1 Width of main pipe
191 * \param theL1 Half-length of main pipe
192 * \param theR2 Internal radius of incident pipe (R2 < R1)
193 * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
194 * \param theL2 Half-length of incident pipe
195 * \param theH Height of the chamfer.
196 * \param theW Width of the chamfer.
197 * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
198 * \param theP1 1st junction point of main pipe
199 * \param theP2 2nd junction point of main pipe
200 * \param theP3 Junction point of incident pipe
201 * \return List of GEOM_Objects, containing the created shape and propagation groups.
203 //=============================================================================
204 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
205 CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
206 CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
207 GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
209 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
211 //Set a not done flag
212 GetOperations()->SetNotDone();
214 //Get the reference vertices
215 Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
216 Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
217 Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
220 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
221 theHexMesh, aP1, aP2, aP3);
222 if (!GetOperations()->IsDone() || aHSeq.IsNull())
225 Standard_Integer aLength = aHSeq->Length();
226 aSeq->length(aLength);
227 for (Standard_Integer i = 1; i <= aLength; i++)
228 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
233 //=============================================================================
235 * MakePipeTShapeFillet
236 * Create a T-shape object with specified caracteristics for the main and
237 * the incident pipes (radius, width, half-length). A fillet is created
238 * on the junction of the pipes.
239 * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
240 * \param theR1 Internal radius of main pipe
241 * \param theW1 Width of main pipe
242 * \param theL1 Half-length of main pipe
243 * \param theR2 Internal radius of incident pipe (R2 < R1)
244 * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
245 * \param theL2 Half-length of incident pipe
246 * \param theRF Radius of curvature of fillet.
247 * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
248 * \return List of GEOM_Objects, containing the created shape and propagation groups.
250 //=============================================================================
251 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
252 CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
253 CORBA::Double theRF, CORBA::Boolean theHexMesh)
255 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
257 //Set a not done flag
258 GetOperations()->SetNotDone();
261 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
262 if (!GetOperations()->IsDone() || aHSeq.IsNull())
265 Standard_Integer aLength = aHSeq->Length();
266 aSeq->length(aLength);
267 for (Standard_Integer i = 1; i <= aLength; i++)
268 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
273 //=============================================================================
275 * MakePipeTShapeFilletWithPosition
276 * Create a T-shape object with specified caracteristics for the main and
277 * the incident pipes (radius, width, half-length). A fillet is created
278 * on the junction of the pipes.
279 * The extremities of the main pipe are located on junctions points P1 and P2.
280 * The extremity of the incident pipe is located on junction point P3.
281 * \param theR1 Internal radius of main pipe
282 * \param theW1 Width of main pipe
283 * \param theL1 Half-length of main pipe
284 * \param theR2 Internal radius of incident pipe (R2 < R1)
285 * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
286 * \param theL2 Half-length of incident pipe
287 * \param theRF Radius of curvature of fillet
288 * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
289 * \param theP1 1st junction point of main pipe
290 * \param theP2 2nd junction point of main pipe
291 * \param theP3 Junction point of incident pipe
292 * \return List of GEOM_Objects, containing the created shape and propagation groups.
294 //=============================================================================
295 GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
296 CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
297 CORBA::Double theRF, CORBA::Boolean theHexMesh,
298 GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
300 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
302 //Set a not done flag
303 GetOperations()->SetNotDone();
305 //Get the reference vertices
306 Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
307 Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
308 Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
311 Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF,
312 theHexMesh, aP1, aP2, aP3);
313 if (!GetOperations()->IsDone() || aHSeq.IsNull())
316 Standard_Integer aLength = aHSeq->Length();
317 aSeq->length(aLength);
318 for (Standard_Integer i = 1; i <= aLength; i++)
319 aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
324 /*@@ insert new functions before this line @@ do not remove this line @@*/