1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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 #include "AdvancedEngine_PipeTShapeDriver.hxx"
21 #include "AdvancedEngine_IPipeTShape.hxx"
22 #include "AdvancedEngine_Types.hxx"
23 #include "AdvancedEngine_IOperations.hxx"
25 #include "GEOMImpl_Block6Explorer.hxx"
26 #include "GEOM_Function.hxx"
27 #include "GEOM_IOperations.hxx"
28 #include "GEOMUtils.hxx"
29 #include "GEOMAlgo_FinderShapeOn1.hxx"
30 #include "GEOMAlgo_FinderShapeOn2.hxx"
31 #include "GEOMAlgo_ClsfBox.hxx"
32 #include "GEOMAlgo_Splitter.hxx"
34 #include "Geom_CylindricalSurface.hxx"
40 #include <gp_Trsf.hxx>
41 #include <TFunction_Logbook.hxx>
42 #include <StdFail_NotDone.hxx>
43 #include <BRepPrimAPI_MakeCone.hxx>
44 #include <BRepPrimAPI_MakeCylinder.hxx>
45 #include <BRepAlgoAPI_Fuse.hxx>
46 #include <BRepAlgoAPI_Cut.hxx>
47 #include <BRepPrimAPI_MakeBox.hxx>
48 #include <BRepBuilderAPI_MakeEdge.hxx>
49 #include <BRepBuilderAPI_MakeFace.hxx>
50 #include <BRepBuilderAPI_MakeWire.hxx>
51 #include <BRepBuilderAPI_Transform.hxx>
52 #include <BRepFilletAPI_MakeFillet.hxx>
53 #include <BRepFilletAPI_MakeChamfer.hxx>
54 #include <BRep_Builder.hxx>
55 #include <TopoDS_Compound.hxx>
57 #include <TopExp_Explorer.hxx>
58 #include <BRep_Tool.hxx>
59 #include <BRepTools.hxx>
61 #include <TopTools_IndexedMapOfShape.hxx>
62 #include <TopTools_ListIteratorOfListOfShape.hxx>
66 //=======================================================================
69 //=======================================================================
70 const Standard_GUID& AdvancedEngine_PipeTShapeDriver::GetID()
72 static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
76 //=======================================================================
77 //function : AdvancedEngine_PipeTShapeDriver
79 //=======================================================================
80 AdvancedEngine_PipeTShapeDriver::AdvancedEngine_PipeTShapeDriver()
84 //=======================================================================
85 //function : getShapesOnBoxIDs
87 * \brief Find IDs of sub-shapes complying with given status about surface
88 * \param theBox - the box to check state of sub-shapes against
89 * \param theShape - the shape to explore
90 * \param theShapeType - type of sub-shape of theShape
91 * \param theState - required state
92 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
94 //=======================================================================
95 Handle(TColStd_HSequenceOfInteger)
96 AdvancedEngine_PipeTShapeDriver::GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
97 const TopoDS_Shape& aShape,
98 const Standard_Integer theShapeType,
99 GEOMAlgo_State theState) const
101 Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
103 // Check presence of triangulation, build if need
104 if (!GEOMUtils::CheckTriangulation(aShape)) {
105 StdFail_NotDone::Raise("Cannot build triangulation on the shape");
110 GEOMAlgo_FinderShapeOn2 aFinder;
111 Standard_Real aTol = 0.0001; // default value
113 Handle(GEOMAlgo_ClsfBox) aClsfBox = new GEOMAlgo_ClsfBox;
114 aClsfBox->SetBox(aBox);
116 aFinder.SetShape(aShape);
117 aFinder.SetTolerance(aTol);
118 aFinder.SetClsf(aClsfBox);
119 aFinder.SetShapeType( (TopAbs_ShapeEnum)theShapeType );
120 aFinder.SetState(theState);
123 // Interprete results
124 Standard_Integer iErr = aFinder.ErrorStatus();
125 // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
127 TCollection_AsciiString aMsg (" iErr : ");
128 aMsg += TCollection_AsciiString(iErr);
129 StdFail_NotDone::Raise(aMsg.ToCString());
134 const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
136 if (listSS.Extent() < 1) {
137 StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
141 // Fill sequence of object IDs
142 aSeqOfIDs = new TColStd_HSequenceOfInteger;
144 TopTools_IndexedMapOfShape anIndices;
145 TopExp::MapShapes(aShape, anIndices);
147 TopTools_ListIteratorOfListOfShape itSub (listSS);
148 for (int index = 1; itSub.More(); itSub.Next(), ++index) {
149 int id = anIndices.FindIndex(itSub.Value());
150 // std::cerr << "Shape with ID " << id << " found" << std::endl;
151 aSeqOfIDs->Append(id);
157 //=======================================================================
158 //function : GetShapesOnSurfaceIDs
160 * \brief Find IDs of sub-shapes complying with given status about surface
161 * \param theSurface - the surface to check state of sub-shapes against
162 * \param theShape - the shape to explore
163 * \param theShapeType - type of sub-shape of theShape
164 * \param theState - required state
165 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
167 //=======================================================================
168 Handle(TColStd_HSequenceOfInteger)
169 AdvancedEngine_PipeTShapeDriver::GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
170 const TopoDS_Shape& theShape,
171 TopAbs_ShapeEnum theShapeType,
172 GEOMAlgo_State theState) const
174 Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
176 // Check presence of triangulation, build if need
177 if (!GEOMUtils::CheckTriangulation(theShape)) {
178 StdFail_NotDone::Raise("Cannot build triangulation on the shape");
183 GEOMAlgo_FinderShapeOn1 aFinder;
184 Standard_Real aTol = 1e-6;
186 aFinder.SetShape(theShape);
187 aFinder.SetTolerance(aTol);
188 aFinder.SetSurface(theSurface);
189 aFinder.SetShapeType(theShapeType);
190 aFinder.SetState(theState);
192 // Sets the minimal number of inner points for the faces that do not have own
193 // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
195 aFinder.SetNbPntsMin(3);
196 // Sets the maximal number of inner points for edges or faces.
197 // It is usefull for the cases when this number is very big (e.g =2000) to improve
198 // the performance. If this value =0, all inner points will be taken into account.
200 aFinder.SetNbPntsMax(0);
204 // Interprete results
205 Standard_Integer iErr = aFinder.ErrorStatus();
206 // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
208 // MESSAGE(" iErr : " << iErr);
209 TCollection_AsciiString aMsg (" iErr : ");
210 aMsg += TCollection_AsciiString(iErr);
211 StdFail_NotDone::Raise(aMsg.ToCString());
214 // Standard_Integer iWrn = aFinder.WarningStatus();
215 // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
217 // MESSAGE(" *** iWrn : " << iWrn);
220 const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
222 if (listSS.Extent() < 1) {
223 //StdFail_NotDone::Raise("Not a single sub-shape of the requested type found on the given surface");
224 StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
228 // Fill sequence of object IDs
229 aSeqOfIDs = new TColStd_HSequenceOfInteger;
231 TopTools_IndexedMapOfShape anIndices;
232 TopExp::MapShapes(theShape, anIndices);
234 TopTools_ListIteratorOfListOfShape itSub (listSS);
235 for (int index = 1; itSub.More(); itSub.Next(), ++index) {
236 int id = anIndices.FindIndex(itSub.Value());
237 aSeqOfIDs->Append(id);
243 //=======================================================================
244 //function : GetCommonShapesOnCylinders
245 //purpose : return the common shapes between 2 cylindrical surfaces
247 //=======================================================================
248 void AdvancedEngine_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
249 TopAbs_ShapeEnum theShapeType,
252 Handle(TopTools_HSequenceOfShape)& commonShapes) const
254 gp_Pnt aP0 (0, 0, 0);
255 gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
256 gp_Ax3 anAxis1 (aP0, aVX, aVZ), anAxis2 (aP0, aVZ, aVX);
258 TopTools_IndexedMapOfShape aMapOfShapes;
259 aMapOfShapes.Clear();
260 TopExp::MapShapes(theShape, aMapOfShapes);
262 commonShapes->Clear();
267 // Create a cylinder surface
268 Handle(Geom_Surface) aC1Ext = new Geom_CylindricalSurface(anAxis1, r1);
269 if ( aC1Ext.IsNull() )
270 StdFail_NotDone::Raise("Couldn't build main cylindrical surface");
272 Handle(TColStd_HSequenceOfInteger) aSeqExt1 = GetShapesOnSurfaceIDs( aC1Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
273 // Create a cylinder surface
274 Handle(Geom_Surface) aC2Ext = new Geom_CylindricalSurface(anAxis2, r2);
275 if ( aC2Ext.IsNull() )
276 StdFail_NotDone::Raise("Couldn't build incident cylindrical surface");
278 Handle(TColStd_HSequenceOfInteger) aSeqExt2 = GetShapesOnSurfaceIDs( aC2Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
279 // # Recherche (dans le quart de Te) de l'arete d'intersection des 2 cylindres
280 // # Search in theShape for common shape of type theShapeType on the intersection of 2 pipes
282 for (int i=1; i<=aSeqExt2->Length();i++) {
283 // std::cerr << "aSeqExt2->Value(i): " << aSeqExt2->Value(i) << std::endl;
284 for (int j=1; j<=aSeqExt1->Length();j++) {
285 // std::cerr << "aSeqExt1->Value(j): " << aSeqExt1->Value(j) << std::endl;
286 if (aSeqExt1->Value(j) == aSeqExt2->Value(i)) {
287 myID = aSeqExt1->Value(j);
288 commonShapes->Append(aMapOfShapes.FindKey(myID));
294 StdFail_NotDone::Raise("Common shapes couldn't be found");
297 //=======================================================================
298 //function : MakePipeTShape
300 //=======================================================================
301 TopoDS_Shape AdvancedEngine_PipeTShapeDriver::MakePipeTShape (const double r1, const double w1, const double l1,
302 const double r2, const double w2, const double l2) const
304 double r1Ext = r1 + w1;
305 double r2Ext = r2 + w2;
307 gp_Pnt aP0 (0, 0, 0);
308 gp_Pnt aP1 (-l1, 0, 0);
309 gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
310 gp_Ax2 anAxes1 (aP1, aVX, aVZ);
311 gp_Ax2 anAxes2 (aP0, aVZ, aVX);
313 // Build the initial pipes
314 BRepPrimAPI_MakeCylinder C1Int (anAxes1, r1, Abs(2 * l1));
315 BRepPrimAPI_MakeCylinder C1Ext (anAxes1, r1Ext, Abs(2 * l1));
316 BRepPrimAPI_MakeCylinder C2Int (anAxes2, r2, Abs(l2));
317 BRepPrimAPI_MakeCylinder C2Ext (anAxes2, r2Ext, Abs(l2));
322 if (!C1Int.IsDone() || !C1Ext.IsDone() || !C2Int.IsDone() || !C2Ext.IsDone()) {
323 StdFail_NotDone::Raise("Cannot build cylinders");
327 BRepAlgoAPI_Fuse fuse1 (C1Ext.Shape(), C2Ext.Shape());
328 if (!fuse1.IsDone()) {
329 StdFail_NotDone::Raise("Cannot fuse cylinders");
332 // Remove small radius main pipe
333 BRepAlgoAPI_Cut cut1 (fuse1.Shape(), C1Int.Shape());
334 if (!cut1.IsDone()) {
335 StdFail_NotDone::Raise("Coudn't cut cylinders");
338 // Remove small radius incident pipe => Te
339 BRepAlgoAPI_Cut Te (cut1.Shape(), C2Int.Shape());
341 StdFail_NotDone::Raise("Coudn't cut cylinders");
347 //=======================================================================
348 //function : MakeQuarterPipeTShape
350 //=======================================================================
351 TopoDS_Shape AdvancedEngine_PipeTShapeDriver::MakeQuarterPipeTShape (const double r1, const double w1, const double l1,
352 const double r2, const double w2, const double l2) const
354 TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2);
356 StdFail_NotDone::Raise("Couldn't build Pipe TShape");
358 // Get a quarter of shape => Te2
359 double r1Ext = r1 + w1;
360 BRepPrimAPI_MakeBox box1 (gp_Pnt(0, -2*r1Ext, -2*r1Ext), gp_Pnt( Abs(2 * l1), 2*r1Ext, Abs(2*l2)));
361 BRepPrimAPI_MakeBox box2 (gp_Pnt(0, 2*r1Ext, -2*r1Ext), gp_Pnt(-Abs(2 * l1), 0, Abs(2*l2)));
364 if (!box1.IsDone() || !box2.IsDone()) {
365 StdFail_NotDone::Raise("Couldn't build boxes");
367 BRepAlgoAPI_Cut cut3 (Te, box1.Shape());
368 if (!cut3.IsDone()) {
369 StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
371 BRepAlgoAPI_Cut Te4 (cut3.Shape(), box2.Shape());
373 StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
379 //=======================================================================
382 //=======================================================================
383 Standard_Integer AdvancedEngine_PipeTShapeDriver::Execute (TFunction_Logbook& log) const
385 if (Label().IsNull()) return 0;
386 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
388 AdvancedEngine_IPipeTShape aData (aFunction);
389 Standard_Integer aType = aFunction->GetType();
391 TopoDS_Shape aShape, Te4, Te4Part;
392 //TopoDS_Edge arete_intersect_int;
393 //Handle(TopTools_HSequenceOfShape) edges_e = new TopTools_HSequenceOfShape;
394 Handle(TColStd_HSequenceOfInteger) edges_e;
395 //Handle(TopTools_HSequenceOfShape) edges_i = new TopTools_HSequenceOfShape;
396 //gp_Pnt aP0 (0, 0, 0);
397 //gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
398 bool hexMesh = (bool) aData.GetHexMesh();
401 //double aSize = 2*(aData.GetL1() + aData.GetL2());
402 double epsilon = Precision::Approximation();
403 double aR1Ext = aData.GetR1() + aData.GetW1();
404 double aR2Ext = aData.GetR2() + aData.GetW2();
406 if (aData.GetR2() > aData.GetR1() + epsilon) {
407 StdFail_NotDone::Raise("TShape cannot be computed if R2 > R1");
410 if (aR2Ext > aR1Ext + epsilon) {
411 StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 > R1+W1");
414 // external radius are equal
415 if (fabs(aR2Ext - aR1Ext) < epsilon) {
416 if (aType == TSHAPE_CHAMFER)
417 StdFail_NotDone::Raise("TShape with chamfer cannot be computed if R2+W2 = R1+W1");
418 if (aType == TSHAPE_FILLET)
419 StdFail_NotDone::Raise("TShape with fillet cannot be computed if R2+W2 = R1+W1");
420 // internal radius are different => not possible
421 if (fabs(aData.GetR2() - aData.GetR1()) > epsilon) {
422 StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 = R1+W1 and R2 != R1");
426 if (aR1Ext >= aData.GetL2() + epsilon) {
427 StdFail_NotDone::Raise("TShape cannot be computed if R1+W1 >= L2");
429 if (aR2Ext >= aData.GetL1() + epsilon) {
430 StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 >= L1");
433 if (aType == TSHAPE_CHAMFER) {
434 if (aData.GetH() >= (aData.GetL2() - aR1Ext + epsilon)) {
435 StdFail_NotDone::Raise("TShape cannot be computed: height of chamfer is too high");
438 if (aData.GetW() >= (aData.GetL1() - aR2Ext + epsilon))
439 StdFail_NotDone::Raise("TShape cannot be computed: width of chamfer is too high");
442 if (aType == TSHAPE_FILLET) {
443 if (aData.GetRF() >= (aData.GetL2() - aR1Ext + epsilon) ||
444 aData.GetRF() >= (aData.GetL1() - aR2Ext + epsilon))
445 StdFail_NotDone::Raise("TShape cannot be computed: radius of fillet is too high");
449 // Create a quarter of a basic T-Shape pipe
450 //std::cerr << "Create a quarter of a basic T-Shape pipe" << std::endl;
451 Te4 = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
452 aData.GetR2(), aData.GetW2(), aData.GetL2());
455 // No need to cut pipe t-shape
456 //std::cerr << "Create a basic T-Shape pipe" << std::endl;
457 Te4 = MakePipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
458 aData.GetR2(), aData.GetW2(), aData.GetL2());
462 if (aType == TSHAPE_BASIC) {
464 // aShape = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
465 // aData.GetR2(), aData.GetW2(), aData.GetL2());
467 else if (aType == TSHAPE_CHAMFER) {
468 // TShape with chamfer
470 // TopoDS_Compound CC;
471 // BB.MakeCompound(CC);
472 // Create chamfer on the edges edges_e
473 BRepFilletAPI_MakeChamfer chamfer (Te4);
474 TopTools_IndexedMapOfShape anEdgesIndices;
475 TopExp::MapShapes(Te4, anEdgesIndices);
479 BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
481 if (!aBox.IsDone()) {
482 StdFail_NotDone::Raise("Couldn't build box");
484 theBox = aBox.Shape();
487 BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
489 if (!aBox.IsDone()) {
490 StdFail_NotDone::Raise("Couldn't build box");
492 theBox = aBox.Shape();
494 Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
495 edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
496 if (edges_e.IsNull() || edges_e->Length() == 0) {
497 StdFail_NotDone::Raise("Common edges not found");
500 TopTools_IndexedDataMapOfShapeListOfShape M;
501 GEOMImpl_Block6Explorer::MapShapesAndAncestors(Te4, TopAbs_EDGE, TopAbs_FACE, M);
502 // std::cerr << "Number of IDs: " << edges_e->Length() << std::endl;
503 int nbEdgesInChamfer = 0;
504 for (int i=1;i<=edges_e->Length();i++) {
505 // std::cerr << "Get Edge with ID #" << i << std::endl;
506 int theId = edges_e->Value(i);
507 // std::cerr << "ID #" << i << "= " << theId << std::endl;
508 // std::cerr << "Search for edge in shape" << std::endl;
509 TopoDS_Edge theEdge = TopoDS::Edge(anEdgesIndices.FindKey(theId));
510 // std::cerr << "Found" << std::endl;
511 // std::cerr << "Keep only edges with a vertex on (x, x, re1)" << std::endl;
512 TopExp_Explorer ExVertices;
513 for (ExVertices.Init(theEdge,TopAbs_VERTEX); ExVertices.More(); ExVertices.Next()) {
514 gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(ExVertices.Current()));
515 if (aPt.Z() - aR1Ext <= epsilon) {
516 // std::cerr << "aPt.Z() = aR1Ext => keep this edge" << std::endl;
518 const TopTools_ListOfShape& aFL = M.FindFromKey(theEdge);
519 TopoDS_Face F = TopoDS::Face( aFL.First() );
521 chamfer.Add(aData.GetH(), aData.GetW(), theEdge, F);
523 chamfer.Add(aData.GetW(), aData.GetH(), theEdge, F);
527 // std::cerr << "Test if hexMesh: ";
528 if (hexMesh && nbEdgesInChamfer == 1) {
529 // std::cerr << "Yes => stop after 1 edge" << std::endl;
532 // std::cerr << "No => continue for other edges" << std::endl;
533 // BB.Add(CC, edges_e->Value(i));
534 // const TopTools_ListOfShape& aFL = M.FindFromKey(TopoDS::Edge(edges_e->Value(i)));
535 // chamfer.Add(aData.GetW(), aData.GetH(), TopoDS::Edge(edges_e->Value(i)), F);
537 // std::cerr << "Build chamfer with " << nbEdgesInChamfer << " edges" << std::endl;
540 if (!chamfer.IsDone()) {
541 StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters");
544 // BB.Add(CC, chamfer.Shape());
547 aShape = chamfer.Shape();
549 else if (aType == TSHAPE_FILLET) {
550 // TShape with fillet
551 // Create fillet on the edge arete_intersect_ext
552 BRepFilletAPI_MakeFillet fill (Te4);
554 TopTools_IndexedMapOfShape anIndices;
555 TopExp::MapShapes(Te4, anIndices);
559 BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
561 if (!aBox.IsDone()) {
562 StdFail_NotDone::Raise("Couldn't build box");
564 theBox = aBox.Shape();
567 BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
569 if (!aBox.IsDone()) {
570 StdFail_NotDone::Raise("Couldn't build box");
572 theBox = aBox.Shape();
574 Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
575 edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
576 if (edges_e.IsNull() || edges_e->Length() == 0) {
577 StdFail_NotDone::Raise("Common edges not found");
580 // fill.Add(TopoDS::Edge(edges_e->Value(1)));
582 for (int i=1;i<=edges_e->Length();i++) {
583 if (hexMesh && (i > 1))
585 TopoDS_Edge theEdge = TopoDS::Edge(anIndices.FindKey(edges_e->Value(i)));
587 // fill.Add(TopoDS::Edge(edges_e->Value(i)));
590 fill.SetRadius(aData.GetRF(), 1, 1);
592 if (!fill.IsDone()) {
593 StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
596 aShape = fill.Shape();
599 // other construction modes here
602 if (aShape.IsNull()) return 0;
604 aFunction->SetValue(aShape);
606 log.SetTouched(Label());
611 //================================================================================
613 * \brief Returns a name of creation operation and names and values of creation parameters
615 //================================================================================
617 bool AdvancedEngine_PipeTShapeDriver::
618 GetCreationInformation(std::string& theOperationName,
619 std::vector<GEOM_Param>& theParams)
621 if (Label().IsNull()) return 0;
622 Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
624 AdvancedEngine_IPipeTShape aCI( function );
625 Standard_Integer aType = function->GetType();
627 theOperationName = "PIPETSHAPE";
631 AddParam( theParams, "Main radius", aCI.GetR1() );
632 AddParam( theParams, "Main width", aCI.GetW1() );
633 AddParam( theParams, "Main half-length", aCI.GetL1() );
634 AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
635 AddParam( theParams, "Incident pipe width", aCI.GetW2() );
636 AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
637 AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
640 AddParam( theParams, "Main radius", aCI.GetR1() );
641 AddParam( theParams, "Main width", aCI.GetW1() );
642 AddParam( theParams, "Main half-length", aCI.GetL1() );
643 AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
644 AddParam( theParams, "Incident pipe width", aCI.GetW2() );
645 AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
646 AddParam( theParams, "Chamfer height", aCI.GetH() );
647 AddParam( theParams, "Chamfer width", aCI.GetW() );
648 AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
651 AddParam( theParams, "Main radius", aCI.GetR1() );
652 AddParam( theParams, "Main width", aCI.GetW1() );
653 AddParam( theParams, "Main half-length", aCI.GetL1() );
654 AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
655 AddParam( theParams, "Incident pipe width", aCI.GetW2() );
656 AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
657 AddParam( theParams, "Fillet radius", aCI.GetRF() );
658 AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
667 IMPLEMENT_STANDARD_HANDLE (AdvancedEngine_PipeTShapeDriver,GEOM_BaseDriver);
668 IMPLEMENT_STANDARD_RTTIEXT (AdvancedEngine_PipeTShapeDriver,GEOM_BaseDriver);