1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

OCC22361 Incorrect result of BRepOffsetAPI_MakePipeShell algorithm: it tries to build conical surface between two non-coaxial circles

This commit is contained in:
JGV 2011-04-28 15:43:38 +00:00 committed by bugmaster
parent e520f87c1c
commit d73257411c
5 changed files with 36 additions and 20 deletions

View File

@ -13,6 +13,7 @@
#include <BRepLib_FindSurface.hxx>
#include <BRepLib_MakeWire.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepCheck_Wire.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
@ -827,7 +828,9 @@ void BRepFill_CompatibleWires::
Standard_Boolean allClosed = Standard_True;
Standard_Integer i,ii,ideb=1,ifin=NbSects;
for (i=1; i<=NbSects; i++) {
allClosed = (allClosed && myWork(i).Closed());
Handle(BRepCheck_Wire) Checker = new BRepCheck_Wire(TopoDS::Wire(myWork(i)));
allClosed = (allClosed && (Checker->Closed() == BRepCheck_NoError));
//allClosed = (allClosed && myWork(i).Closed());
}
if (!allClosed)
Standard_NoSuchObject::Raise("BRepFill_CompatibleWires::SameNumberByPolarMethod : the wires must be closed");

View File

@ -14,6 +14,7 @@ class NSections from BRepFill inherits SectionLaw from BRepFill
uses
SectionLaw from GeomFill,
HArray1OfSectionLaw from GeomFill,
SequenceOfTrsf from GeomFill,
BSplineSurface from Geom,
HArray2OfShape from TopTools,
SequenceOfReal from TColStd,
@ -32,6 +33,7 @@ is
returns NSections from BRepFill;
Create (S : SequenceOfShape from TopTools;
Trsfs : SequenceOfTrsf from GeomFill;
P : SequenceOfReal from TColStd;
VF,VL : Real;
Build : Boolean = Standard_True)
@ -79,6 +81,7 @@ is
fields
VFirst, VLast : Real;
myShapes: SequenceOfShape from TopTools;
myTrsfs: SequenceOfTrsf from GeomFill;
myParams: SequenceOfReal from TColStd;
myEdges: HArray2OfShape from TopTools;
mySurface: BSplineSurface from Geom;

View File

