From c70ace7ea8a8fdd8fa27845c6f52c7d789793bc9 Mon Sep 17 00:00:00 2001 From: skl Date: Wed, 2 May 2007 12:58:30 +0000 Subject: [PATCH] Updated for PAL14857. --- idl/GEOM_Gen.idl | 2 +- src/GEOMImpl/GEOMImpl_PipeDriver.cxx | 121 ++++++++++++++++++++++++++- src/GEOM_SWIG/geompy.py | 2 +- 3 files changed, 120 insertions(+), 5 deletions(-) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 05c9fe46f..14d89e121 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -896,7 +896,7 @@ module GEOM * \param theSeqSubBases - list of corresponding subshapes of section shapes. * \param theLocations - list of locations on the path corresponding * specified list of the Bases shapes. Number of locations - * should be equal to number of bases or list of locations can be empty. + * should be equal to number of bases. * \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. diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index b14de152b..999117942 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -423,6 +423,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, Standard_ConstructionError::Raise ("First location shapes is not coincided with first vertex of aWirePath"); } + VLocs.ChangeValue(1) = VF; edge = TopoDS::Edge(Edges.Last()); tol = BRep_Tool::Tolerance(edge); TopoDS_Vertex VL = sae.LastVertex(edge); @@ -432,6 +433,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, Standard_ConstructionError::Raise ("Last location shapes is not coincided with last vertex of aWirePath"); } + VLocs.ChangeValue(nbLocs) = VL; int jcurr = 2; TopTools_SequenceOfShape tmpEdges; for(i=1; i<=Edges.Length() && jcurrD0(fp,Pfp); + if(Pfp.Distance(P1)(aCI); - BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + //BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases (); Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations (); Standard_Boolean aWithContact = (aCIDS->GetWithContactMode()); @@ -1069,6 +1074,116 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const } nbLocs = aSeqLocs.Length(); + + // skl 02.05.2007 + if(nbLocs>0) { + // we have to check that each location shape is a vertex from + // path and update aSeqLocs if it is needed (and possible) + TColgp_SequenceOfPnt PLocs; + for(i=1; i<=nbLocs; i++) { + TopoDS_Vertex V = TopoDS::Vertex(aSeqLocs.Value(i)); + PLocs.Append(BRep_Tool::Pnt(V)); + } + TopTools_SequenceOfShape Edges; + TopExp_Explorer anExp; + for ( anExp.Init( aWirePath, TopAbs_EDGE ); anExp.More(); anExp.Next() ) { + Edges.Append(anExp.Current()); + } + int nbEdges = Edges.Length(); + ShapeAnalysis_Edge sae; + TopoDS_Edge edge = TopoDS::Edge(Edges.First()); + double tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VF = sae.FirstVertex(edge); + gp_Pnt PF = BRep_Tool::Pnt(VF); + //cout<<"PF("< tol ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise + ("First location shapes is not coincided with first vertex of aWirePath"); + } + aSeqLocs.ChangeValue(1) = VF; + edge = TopoDS::Edge(Edges.Last()); + tol = BRep_Tool::Tolerance(edge); + TopoDS_Vertex VL = sae.LastVertex(edge); + gp_Pnt PL = BRep_Tool::Pnt(VL); + if( PL.Distance(PLocs.Last()) > tol ) { + if(aCI) delete aCI; + Standard_ConstructionError::Raise + ("Last location shapes is not coincided with last vertex of aWirePath"); + } + aSeqLocs.ChangeValue(nbLocs) = VL; + int jcurr = 2; + for(i=1; i<=Edges.Length() && jcurr0 && + PLocs.Value(jcurr).Distance(PPC.Point(1)) < tol ) { + double param = PPC.Parameter(1); + gp_Pnt PC1; + C->D0(param,PC1); + // split current edge + Handle(Geom_TrimmedCurve) tc1 = new Geom_TrimmedCurve(C,fp,param); + Handle(Geom_TrimmedCurve) tc2 = new Geom_TrimmedCurve(C,param,lp); + TopoDS_Edge E1,E2; + BRep_Builder B; + gp_Pnt Pfp; + C->D0(fp,Pfp); + if(Pfp.Distance(P1) we have to update WirePath + BRep_Builder B; + TopoDS_Wire W; + B.MakeWire(W); + for(i=1; i<=Edges.Length(); i++) { + B.Add(W,TopoDS::Edge(Edges.Value(i))); + } + aWirePath = W; + } + } + + BRepOffsetAPI_MakePipeShell aBuilder(aWirePath); + Standard_Integer nbShapes = aSeqBases.Length(); Standard_Integer step = nbShapes/nbBases; diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 089a39c6b..d99b53dbb 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -747,7 +747,7 @@ def MakePipeWithDifferentSections(theSeqBases, theLocations,thePath,theWithConta # @param theSeqSubBases - list of corresponding subshapes of section shapes. # @param theLocations - list of locations on the path corresponding # specified list of the Bases shapes. Number of locations -# should be equal to number of bases or list of locations can be empty. +# should be equal to number of bases. # @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. -- 2.39.2