From: skv Date: Tue, 21 Jul 2015 15:29:07 +0000 (+0300) Subject: 0022664: [CEA 1253] MakePipeWithDifferentSections fails on a elbow pipe X-Git-Tag: V7_7_0a1~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8851ec8d8f69aedca05141791a6f81239cb192b0;p=modules%2Fgeom.git 0022664: [CEA 1253] MakePipeWithDifferentSections fails on a elbow pipe --- diff --git a/doc/salome/examples/complex_objs_ex05.py b/doc/salome/examples/complex_objs_ex05.py index f38f0816b..f6681b587 100644 --- a/doc/salome/examples/complex_objs_ex05.py +++ b/doc/salome/examples/complex_objs_ex05.py @@ -18,18 +18,22 @@ circles.append(geompy.MakeCircle(vertices[1], edges[0], 40)) circles.append(geompy.MakeCircle(vertices[2], edges[2], 30)) circles.append(geompy.MakeCircle(vertices[3], edges[2], 20)) -# create pipe -Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0) +# create pipes +Pipe1 = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0) +Pipe2 = geompy.MakePipeWithDifferentSectionsBySteps(circles, vertices, Wire_1) # add objects in the study geompy.addToStudy(circles[0], "circles1") geompy.addToStudy(circles[1], "circles2") geompy.addToStudy(circles[2], "circles3") geompy.addToStudy(circles[3], "circles4") -id_wire = geompy.addToStudy(Wire_1, "Path") -id_pipe = geompy.addToStudy(Pipe, "Pipe") +id_wire = geompy.addToStudy(Wire_1, "Path") +id_pipe1 = geompy.addToStudy(Pipe1, "Pipe1") +id_pipe2 = geompy.addToStudy(Pipe2, "Pipe2") # display the wire(path) and the pipe gg.createAndDisplayGO(id_wire) -gg.createAndDisplayGO(id_pipe) -gg.setDisplayMode(id_pipe,1) +gg.createAndDisplayGO(id_pipe1) +gg.createAndDisplayGO(id_pipe2) +gg.setDisplayMode(id_pipe1,1) +gg.setDisplayMode(id_pipe2,1) diff --git a/doc/salome/gui/GEOM/images/pipe3.png b/doc/salome/gui/GEOM/images/pipe3.png index d1b7f4031..c5c314915 100644 Binary files a/doc/salome/gui/GEOM/images/pipe3.png and b/doc/salome/gui/GEOM/images/pipe3.png differ diff --git a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc index 078089362..84260fe68 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc @@ -72,18 +72,33 @@ Additional controls: - If With contact is checked, the section is translated in contact with the spine. - If With correction is checked, the section is rotated to be orthogonal to the spine tangent in the corresponding point. +- If Step-by-step generation is checked, the result is created +step-by-step, i.e. it creates pipes between each pair of neighbor sections and +fuses them into a single shape. + +\note If Step-by-step generation is checked, With contact and +With correction controls are disabled as corrections of bases are +not allowed in step-by-step mode. Generate groups checkbox - if checked allows to create groups of sub-shapes. For more details on groups creation please refer to \ref create_groups_page "this description". \n The \b Result of the operation will be a shell or a solid. -\n TUI Command: geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection, +\n TUI Commands: +- geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection, IsGenerateGroups=False) \n Arguments: Name + list of shapes (edges, planar wires, faces or shells) serving as base object + list of locations (vertices) on the path corresponding specified list of the shapes + 1 shape (edge or wire) for definition of the path + 3 Boolean parameters (withContact, withCorrection, IsGenerateGroups). +- geompy.MakePipeWithDifferentSectionsBySteps(baseShape, locations, pathShape, + IsGenerateGroups=False) +\n Arguments: Name + list of shapes (edges, planar wires, faces or shells) serving as base object + +list of locations (vertices) on the path corresponding specified list of the shapes + +1 shape (edge or wire) for definition of the path + +Boolean parameter. + \n Advanced options \ref preview_anchor "Preview" \image html pipe3.png diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index d7c643562..4b56df001 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1808,9 +1808,13 @@ module GEOM * should be equal to number of bases or list of locations can be empty. * \param thePath - Path shape to extrude the base shape along it. * \param theWithContact - the mode defining that the section is translated to be in - * contact with the spine. + * contact with the spine. Ignored if IsBySteps is set. * \param theWithCorrection - defining that the section is rotated to be - * orthogonal to the spine tangent in the correspondent point + * orthogonal to the spine tangent in + * the correspondent point. Ignored if IsBySteps is set. + * \param IsBySteps - flag that tells if the result should be created + * step by step or as a whole. If IsBySteps is set no correction + * of bases is allowed. * \param IsGenerateGroups flag that tells if it is necessary to * return groups (true) or not (false). * \return The list of objects. The first one is a result pipe, @@ -1823,6 +1827,7 @@ module GEOM in GEOM_Object thePath, in boolean theWithContact , in boolean theWithCorrection, + in boolean IsBySteps, in boolean IsGenerateGroups); /*! diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index d9ce747c7..606714b1e 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -1428,6 +1428,10 @@ Please, select face, shell or solid and try again GEOM_GROUP_NAME_PREFIX Group Names Prefix + + GEOM_STEP_BY_STEP + Step-by-step generation + GEOM_PLANE Plane diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index 017447071..4f46c1bbd 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -1828,6 +1828,7 @@ Handle(TColStd_HSequenceOfTransient) const Handle(GEOM_Object) &thePath, const bool theWithContact, const bool theWithCorrections, + const bool IsBySteps, const bool IsGenerateGroups) { SetErrorCode(KO); @@ -1897,8 +1898,13 @@ Handle(TColStd_HSequenceOfTransient) aCI.SetBases(aSeqBases); aCI.SetLocations(aSeqLocs); aCI.SetPath(aRefPath); - aCI.SetWithContactMode(theWithContact); - aCI.SetWithCorrectionMode(theWithCorrections); + + if (!IsBySteps) { + aCI.SetWithContactMode(theWithContact); + aCI.SetWithCorrectionMode(theWithCorrections); + } + + aCI.SetIsBySteps(IsBySteps); aCI.SetGenerateGroups(IsGenerateGroups); //Compute the Pipe value @@ -1930,7 +1936,11 @@ Handle(TColStd_HSequenceOfTransient) pyDump << aPipeDS; } - pyDump << " = geompy.MakePipeWithDifferentSections(["; + if (IsBySteps) { + pyDump << " = geompy.MakePipeWithDifferentSectionsBySteps(["; + } else { + pyDump << " = geompy.MakePipeWithDifferentSections(["; + } for(i =1 ; i <= nbBases; i++) { @@ -1962,7 +1972,11 @@ Handle(TColStd_HSequenceOfTransient) } } - pyDump<< "], "<GetInteger(PIPEDS_ARG_WITHCORRECT); } + void SetIsBySteps (int IsBySteps) + { _func->SetInteger(PIPEDS_ARG_BY_STEPS, IsBySteps); } + + int GetIsBySteps() + { return _func->GetInteger(PIPEDS_ARG_BY_STEPS); } + }; #endif diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 31f53f873..cf660675f 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -43,8 +43,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -686,6 +688,42 @@ static void FindFirstPairFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2, FS2 = Fs(numface); } +//======================================================================= +//function : RemoveFaces +//purpose : This function returns theShapeFrom without faces of the shape +// theFacesToRm. It returns a shell if theShapeFrom is a solid or +// a compound otherwise. Auxilary for CreatePipeWithDifferentSections +// method. +//======================================================================= +static TopoDS_Shape RemoveFaces(const TopoDS_Shape &theShapeFrom, + const TopoDS_Shape &theFacesToRm) +{ + TopTools_IndexedMapOfShape aMapFaces; + TopExp_Explorer anExp(theShapeFrom, TopAbs_FACE); + BRep_Builder aBuilder; + TopoDS_Shape aResult; + + if (theShapeFrom.ShapeType() == TopAbs_SOLID) { + // Create shell + aBuilder.MakeShell(TopoDS::Shell(aResult)); + } else { + // Create compound + aBuilder.MakeCompound(TopoDS::Compound(aResult)); + } + + TopExp::MapShapes(theFacesToRm, TopAbs_FACE, aMapFaces); + + for (; anExp.More(); anExp.Next()) { + const TopoDS_Shape &aFace = anExp.Current(); + + if (!aMapFaces.Contains(aFace)) { + aBuilder.Add(aResult, aFace); + } + } + + return aResult; +} + //======================================================================= //function : CreatePipeWithDifferentSections //purpose : @@ -696,6 +734,7 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections const Handle(TopTools_HSequenceOfShape) theHSeqLocs, const Standard_Boolean theWithContact, const Standard_Boolean theWithCorrect, + const Standard_Boolean IsBySteps, Handle(TColStd_HArray1OfInteger) *theGroups) { TopoDS_Shape aShape; @@ -883,49 +922,82 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections } } - // check curvature of wire for condition that - // max summary angle between directions along - // wire path must be < 4*PI. If not - split wire - // and seguences of shapes, perform pipe for each - // and make sewing after that - double fp,lp; - gp_Pnt P1,P2; - gp_Vec Vec1,Vec2; - double SumAng = 0; - if ( Edges.Length() > 0 ) { - Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp); - C->D1(fp,P1,Vec1); - C->D1(lp,P2,Vec2); - SumAng = fabs(Vec1.Angle(Vec2)); - Vec1 = Vec2; - P1 = P2; - } TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums; - int LastLoc = 1; - //cout<<"Edges.Length()="<D1(lp,P2,Vec2); - double ang = fabs(Vec1.Angle(Vec2)); - SumAng += ang; - if (SumAng>4*M_PI) { - SumAng = ang; - SplitEdgeNums.Append(i-1); - int j; - for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) { - TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j)); - gp_Pnt P = BRep_Tool::Pnt(aVert); - if (P1.Distance(P) < tol) { - SplitLocNums.Append(j); - LastLoc = j; - break; - } + + if (IsBySteps) { + // Fill SplitEdgeNums and SplitLocNums with intermediate location indices + // and corresponding edge indices. + Standard_Integer i = 1; + Standard_Integer j; + TopoDS_Vertex aVert; + gp_Pnt aP; + + for (j = 2; j < aSeqLocs.Length(); j++) { + SplitLocNums.Append(j); + aVert = TopoDS::Vertex(aSeqLocs.Value(j)); + aP = BRep_Tool::Pnt(aVert); + + while (i < Edges.Length()) { + Standard_Real aFp; + Standard_Real aLp; + TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i)); + Standard_Real aTol = BRep_Tool::Tolerance(anEdge); + Handle(Geom_Curve) aC = BRep_Tool::Curve(anEdge, aFp, aLp); + gp_Pnt aPLast; + + aC->D0(aLp, aPLast); + i++; + + if (aP.Distance(aPLast) < aTol) { + SplitEdgeNums.Append(i - 1); + break; } } + } + } else { + // check curvature of wire for condition that + // max summary angle between directions along + // wire path must be < 4*PI. If not - split wire + // and seguences of shapes, perform pipe for each + // and make sewing after that + double fp,lp; + gp_Pnt P1,P2; + gp_Vec Vec1,Vec2; + double SumAng = 0; + if ( Edges.Length() > 0 ) { + Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp); + C->D1(fp,P1,Vec1); + C->D1(lp,P2,Vec2); + SumAng = fabs(Vec1.Angle(Vec2)); Vec1 = Vec2; P1 = P2; + } + int LastLoc = 1; + //cout<<"Edges.Length()="<D1(lp,P2,Vec2); + double ang = fabs(Vec1.Angle(Vec2)); + SumAng += ang; + if (SumAng>4*M_PI) { + SumAng = ang; + SplitEdgeNums.Append(i-1); + int j; + for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) { + TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j)); + gp_Pnt P = BRep_Tool::Pnt(aVert); + if (P1.Distance(P) < tol) { + SplitLocNums.Append(j); + LastLoc = j; + break; + } + } + } + Vec1 = Vec2; + P1 = P2; + } } bool isCreateGroups = (theGroups != NULL); @@ -966,9 +1038,24 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); } - BuildPipeShell(aBuilder); + Standard_Boolean isDone = BuildPipeShell(aBuilder); + + if (isDone && NeedCreateSolid && nn == 1) { + // Make solid for the first step. + isDone = aBuilder.MakeSolid(); + } + + if (!isDone) { + Standard_ConstructionError::Raise("Pipe construction failure"); + } TopoDS_Shape resShape = aBuilder.Shape(); + + if (NeedCreateSolid && nn == 1) { + // Remove top lid from the result. + resShape = RemoveFaces(resShape, aBuilder.LastShape()); + } + aSeqRes.Append(resShape); // Create groups. @@ -1014,9 +1101,23 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); } - BuildPipeShell(aBuilder); + Standard_Boolean isDone = BuildPipeShell(aBuilder); + + if (isDone && NeedCreateSolid) { + isDone = aBuilder.MakeSolid(); + } + + if (!isDone) { + Standard_ConstructionError::Raise("Pipe construction failure"); + } TopoDS_Shape resShape = aBuilder.Shape(); + + if (NeedCreateSolid) { + // Remove bottom lid from the result. + resShape = RemoveFaces(resShape, aBuilder.FirstShape()); + } + aSeqRes.Append(resShape); // Create groups. @@ -1046,6 +1147,28 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections aSewing->Perform(); aShape = aSewing->SewedShape(); + if (NeedCreateSolid && aShape.ShapeType() == TopAbs_SHELL) { + // Build a solid. + BRepBuilderAPI_MakeSolid aMkSolid; + + aMkSolid.Add(TopoDS::Shell(aShape)); + + if (!aMkSolid.IsDone()) { + Standard_ConstructionError::Raise("Can't create solid pipe"); + } + + TopoDS_Solid aSolid = aMkSolid.Solid(); + BRepClass3d_SolidClassifier aSC(aSolid); + + aSC.PerformInfinitePoint(Precision::Confusion()); + + if (aSC.State() == TopAbs_IN) { + aShape = aSolid.Reversed(); + } else { + aShape = aSolid; + } + } + if (isCreateGroups) { // Replase Group shapes by modified ones. TopTools_SequenceOfShape aSeqGroups[5]; @@ -3032,6 +3155,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations (); Standard_Boolean aWithContact = (aCIDS->GetWithContactMode()); Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode()); + Standard_Boolean isBySteps = aCIDS->GetIsBySteps(); if (aCI) { delete aCI; @@ -3079,7 +3203,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const aShape = CreatePipeWithDifferentSections (aWirePath, aHSeqBases, aHSeqLocs, - aWithContact, aWithCorrect, pGroups); + aWithContact, aWithCorrect, isBySteps, pGroups); if (isGenerateGroups) { // Store created groups. @@ -3265,8 +3389,13 @@ GetCreationInformation(std::string& theOperationName, AddParam( theParams, "Bases", aCI.GetBases() ); AddParam( theParams, "Locations", aCI.GetLocations() ); AddParam( theParams, "Path", aCI.GetPath() ); - AddParam( theParams, "With contact", aCI.GetWithContactMode() ); - AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() ); + + if (!aCI.GetIsBySteps()) { + AddParam( theParams, "With contact", aCI.GetWithContactMode() ); + AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() ); + } + + AddParam( theParams, "Step by step", aCI.GetIsBySteps() ); break; } case PIPE_SHELL_SECTIONS: diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx index 3a4deca6f..767536946 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx @@ -88,6 +88,7 @@ public: const Handle(TopTools_HSequenceOfShape) theLocs, const Standard_Boolean theWithContact, const Standard_Boolean theWithCorrect, + const Standard_Boolean IsBySteps, Handle(TColStd_HArray1OfInteger) *theGroups = NULL); Standard_EXPORT virtual diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx index 52f6d2109..48e5353ea 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -351,7 +351,8 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeScaledPrism (const TopoDS_Shape& theShape aLocs->Append(aShapeCDG_1); aLocs->Append(aShapeCDG_2); - aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections(aWirePath, aBases, aLocs, false, false); + aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections + (aWirePath, aBases, aLocs, false, false, false); // 7. Make a solid, if possible if (theShapeBase.ShapeType() == TopAbs_FACE) { diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 3d5969f71..41b415ded 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -987,6 +987,7 @@ GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections GEOM::GEOM_Object_ptr thePath, CORBA::Boolean theWithContact, CORBA::Boolean theWithCorrections, + CORBA::Boolean IsBySteps, CORBA::Boolean IsGenerateGroups) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; @@ -1029,7 +1030,7 @@ GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections GetOperations()->MakePipeWithDifferentSections (aSeqBases, aSeqLocations, aPath, theWithContact, - theWithCorrections, IsGenerateGroups); + theWithCorrections, IsBySteps, IsGenerateGroups); if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index d5d8ea847..3fe2951eb 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -186,6 +186,7 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr thePath, CORBA::Boolean theWithContact, CORBA::Boolean theWithCorrections, + CORBA::Boolean IsBySteps, CORBA::Boolean IsGenerateGroups); GEOM::ListOfGO* MakePipeWithShellSections diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index bfd598ad5..449a3c6b8 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1512,7 +1512,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections beginService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections"); get3DPrimOp(); - GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false); + GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false, false); endService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); return aList[0]; } diff --git a/src/GEOM_PY/structelem/parts.py b/src/GEOM_PY/structelem/parts.py index 5ab2f2474..ae1e59d0f 100644 --- a/src/GEOM_PY/structelem/parts.py +++ b/src/GEOM_PY/structelem/parts.py @@ -361,7 +361,8 @@ class Beam(StructuralElementPart): face2 = self.geom.MakeFace(wire2, True) shell = self.geom.MakePipeWithDifferentSections([wire1, wire2], [point1, point2], - path, False, False) + path, False, False, + False) closedShell = self.geom.MakeShell([face1, face2, shell]) solid = self.geom.MakeSolid([closedShell]) return solid diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index 0e8257dec..d0eba918c 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -4037,7 +4037,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases, theLocations, thePath, theWithContact, theWithCorrection, - IsGenerateGroups) + False, IsGenerateGroups) RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp) if IsGenerateGroups: @@ -4047,6 +4047,43 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): self._autoPublish(aList[0], theName, "pipe") return aList[0] + ## Create a shape by extrusion of the profile shape along + # the path shape. This function is a version of + # MakePipeWithShellSections() with the same parameters, except + # eliminated theWithContact and theWithCorrection. So it is + # possible to find the description of all parameters is in this + # method. The difference is that this method performs the operation + # step by step, i.e. it creates pipes between each pair of neighbor + # sections and fuses them into a single shape. + # + # @ref tui_creation_pipe_with_diff_sec "Example" + @ManageTransactions("PrimOp") + def MakePipeWithDifferentSectionsBySteps(self, theSeqBases, + theLocations, thePath, + IsGenerateGroups=False, theName=None): + """ + Create a shape by extrusion of the profile shape along + the path shape. This function is a version of + MakePipeWithShellSections() with the same parameters, except + eliminated theWithContact and theWithCorrection. So it is + possible to find the description of all parameters is in this + method. The difference is that this method performs the operation + step by step, i.e. it creates pipes between each pair of neighbor + sections and fuses them into a single shape. + """ + aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases, + theLocations, thePath, + False, False, + True, IsGenerateGroups) + RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp) + + if IsGenerateGroups: + self._autoPublish(aList, theName, "pipe") + return aList + + self._autoPublish(aList[0], theName, "pipe") + return aList[0] + ## Create a shape by extrusion of the profile shape along # the path shape. The path shape can be a wire or an edge. # the several profiles can be specified in the several locations of path. diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 33b43b09f..703fe5ede 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -50,13 +50,14 @@ //================================================================================= GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl), - myGenGroupCheckGP (0), - myPrefixLblGP (0), - myPrefixEditGP (0), - myGenGroupCheckGMP (0), - myPrefixLblGMP (0), - myPrefixEditGMP (0) + : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl), + myGenGroupCheckGP (0), + myPrefixLblGP (0), + myPrefixEditGP (0), + myStepByStepCheckGMP (0), + myGenGroupCheckGMP (0), + myPrefixLblGMP (0), + myPrefixEditGMP (0) { QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); @@ -124,15 +125,18 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg // Add widgets for group generation QGridLayout *aLayoutGMP = (QGridLayout *)GroupMakePoints->GroupBox1->layout(); - myGenGroupCheckGMP = + myStepByStepCheckGMP = + new QCheckBox(tr("GEOM_STEP_BY_STEP"), GroupMakePoints->GroupBox1); + myGenGroupCheckGMP = new QCheckBox(tr("GEOM_GENERATE_GROUPS"), GroupMakePoints->GroupBox1); - myPrefixLblGMP = + myPrefixLblGMP = new QLabel (tr("GEOM_GROUP_NAME_PREFIX"), GroupMakePoints->GroupBox1); - myPrefixEditGMP = new QLineEdit(GroupMakePoints->GroupBox1); + myPrefixEditGMP = new QLineEdit(GroupMakePoints->GroupBox1); - aLayoutGMP->addWidget(myGenGroupCheckGMP, 8, 0, 1, 3); - aLayoutGMP->addWidget(myPrefixLblGMP, 9, 0, 1, 2); - aLayoutGMP->addWidget(myPrefixEditGMP, 9, 2); + aLayoutGMP->addWidget(myStepByStepCheckGMP, 8, 0, 1, 3); + aLayoutGMP->addWidget(myGenGroupCheckGMP, 9, 0, 1, 3); + aLayoutGMP->addWidget(myPrefixLblGMP, 10, 0, 1, 2); + aLayoutGMP->addWidget(myPrefixEditGMP, 10, 2); QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); @@ -201,8 +205,10 @@ void GenerationGUI_PipeDlg::Init() connect(GroupMakePoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupMakePoints->CheckBox1, SIGNAL(clicked()), this, SLOT(processPreview())); connect(GroupMakePoints->CheckBox2, SIGNAL(clicked()), this, SLOT(processPreview())); - connect(myGenGroupCheckGP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); - connect(myGenGroupCheckGMP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); + connect(myStepByStepCheckGMP, SIGNAL(clicked()), this, SLOT(processPreview())); + connect(myGenGroupCheckGP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); + connect(myGenGroupCheckGMP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); + connect(myStepByStepCheckGMP, SIGNAL(toggled(bool)), this, SLOT(StepByStepClicked(bool))); initName(tr("GEOM_PIPE")); resize(100,100); @@ -250,6 +256,7 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId ) GroupPoints->hide(); GroupMakePoints->show(); GroupMakePoints->PushButton1->click(); + myStepByStepCheckGMP->setChecked(false); myGenGroupCheckGMP->setChecked(false); resetGenGroup(myGenGroupCheckGMP, false, true); break; @@ -583,10 +590,16 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects) myGenGroupCheckGMP->isChecked(); } + bool isWithContact = GroupMakePoints->CheckBox1->isEnabled() && + GroupMakePoints->CheckBox1->isChecked(); + bool isWithCorrection = GroupMakePoints->CheckBox2->isEnabled() && + GroupMakePoints->CheckBox2->isChecked(); + aList = anOper->MakePipeWithDifferentSections - (myBaseGO.in(), myLocationsGO.in(), myPath.get(), - GroupMakePoints->CheckBox1->isChecked(), - GroupMakePoints->CheckBox2->isChecked(), doGroups); + (myBaseGO.in(), myLocationsGO.in(), myPath.get(), + isWithContact, isWithCorrection, + myStepByStepCheckGMP->isChecked(), + doGroups); if (aList->length() > 0) { if (doGroups) { @@ -706,6 +719,16 @@ void GenerationGUI_PipeDlg::GenGroupClicked(bool isChecked) resetGenGroup((QCheckBox *)sender(), isChecked, false); } +//================================================================================= +// function : StepByStepClicked +// purpose : Slot to treat checking "Step-by-step generation" check box. +//================================================================================= +void GenerationGUI_PipeDlg::StepByStepClicked(bool isChecked) +{ + GroupMakePoints->CheckBox1->setEnabled(!isChecked); + GroupMakePoints->CheckBox2->setEnabled(!isChecked); +} + //================================================================================= // function : updateGenGroup // purpose : Update "Generate groups" widgets depending on the path. diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index 4b2d88efd..341fb18f4 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -81,6 +81,7 @@ private: QCheckBox *myGenGroupCheckGP; QLabel *myPrefixLblGP; QLineEdit *myPrefixEditGP; + QCheckBox *myStepByStepCheckGMP; QCheckBox *myGenGroupCheckGMP; QLabel *myPrefixLblGMP; QLineEdit *myPrefixEditGMP; @@ -95,6 +96,7 @@ private slots: void ConstructorsClicked( int ); void SelectionTypeButtonClicked(); void GenGroupClicked(bool); + void StepByStepClicked(bool); }; #endif // GENERATIONGUI_PIPEDLG_H