@ -363,6 +363,7 @@ BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
//=======================================================================
BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
const GeomFill_SequenceOfTrsf& Transformations,
const TColStd_SequenceOfReal & P,
const Standard_Real VF,
const Standard_Real VL,
@ -389,6 +390,7 @@ BRepFill_NSections::BRepFill_NSections(const TopTools_SequenceOfShape& S,
if (ok) {
myParams = P;
myShapes = S;
myTrsfs = Transformations;
VFirst = VF;
VLast = VL;
Init(P,Build);
@ -434,7 +436,6 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
// if (! B.Degenerated(wexp.Current())) NbEdge++;
if (! BRep_Tool::Degenerated(wexp.Current())) NbEdge++;
myEdges = new (TopTools_HArray2OfShape) (1, NbEdge, 1, NbSects);
// On Remplit les tables
@ -580,7 +581,7 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
Standard_Real Ufirst = ii-1;
Standard_Real Ulast = ii;
myLaws->ChangeValue(ii) = new (GeomFill_NSections)(NC,myParams,
myLaws->ChangeValue(ii) = new (GeomFill_NSections)(NC, myTrsfs, myParams,
Ufirst,Ulast,
VFirst,VLast,
mySurface);
@ -724,7 +725,7 @@ void BRepFill_NSections::Init(const TColStd_SequenceOfReal & P,
for (Standard_Integer jj=1; jj<=myShapes.Length(); jj++) {
NCompo.Append(mySurface->VIso(myParams(jj)));
}
Law = new (GeomFill_NSections)(NCompo, myParams,
Law = new (GeomFill_NSections)(NCompo, myTrsfs, myParams,
Ufirst, Ulast,
Vfirst, Vlast,
mySurface);

View File

@ -11,6 +11,7 @@ class PipeShell from BRepFill inherits TShared from MMgt
uses
Dir from gp,
Ax2 from gp,
Trsf from gp,
Function from Law,
ListOfShape from TopTools,
HArray2OfShape from TopTools,
@ -236,6 +237,7 @@ is
Place(me : mutable;
Sec : Section from BRepFill;
W : out Wire from TopoDS;
Trsf : out Trsf from gp;
param : out Real from Standard) is private;
ResetLoc(me : mutable) is private;

View File

@ -101,8 +101,8 @@ static Standard_Boolean ComputeSection(const TopoDS_Wire& W1,
CW.SetPercent(0.1);
CW.Perform();
if (!CW.IsDone()) StdFail_NotDone::Raise("Uncompatible wires");
Handle(BRepFill_NSections) SL = new (BRepFill_NSections) (CW.Shape(),SR,0.,1.)
;
GeomFill_SequenceOfTrsf EmptyTrsfs;
Handle(BRepFill_NSections) SL = new (BRepFill_NSections) (CW.Shape(),EmptyTrsfs,SR,0.,1.);
Standard_Real US = p1/(p1+p2);
SL->D0(US, Wres);
return Standard_True;
@ -831,7 +831,8 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape,
// Construction de la loi de section
if (mySeq.Length() == 1) {
Standard_Real p1;
Place(mySeq(1), theSect,p1);
gp_Trsf aTrsf;
Place(mySeq(1), theSect, aTrsf, p1);
TopoDS_Wire aLocalShape = theSect;
if (mySeq(1).IsLaw())
mySection = new BRepFill_ShapeLaw(aLocalShape, myLaw);
@ -844,9 +845,11 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape,
{
TColStd_SequenceOfReal Param;
TopTools_SequenceOfShape WSeq;
WSeq.Clear();
Param.Clear();
GeomFill_SequenceOfTrsf Transformations;
//WSeq.Clear();
//Param.Clear();
Standard_Integer NbL = myLocation->NbLaw();
gp_Trsf aTrsf;
Standard_Real V1, V2, param;
myLocation->CurvilinearBounds(NbL, V1, V2);
V1 = 0.;
@ -854,10 +857,11 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape,
// for (Standard_Integer iseq=1;iseq<=mySeq.Length();iseq++) {
Standard_Integer iseq;
for (iseq=1;iseq<=mySeq.Length();iseq++) {
Place(mySeq(iseq), theSect, param);
Place(mySeq(iseq), theSect, aTrsf, param);
Param.Append(param);
WSeq.Append(theSect);
// WSeq.Append(TopoDS::Wire(theSect));
Transformations.Append(aTrsf);
if (param==V1) ideb = iseq;
if (param==V2) ifin = iseq;
}
@ -949,7 +953,7 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape,
else {
Standard_ConstructionError::Raise("PipeShell : uncompatible wires");
}
mySection = new (BRepFill_NSections) (WorkingSections,Param,V1,V2);
mySection = new (BRepFill_NSections) (WorkingSections,Transformations,Param,V1,V2);
}// else
@ -983,6 +987,7 @@ void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape,
//=======================================================================
void BRepFill_PipeShell::Place(const BRepFill_Section& Sec,
TopoDS_Wire& W,
gp_Trsf& aTrsf,
Standard_Real& param)
{
BRepFill_SectionPlacement Place(myLocation,
@ -991,6 +996,7 @@ void BRepFill_PipeShell::Place(const BRepFill_Section& Sec,
Sec.WithContact(),
Sec.WithCorrection());
W = Sec.Wire();
aTrsf = Place.Transformation();
TopLoc_Location Loc2(Place.Transformation()), Loc1;
Loc1 = W.Location();
W.Location(Loc2.Multiplied(Loc1));
@ -1147,11 +1153,12 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
if(!mySeq.IsEmpty()) {
Standard_Integer iseq;
TopoDS_Wire aSect;
gp_Trsf aTrsf;
Standard_Real param = 0., aparmin = RealLast(), aparmax = -RealLast();
Standard_Integer ideb = 1, ifin = mySeq.Length();
for (iseq = 1;iseq <= mySeq.Length(); iseq++) {
Place(mySeq(iseq), aSect, param);
Place(mySeq(iseq), aSect, aTrsf, param);
if(param < aparmin) {
ideb = iseq;