1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

First version (without tangential neighbors)

This commit is contained in:
jgv
2017-08-08 20:57:12 +03:00
parent 82af2baefa
commit 936b6e5f88
14 changed files with 587 additions and 151 deletions

View File

@@ -264,10 +264,10 @@ static void RemovePendingEdges(TopTools_IndexedDataMapOfShapeListOfShape& MVE)
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Boolean SamePnt2d(TopoDS_Vertex V, static Standard_Boolean SamePnt2d(const TopoDS_Vertex& V,
TopoDS_Edge& E1, const TopoDS_Edge& E1,
TopoDS_Edge& E2, const TopoDS_Edge& E2,
TopoDS_Face& F) const TopoDS_Face& F)
{ {
Standard_Real f1,f2,l1,l2; Standard_Real f1,f2,l1,l2;
gp_Pnt2d P1,P2; gp_Pnt2d P1,P2;
@@ -649,6 +649,7 @@ void BRepAlgo_Loop::Perform()
//-------------------------------------------------- //--------------------------------------------------
// Add new wire to the set of wires // Add new wire to the set of wires
//------------------------------------------------ //------------------------------------------------
/*
Standard_Real Tol = 0.001; //5.e-05; //5.e-07; Standard_Real Tol = 0.001; //5.e-05; //5.e-07;
TopExp_Explorer explo( NW, TopAbs_VERTEX ); TopExp_Explorer explo( NW, TopAbs_VERTEX );
for (; explo.More(); explo.Next()) for (; explo.More(); explo.Next())
@@ -665,6 +666,7 @@ void BRepAlgo_Loop::Perform()
TE->Tolerance( Tol ); TE->Tolerance( Tol );
TE->Modified( Standard_True ); TE->Modified( Standard_True );
} }
*/
if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace)) if (VF.IsSame(CV) && SamePnt2d(VF,EF,CE,myFace))
{ {

View File

@@ -78,6 +78,7 @@
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx> #include <BOPCol_ListOfShape.hxx>
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
#include <Extrema_ExtPC2d.hxx>
#include <stdio.h> #include <stdio.h>
#ifdef DRAW #ifdef DRAW
@@ -496,6 +497,9 @@ static void RefEdgeInter(const TopoDS_Face& F,
const BRepAdaptor_Surface& BAsurf, const BRepAdaptor_Surface& BAsurf,
const TopoDS_Edge& E1, const TopoDS_Edge& E1,
const TopoDS_Edge& E2, const TopoDS_Edge& E2,
const TopoDS_Vertex& Vref,
const Standard_Boolean IsConstantE1,
const Standard_Boolean IsConstantE2,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
Standard_Real Tol, Standard_Real Tol,
Standard_Boolean WithOri, Standard_Boolean WithOri,
@@ -545,125 +549,170 @@ static void RefEdgeInter(const TopoDS_Face& F,
Standard_Boolean WithDegen = BRep_Tool::Degenerated(E1) || BRep_Tool::Degenerated(E2); Standard_Boolean WithDegen = BRep_Tool::Degenerated(E1) || BRep_Tool::Degenerated(E2);
if (WithDegen) if (WithDegen)
{
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2;
TopoDS_Iterator iter( EI[ideg] );
if (iter.More())
{ {
Standard_Integer ideg = (BRep_Tool::Degenerated(E1))? 1 : 2; const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
TopoDS_Iterator iter( EI[ideg] ); DegPoint = BRep_Tool::Pnt(vdeg);
if (iter.More())
{
const TopoDS_Vertex& vdeg = TopoDS::Vertex(iter.Value());
DegPoint = BRep_Tool::Pnt(vdeg);
}
else
{
BRepAdaptor_Curve CEdeg( EI[ideg], F );
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
} }
else
{
BRepAdaptor_Curve CEdeg( EI[ideg], F );
DegPoint = CEdeg.Value( CEdeg.FirstParameter() );
}
}
// //
Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]); Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]); Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]); Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]);
Geom2dAdaptor_Curve GAC2(pcurve2, f[2], l[2]); Geom2dAdaptor_Curve GAC2(pcurve2, f[2], l[2]);
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
// //
if (!Inter2d.IsDone() || !Inter2d.NbPoints()) { if (!Vref.IsNull())
theCoincide = (Inter2d.NbSegments() && {
(GAC1.GetType() == GeomAbs_Line) && gp_Pnt P3d = BRep_Tool::Pnt(Vref);
(GAC2.GetType() == GeomAbs_Line)); ResPoints.Append( P3d );
return; Standard_Real ParOnFirst, ParOnSecond;
if (IsConstantE1 && IsConstantE2)
{
ParOnFirst = BRep_Tool::Parameter(Vref, E1);
ParOnSecond = BRep_Tool::Parameter(Vref, E2);
}
else if (IsConstantE1)
{
ParOnFirst = BRep_Tool::Parameter(Vref, E1);
gp_Pnt2d aPnt2d = BRep_Tool::Parameters(Vref, F);
//Handle(Geom2d_Curve) pcurve2 = BRep_Tool::CurveOnSurface(E2, F, f[2], l[2]);
//Geom2dAdaptor_Curve GAC2(pcurve2, f[2], l[2]);
Extrema_ExtPC2d Projector(aPnt2d, GAC2);
Standard_Integer imin = 1;
for (Standard_Integer i = 2; i <= Projector.NbExt(); i++)
if (Projector.SquareDistance(i) < Projector.SquareDistance(imin))
imin = i;
ParOnSecond = Projector.Point(imin).Parameter();
}
else
{
ParOnSecond = BRep_Tool::Parameter(Vref, E2);
gp_Pnt2d aPnt2d = BRep_Tool::Parameters(Vref, F);
//Handle(Geom2d_Curve) pcurve1 = BRep_Tool::CurveOnSurface(E1, F, f[1], l[1]);
//Geom2dAdaptor_Curve GAC1(pcurve1, f[1], l[1]);
Extrema_ExtPC2d Projector(aPnt2d, GAC1);
Standard_Integer imin = 1;
for (Standard_Integer i = 2; i <= Projector.NbExt(); i++)
if (Projector.SquareDistance(i) < Projector.SquareDistance(imin))
imin = i;
ParOnFirst = Projector.Point(imin).Parameter();
}
ResParamsOnE1.Append( ParOnFirst );
ResParamsOnE2.Append( ParOnSecond );
} }
// else
for (i = 1; i <= Inter2d.NbPoints(); i++) {
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
//
if (!Inter2d.IsDone() || !Inter2d.NbPoints()) {
theCoincide = (Inter2d.NbSegments() &&
(GAC1.GetType() == GeomAbs_Line) &&
(GAC2.GetType() == GeomAbs_Line));
return;
}
//
for (i = 1; i <= Inter2d.NbPoints(); i++)
{ {
gp_Pnt P3d; gp_Pnt P3d;
if (WithDegen) if (WithDegen)
P3d = DegPoint; P3d = DegPoint;
else else
{ {
gp_Pnt2d P2d = Inter2d.Point(i).Value(); gp_Pnt2d P2d = Inter2d.Point(i).Value();
P3d = BAsurf.Value( P2d.X(), P2d.Y() ); P3d = BAsurf.Value( P2d.X(), P2d.Y() );
} }
ResPoints.Append( P3d ); ResPoints.Append( P3d );
ResParamsOnE1.Append( Inter2d.Point(i).ParamOnFirst() ); ResParamsOnE1.Append( Inter2d.Point(i).ParamOnFirst() );
ResParamsOnE2.Append( Inter2d.Point(i).ParamOnSecond() ); ResParamsOnE2.Append( Inter2d.Point(i).ParamOnSecond() );
} }
} //else (without Vref)
for (i = 1; i <= ResPoints.Length(); i++) for (i = 1; i <= ResPoints.Length(); i++)
{
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
{ {
Standard_Real aT1 = ResParamsOnE1(i); //ponc1.Parameter();
Standard_Real aT2 = ResParamsOnE2(i); //ponc2.Parameter();
if (Precision::IsInfinite(aT1) || Precision::IsInfinite(aT2))
{
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "Inter2d : Solution rejected due to infinite parameter"<<endl; cout << "Inter2d : Solution rejected due to infinite parameter"<<endl;
#endif #endif
continue; continue;
}
gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1);
gp_Pnt P2 = CE2.Value(aT2);
Standard_Real dist1, dist2, dist3;
dist1 = P1.Distance(P);
dist2 = P2.Distance(P);
dist3 = P1.Distance(P2);
dist1 = Max( dist1, dist2 );
dist1 = Max( dist1, dist3 );
B.UpdateVertex( aNewVertex, dist1 );
#ifdef OCCT_DEBUG
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<endl;
}
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<endl;
}
Standard_Real MilTol2 = 1000*Tol*Tol;
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
{
cout << "Inter2d : Solution rejected"<<endl;
cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<endl;
cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<endl;
cout<<"MaxDist = "<<dist1<<endl;
}
#endif
//define the orientation of a new vertex
TopAbs_Orientation OO1 = TopAbs_REVERSED;
TopAbs_Orientation OO2 = TopAbs_REVERSED;
if (WithOri)
{
BRepAdaptor_Curve2d PCE1( E1, F );
BRepAdaptor_Curve2d PCE2( E2, F );
gp_Pnt2d P2d1, P2d2;
gp_Vec2d V1, V2, V1or, V2or;
PCE1.D1( aT1, P2d1, V1 );
PCE2.D1( aT2, P2d2, V2 );
V1or = V1; V2or = V2;
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
Standard_Real CrossProd = V2or ^ V1;
#ifdef OCCT_DEBUG
if (Abs(CrossProd) <= gp::Resolution())
cout<<endl<<"CrossProd = "<<CrossProd<<endl;
#endif
if (CrossProd > 0.)
OO1 = TopAbs_FORWARD;
CrossProd = V1or ^ V2;
if (CrossProd > 0.)
OO2 = TopAbs_FORWARD;
}
LV1.Append( aNewVertex.Oriented(OO1) );
LV2.Append( aNewVertex.Oriented(OO2) );
} }
gp_Pnt P = ResPoints(i); //ponc1.Value();
TopoDS_Vertex aNewVertex = BRepLib_MakeVertex(P);
aNewVertex.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( aNewVertex, aT1, E1, Tol );
B.UpdateVertex( aNewVertex, aT2, E2, Tol );
gp_Pnt P1 = CE1.Value(aT1);
gp_Pnt P2 = CE2.Value(aT2);
Standard_Real dist1, dist2, dist3;
dist1 = P1.Distance(P);
dist2 = P2.Distance(P);
dist3 = P1.Distance(P2);
dist1 = Max( dist1, dist2 );
dist1 = Max( dist1, dist3 );
B.UpdateVertex( aNewVertex, dist1 );
#ifdef OCCT_DEBUG
if (aT1 < f[1]-Tol || aT1 > l[1]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT1 = "<<aT1<<", f[1] = "<<f[1]<<", l[1] = "<<l[1]<<endl;
}
if (aT2 < f[2]-Tol || aT2 > l[2]+Tol)
{
cout << "out of limit"<<endl;
cout<<"aT2 = "<<aT2<<", f[2] = "<<f[2]<<", l[2] = "<<l[2]<<endl;
}
Standard_Real MilTol2 = 1000*Tol*Tol;
if (P1.SquareDistance(P) > MilTol2 || P2.SquareDistance(P) > MilTol2 || P1.Distance(P2) > 2.*Tol)
{
cout << "Inter2d : Solution rejected"<<endl;
cout<<"P = "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<endl;
cout<<"P1 = "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z()<<endl;
cout<<"P2 = "<<P2.X()<<" "<<P2.Y()<<" "<<P2.Z()<<endl;
cout<<"MaxDist = "<<dist1<<endl;
}
#endif
//define the orientation of a new vertex
TopAbs_Orientation OO1 = TopAbs_REVERSED;
TopAbs_Orientation OO2 = TopAbs_REVERSED;
if (WithOri)
{
BRepAdaptor_Curve2d PCE1( E1, F );
BRepAdaptor_Curve2d PCE2( E2, F );
gp_Pnt2d P2d1, P2d2;
gp_Vec2d V1, V2, V1or, V2or;
PCE1.D1( aT1, P2d1, V1 );
PCE2.D1( aT2, P2d2, V2 );
V1or = V1; V2or = V2;
if (E1.Orientation() == TopAbs_REVERSED) V1or.Reverse();
if (E2.Orientation() == TopAbs_REVERSED) V2or.Reverse();
Standard_Real CrossProd = V2or ^ V1;
#ifdef OCCT_DEBUG
if (Abs(CrossProd) <= gp::Resolution())
cout<<endl<<"CrossProd = "<<CrossProd<<endl;
#endif
if (CrossProd > 0.)
OO1 = TopAbs_FORWARD;
CrossProd = V1or ^ V2;
if (CrossProd > 0.)
OO2 = TopAbs_FORWARD;
}
LV1.Append( aNewVertex.Oriented(OO1) );
LV2.Append( aNewVertex.Oriented(OO2) );
}
//---------------------------------- //----------------------------------
// Test at end. // Test at end.
@@ -1427,6 +1476,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
BRepOffset_Offset& OFI, BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build, const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset, const Standard_Real Offset,
const Standard_Real Tol, const Standard_Real Tol,
@@ -1467,6 +1517,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO)); if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
// //
BRepAdaptor_Surface BAsurf(FIO); BRepAdaptor_Surface BAsurf(FIO);
BRep_Builder BB;
TopExp_Explorer exp(FI.Oriented(TopAbs_FORWARD),TopAbs_WIRE); TopExp_Explorer exp(FI.Oriented(TopAbs_FORWARD),TopAbs_WIRE);
for (; exp.More(); exp.Next()) { for (; exp.More(); exp.Next()) {
@@ -1493,6 +1544,12 @@ void BRepOffset_Inter2d::ConnexIntByInt
TopoDS_Vertex Vref = CommonVertex(CurE, NextE); TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
gp_Pnt Pref = BRep_Tool::Pnt(Vref); gp_Pnt Pref = BRep_Tool::Pnt(Vref);
TopoDS_Vertex Vcommon;
Standard_Boolean IsConstantE1 = Standard_False, IsConstantE2 = Standard_False;
//Temporary : comment the following lines
if (MapConstantEdges.Contains(CurE) ||
MapConstantEdges.Contains(NextE))
Vcommon = Vref;
TopoDS_Shape aLocalShape = OFI.Generated(CurE); TopoDS_Shape aLocalShape = OFI.Generated(CurE);
TopoDS_Edge CEO = TopoDS::Edge(aLocalShape); TopoDS_Edge CEO = TopoDS::Edge(aLocalShape);
@@ -1502,7 +1559,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
// Inter processing of images of CurE NextE. // Inter processing of images of CurE NextE.
//------------------------------------------ //------------------------------------------
TopTools_ListOfShape LV1,LV2; TopTools_ListOfShape LV1,LV2;
Standard_Boolean DoInter = 1; Standard_Boolean DoInter = 1, ToExchange = Standard_False;
TopoDS_Shape NE1,NE2; TopoDS_Shape NE1,NE2;
if (Build.IsBound(CurE) && Build.IsBound(NextE)) { if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
@@ -1516,6 +1573,7 @@ void BRepOffset_Inter2d::ConnexIntByInt
else if (Build.IsBound(NextE) && MES.IsBound(CEO)) { else if (Build.IsBound(NextE) && MES.IsBound(CEO)) {
NE1 = Build(NextE); NE1 = Build(NextE);
NE2 = MES(CEO); NE2 = MES(CEO);
ToExchange = Standard_True;
} }
else { else {
DoInter = 0; DoInter = 0;
@@ -1530,8 +1588,35 @@ void BRepOffset_Inter2d::ConnexIntByInt
const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current()); const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current());
for (Exp2.Init(NE2, TopAbs_EDGE); Exp2.More(); Exp2.Next()) { for (Exp2.Init(NE2, TopAbs_EDGE); Exp2.More(); Exp2.Next()) {
const TopoDS_Edge& aE2 = TopoDS::Edge(Exp2.Current()); const TopoDS_Edge& aE2 = TopoDS::Edge(Exp2.Current());
RefEdgeInter(FIO, BAsurf, aE1, aE2, AsDes2d, if (!Vcommon.IsNull())
Tol, Standard_True, Pref, theDMVV, bCoincide); {
TopoDS_Edge ProE1 = CurE, ProE2 = NextE;
if (ToExchange)
{ ProE1 = NextE; ProE2 = CurE; }
if (MapConstantEdges.Contains(ProE1))
IsConstantE1 = Standard_True;
if (MapConstantEdges.Contains(ProE2))
IsConstantE2 = Standard_True;
if (IsConstantE1)
{
Standard_Real ParOnFirst = BRep_Tool::Parameter(Vcommon, ProE1, FI);
BB.UpdateVertex(Vcommon, ParOnFirst, aE1, 0.);
BRepAdaptor_Curve2d BAcurve2d(ProE1, FI);
gp_Pnt2d aPnt2d = BAcurve2d.Value(ParOnFirst);
BB.UpdateVertex(Vcommon, aPnt2d.X(), aPnt2d.Y(), FIO, 0.);
}
if (IsConstantE2)
{
Standard_Real ParOnSecond = BRep_Tool::Parameter(Vcommon, ProE2, FI);
BB.UpdateVertex(Vcommon, ParOnSecond, aE2, 0.);
BRepAdaptor_Curve2d BAcurve2d(ProE2, FI);
gp_Pnt2d aPnt2d = BAcurve2d.Value(ParOnSecond);
BB.UpdateVertex(Vcommon, aPnt2d.X(), aPnt2d.Y(), FIO, 0.);
}
}
RefEdgeInter(FIO, BAsurf, aE1, aE2,
Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
} }
} }
// //
@@ -1567,6 +1652,7 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
BRepOffset_Offset& OFI, BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build, const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol, const Standard_Real Tol,
@@ -1616,6 +1702,15 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
CurE = NextE; CurE = NextE;
continue; continue;
} }
TopoDS_Vertex Vcommon;
Standard_Boolean IsConstantE1 = Standard_False, IsConstantE2 = Standard_False;
/*
if (MapConstantEdges.Contains(CurE) ||
MapConstantEdges.Contains(NextE))
Vcommon = Vref;
*/
// //
TopoDS_Shape aLocalShape = OFI.Generated(CurE); TopoDS_Shape aLocalShape = OFI.Generated(CurE);
TopoDS_Edge CEO = TopoDS::Edge(aLocalShape); TopoDS_Edge CEO = TopoDS::Edge(aLocalShape);
@@ -1655,8 +1750,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with first edge // intersection with first edge
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) { for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current()); const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE1, aE3, AsDes2d, RefEdgeInter(FIO, BAsurf, aE1, aE3,
Tol, Standard_True, Pref, theDMVV, bCoincide); Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
if (bCoincide) { if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E1 // in case of coincidence trim the edge E3 the same way as E1
Store(aE3, AsDes2d->Descendant(aE1), Tol, Standard_True, AsDes2d, theDMVV); Store(aE3, AsDes2d->Descendant(aE1), Tol, Standard_True, AsDes2d, theDMVV);
@@ -1666,8 +1762,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with second edge // intersection with second edge
for (Exp1.Init(NE2, TopAbs_EDGE); Exp1.More(); Exp1.Next()) { for (Exp1.Init(NE2, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE2 = TopoDS::Edge(Exp1.Current()); const TopoDS_Edge& aE2 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE2, aE3, AsDes2d, RefEdgeInter(FIO, BAsurf, aE2, aE3,
Tol, Standard_True, Pref, theDMVV, bCoincide); Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
if (bCoincide) { if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E2 // in case of coincidence trim the edge E3 the same way as E2
Store(aE3, AsDes2d->Descendant(aE2), Tol, Standard_True, AsDes2d, theDMVV); Store(aE3, AsDes2d->Descendant(aE2), Tol, Standard_True, AsDes2d, theDMVV);
@@ -1685,8 +1782,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
for (Exp1.Next(); Exp1.More(); Exp1.Next()) { for (Exp1.Next(); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE3Next = TopoDS::Edge(Exp1.Current()); const TopoDS_Edge& aE3Next = TopoDS::Edge(Exp1.Current());
if (aME.Contains(aE3Next)) { if (aME.Contains(aE3Next)) {
RefEdgeInter(FIO, BAsurf, aE3Next, aE3, AsDes2d, RefEdgeInter(FIO, BAsurf, aE3Next, aE3,
Tol, Standard_True, Pref, theDMVV, bCoincide); Vcommon, IsConstantE1, IsConstantE2,
AsDes2d, Tol, Standard_True, Pref, theDMVV, bCoincide);
} }
} }
} }

View File

@@ -22,6 +22,7 @@
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
@@ -60,6 +61,7 @@ public:
BRepOffset_Offset& OFI, BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build, const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset, const Standard_Real Offset,
const Standard_Real Tol, const Standard_Real Tol,
@@ -76,6 +78,7 @@ public:
BRepOffset_Offset& OFI, BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build, const TopTools_DataMapOfShapeShape& Build,
const TopTools_MapOfShape& MapConstantEdges,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol, const Standard_Real Tol,

View File

@@ -44,6 +44,7 @@
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx> #include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
//#include <BRepBuilderAPI_Copy.hxx>
// //
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
#include <BOPCol_BoxBndTree.hxx> #include <BOPCol_BoxBndTree.hxx>
@@ -51,6 +52,28 @@
// //
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
static void FindCommonEdges(const TopoDS_Face& theF1,
const TopoDS_Face& theF2,
TopTools_ListOfShape& theList)
{
TopExp_Explorer Explo1(theF1.Oriented(TopAbs_FORWARD), TopAbs_EDGE);
for (; Explo1.More(); Explo1.Next())
{
const TopoDS_Shape& anEdge1 = Explo1.Current();
TopExp_Explorer Explo2(theF2, TopAbs_EDGE);
for (; Explo2.More(); Explo2.Next())
{
const TopoDS_Shape& anEdge2 = Explo2.Current();
if (anEdge1.IsSame(anEdge2))
{
theList.Append(anEdge1);
break;
}
}
}
}
//======================================================================= //=======================================================================
//function : BRepOffset_Inter3d //function : BRepOffset_Inter3d
//purpose : //purpose :
@@ -269,14 +292,15 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
// many sections. // many sections.
//-------------------------------------------------------- //--------------------------------------------------------
if (InterFaces) { if (InterFaces) {
TopTools_ListOfShape aList;
if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1), if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1),
TopoDS::Face(InitF2),LE,LV)) { TopoDS::Face(InitF2),LE,LV)) {
if (!LE.IsEmpty()) { if (!LE.IsEmpty()) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
} }
} }
else { else {
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D(F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
} }
} }
} }
@@ -287,7 +311,8 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide); BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide);
} }
else { else {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
} }
} }
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
@@ -327,7 +352,8 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
F1 = TopoDS::Face(InitOffsetFace.Image(Anc.First()).First()); F1 = TopoDS::Face(InitOffsetFace.Image(Anc.First()).First());
F2 = TopoDS::Face(InitOffsetFace.Image(Anc.Last ()).First()); F2 = TopoDS::Face(InitOffsetFace.Image(Anc.Last ()).First());
if (!IsDone(F1,F2)) { if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,Standard_True); TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,E,Standard_True);
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
} }
} }
@@ -406,13 +432,14 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
const TopTools_ListOfShape& AncE2 = Analyse.Ancestors(E2); const TopTools_ListOfShape& AncE2 = Analyse.Ancestors(E2);
Standard_Boolean TangentFaces = Standard_False; Standard_Boolean TangentFaces = Standard_False;
if (AncE2.Extent() == 2) { if (AncE2.Extent() == 2) {
TopTools_ListOfShape aList;
TopoDS_Face InitF2 = TopoDS::Face(AncE2.First ()); TopoDS_Face InitF2 = TopoDS::Face(AncE2.First ());
TangentFaces = (InitF2.IsSame(AncE1.First()) || TangentFaces = (InitF2.IsSame(AncE1.First()) ||
InitF2.IsSame(AncE1.Last())); InitF2.IsSame(AncE1.Last()));
if (!TangentFaces) { if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First()); F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) { if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
} }
} }
@@ -422,7 +449,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
if (!TangentFaces) { if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First()); F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) { if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (F1,F2,F1,F2,LInt1,LInt2,aList,mySide,NullEdge);
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
} }
} }
@@ -444,6 +471,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
void BRepOffset_Inter3d::ConnexIntByInt void BRepOffset_Inter3d::ConnexIntByInt
(const TopoDS_Shape& SI, (const TopoDS_Shape& SI,
const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_DataMapOfShapeOffset& MapSF,
const TopTools_MapOfShape& MapModifyingFaces,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build, TopTools_DataMapOfShapeShape& Build,
@@ -592,10 +620,32 @@ void BRepOffset_Inter3d::ConnexIntByInt
// //
OF1 = TopoDS::Face(MapSF(F1).Face()); OF1 = TopoDS::Face(MapSF(F1).Face());
OF2 = TopoDS::Face(MapSF(F2).Face()); OF2 = TopoDS::Face(MapSF(F2).Face());
if (!MES.IsBound(OF1)) {
Standard_Boolean F1remains = Standard_False, F2remains = Standard_False;
F1remains = (!MapSF(F1).IsInputOffsetFace() &&
MapSF(F1).Offset() == 0. &&
!MapModifyingFaces.Contains(F1));
//Temporary
//F1remains = Standard_False;
///////////
if (F1remains)
{
//NF1 = TopoDS::Face(BRepBuilderAPI_Copy(OF1));
NF1 = OF1;
MES.Bind(OF1,NF1);
//F1remains = Standard_True;
}
else if (!MES.IsBound(OF1)) {
Standard_Boolean enlargeU = Standard_True; Standard_Boolean enlargeU = Standard_True;
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True; Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
BRepOffset_Tool::CheckBounds( F1, Analyse, enlargeU, enlargeVfirst, enlargeVlast ); if (MapSF(F1).IsInputOffsetFace())
{
enlargeU = Standard_False;
enlargeVfirst = Standard_False; enlargeVlast = Standard_False;
}
else
BRepOffset_Tool::CheckBounds( F1, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
BRepOffset_Tool::EnLargeFace(OF1,NF1,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast); BRepOffset_Tool::EnLargeFace(OF1,NF1,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast);
MES.Bind(OF1,NF1); MES.Bind(OF1,NF1);
} }
@@ -603,20 +653,53 @@ void BRepOffset_Inter3d::ConnexIntByInt
NF1 = TopoDS::Face(MES(OF1)); NF1 = TopoDS::Face(MES(OF1));
} }
// //
if (!MES.IsBound(OF2)) { F2remains = (!MapSF(F2).IsInputOffsetFace() &&
MapSF(F2).Offset() == 0. &&
!MapModifyingFaces.Contains(F2));
//Temporary
//F2remains = Standard_False;
///////////
if (F2remains)
{
//NF2 = TopoDS::Face(BRepBuilderAPI_Copy(OF2));
NF2 = OF2;
MES.Bind(OF2,NF2);
//F2remains = Standard_True;
}
else if (!MES.IsBound(OF2)) {
Standard_Boolean enlargeU = Standard_True; Standard_Boolean enlargeU = Standard_True;
Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True; Standard_Boolean enlargeVfirst = Standard_True, enlargeVlast = Standard_True;
BRepOffset_Tool::CheckBounds( F2, Analyse, enlargeU, enlargeVfirst, enlargeVlast ); if (MapSF(F2).IsInputOffsetFace())
{
enlargeU = Standard_False;
enlargeVfirst = Standard_False; enlargeVlast = Standard_False;
}
else
BRepOffset_Tool::CheckBounds( F2, Analyse, enlargeU, enlargeVfirst, enlargeVlast );
BRepOffset_Tool::EnLargeFace(OF2,NF2,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast); BRepOffset_Tool::EnLargeFace(OF2,NF2,Standard_True,Standard_True,enlargeU,enlargeVfirst,enlargeVlast);
MES.Bind(OF2,NF2); MES.Bind(OF2,NF2);
} }
else { else {
NF2 = TopoDS::Face(MES(OF2)); NF2 = TopoDS::Face(MES(OF2));
} }
// //
if (!IsDone(NF1,NF2)) { if (!IsDone(NF1,NF2)) {
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1, LInt2, LInt;
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,bEdge); if (F1remains || F2remains)
FindCommonEdges(F1, F2, LInt);
if (F1remains && F2remains)
{
LInt1.Assign(LInt);
TopTools_ListIteratorOfListOfShape itl(LInt1);
for (; itl.More(); itl.Next())
LInt2.Append(itl.Value().Reversed());
}
else
{
BRepOffset_Tool::Inter3D(NF1, NF2, F1, F2, LInt1, LInt2, LInt,
CurSide, E, bEdge,
F1remains, F2remains);
}
if (LInt1.Extent() > 1) { if (LInt1.Extent() > 1) {
// intersection is in seceral edges (free sewing) // intersection is in seceral edges (free sewing)
SelectEdge(aS, LInt1); SelectEdge(aS, LInt1);
@@ -1018,9 +1101,9 @@ void BRepOffset_Inter3d::ContextIntByInt
} }
if (!IsDone(NF,CF)) { if (!IsDone(NF,CF)) {
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1,LInt2;
TopTools_ListOfShape LOE; TopTools_ListOfShape LOE, aList;
LOE.Append(OE); LOE.Append(OE);
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,bEdge); BRepOffset_Tool::Inter3D (WCF,NF,WCF,NF,LInt1,LInt2,aList,Side,E,bEdge);
SetDone(NF,CF); SetDone(NF,CF);
if (!LInt1.IsEmpty()) { if (!LInt1.IsEmpty()) {
Store (CF,NF,LInt1,LInt2); Store (CF,NF,LInt1,LInt2);
@@ -1241,7 +1324,8 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
// If no trace try intersection. // If no trace try intersection.
//------------------------------------------------------- //-------------------------------------------------------
if (LInt1.IsEmpty()) { if (LInt1.IsEmpty()) {
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge); TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (CF,OF1,CF,OF1,LInt1,LInt2,aList,mySide,NullEdge);
} }
Store (CF,OF1,LInt1,LInt2); Store (CF,OF1,LInt1,LInt2);
} }

View File

@@ -53,7 +53,14 @@ public:
Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces, const TopoDS_Shape& ShapeInit, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace); Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces, const TopoDS_Shape& ShapeInit, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace);
Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False); Standard_EXPORT void ConnexIntByInt (const TopoDS_Shape& SI,
const BRepOffset_DataMapOfShapeOffset& MapSF,
const TopTools_MapOfShape& MapModifyingFaces,
const BRepOffset_Analyse& A,
TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed,
const Standard_Boolean bIsPlanar = Standard_False);
Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces, const Standard_Boolean ExtentContext, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False); Standard_EXPORT void ContextIntByInt (const TopTools_IndexedMapOfShape& ContextFaces, const Standard_Boolean ExtentContext, const BRepOffset_DataMapOfShapeOffset& MapSF, const BRepOffset_Analyse& A, TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& Build, TopTools_ListOfShape& Failed, const Standard_Boolean bIsPlanar = Standard_False);

View File

@@ -81,6 +81,7 @@
#include <gp_Lin2d.hxx> #include <gp_Lin2d.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <GProp_GProps.hxx> #include <GProp_GProps.hxx>
#include <IntTools_Context.hxx>
#include <IntTools_FClass2d.hxx> #include <IntTools_FClass2d.hxx>
#include <NCollection_List.hxx> #include <NCollection_List.hxx>
#include <Precision.hxx> #include <Precision.hxx>
@@ -627,6 +628,9 @@ void BRepOffset_MakeOffset::Clear()
myImageOffset .Clear(); myImageOffset .Clear();
myFaces .Clear(); myFaces .Clear();
myFaceOffset .Clear(); myFaceOffset .Clear();
myMapFaceOffsetFace.Clear();
myMapModifyingFaces.Clear();
myMapConstantEdges.Clear();
myAsDes ->Clear(); myAsDes ->Clear();
myDone = Standard_False; myDone = Standard_False;
} }
@@ -658,6 +662,21 @@ void BRepOffset_MakeOffset::SetOffsetOnFace(const TopoDS_Face& F,
myFaceOffset.Bind(F,Off); myFaceOffset.Bind(F,Off);
} }
//=======================================================================
//function : SetOffsetFace
//purpose :
//=======================================================================
void BRepOffset_MakeOffset::SetOffsetFace(const TopoDS_Face& F,
const TopoDS_Face& OF)
{
// Check the orientation of the offset face and make
// it oriented the same way as original
Handle(IntTools_Context) aCtx = new IntTools_Context;
Standard_Boolean bToReverse = BOPTools_AlgoTools::IsSplitToReverse(F, OF, aCtx);
TopoDS_Face anOffsetFace = bToReverse ? TopoDS::Face(OF.Reversed()) : OF;
myMapFaceOffsetFace.Bind(F, anOffsetFace);
}
//======================================================================= //=======================================================================
//function : RemoveCorks //function : RemoveCorks
//purpose : //purpose :
@@ -795,6 +814,50 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
//---------------------------- //----------------------------
UpdateFaceOffset(); UpdateFaceOffset();
//Filling of <myModifiedFaces> and <myMapConstantEdges>
TopTools_IndexedDataMapOfShapeListOfShape EFmap;
TopExp::MapShapesAndUniqueAncestors(myShape, TopAbs_EDGE, TopAbs_FACE, EFmap);
TopTools_DataMapIteratorOfDataMapOfShapeReal itr1(myFaceOffset);
for (; itr1.More(); itr1.Next())
{
const TopoDS_Shape& aFace = itr1.Key();
myMapModifyingFaces.Add(aFace);
TopExp_Explorer Explo(aFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
TopTools_ListIteratorOfListOfShape itl(EFmap.FindFromKey(anEdge));
for (; itl.More(); itl.Next())
myMapModifyingFaces.Add(itl.Value());
}
}
TopTools_DataMapIteratorOfDataMapOfShapeShape itr2(myMapFaceOffsetFace);
for (; itr2.More(); itr2.Next())
{
const TopoDS_Shape& aFace = itr2.Key();
myMapModifyingFaces.Add(aFace);
TopExp_Explorer Explo(aFace, TopAbs_EDGE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& anEdge = Explo.Current();
TopTools_ListIteratorOfListOfShape itl(EFmap.FindFromKey(anEdge));
for (; itl.More(); itl.Next())
myMapModifyingFaces.Add(itl.Value());
}
}
TopExp_Explorer Explo(myShape, TopAbs_FACE);
for (; Explo.More(); Explo.Next())
{
const TopoDS_Shape& aFace = Explo.Current();
if (!myMapModifyingFaces.Contains(aFace))
{
TopExp_Explorer Explo2(aFace, TopAbs_EDGE);
for (; Explo2.More(); Explo2.Next())
myMapConstantEdges.Add(Explo2.Current());
}
}
////////////////////////////////////////////////////
if (myJoin == GeomAbs_Arc) if (myJoin == GeomAbs_Arc)
BuildOffsetByArc(); BuildOffsetByArc();
else if (myJoin == GeomAbs_Intersection) else if (myJoin == GeomAbs_Intersection)
@@ -1029,7 +1092,10 @@ void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& the
for (; aItLF.More(); aItLF.Next()) { for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aF = TopoDS::Face(aItLF.Value()); const TopoDS_Face& aF = TopoDS::Face(aItLF.Value());
aCurOffset = myFaceOffset.IsBound(aF) ? myFaceOffset(aF) : myOffset; aCurOffset = myFaceOffset.IsBound(aF) ? myFaceOffset(aF) : myOffset;
BRepOffset_Offset OF(aF, aCurOffset, ShapeTgt, OffsetOutside, myJoin); TopoDS_Face InputOffsetFace;
if (myMapFaceOffsetFace.IsBound(aF))
InputOffsetFace = TopoDS::Face(myMapFaceOffsetFace(aF));
BRepOffset_Offset OF(aF, aCurOffset, InputOffsetFace, ShapeTgt, OffsetOutside, myJoin);
TopTools_ListOfShape Let; TopTools_ListOfShape Let;
myAnalyse.Edges(aF,BRepOffset_Tangent,Let); myAnalyse.Edges(aF,BRepOffset_Tangent,Let);
TopTools_ListIteratorOfListOfShape itl(Let); TopTools_ListIteratorOfListOfShape itl(Let);
@@ -1103,7 +1169,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
BRepOffset_Inter3d Inter3 (AsDes,Side,myTol); BRepOffset_Inter3d Inter3 (AsDes,Side,myTol);
// Intersection between parallel faces // Intersection between parallel faces
Inter3.ConnexIntByInt(myShape,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar); Inter3.ConnexIntByInt(myShape,MapSF,myMapModifyingFaces,myAnalyse,MES,Build,Failed,myIsPlanar);
// Intersection with caps. // Intersection with caps.
Inter3.ContextIntByInt(myFaces,ExtentContext,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar); Inter3.ContextIntByInt(myFaces,ExtentContext,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar);
@@ -3549,6 +3615,9 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData()
} }
} }
if (!myMapFaceOffsetFace.IsEmpty())
isFound = Standard_True;
if (!isFound) if (!isFound)
{ {
// No face with non-null offset found. // No face with non-null offset found.
@@ -3817,7 +3886,8 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopoDS_Shape& theShape,
const TopoDS_Face& aF = TopoDS::Face(aExp.Current()); const TopoDS_Face& aF = TopoDS::Face(aExp.Current());
aTolF = BRep_Tool::Tolerance(aF); aTolF = BRep_Tool::Tolerance(aF);
BRepOffset_Inter2d::ConnexIntByInt BRepOffset_Inter2d::ConnexIntByInt
(aF, theMapSF(aF), theMES, theBuild, theAsDes2d, myOffset, aTolF, aMFV, aDMVV); (aF, theMapSF(aF), theMES, theBuild, myMapConstantEdges, theAsDes2d,
myOffset, aTolF, aMFV, aDMVV);
} }
// intersect edges created from vertices // intersect edges created from vertices
Standard_Integer i, aNbF = aMFV.Extent(); Standard_Integer i, aNbF = aMFV.Extent();
@@ -3825,7 +3895,8 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopoDS_Shape& theShape,
const TopoDS_Face& aF = TopoDS::Face(aMFV(i)); const TopoDS_Face& aF = TopoDS::Face(aMFV(i));
aTolF = BRep_Tool::Tolerance(aF); aTolF = BRep_Tool::Tolerance(aF);
BRepOffset_Inter2d::ConnexIntByIntInVert BRepOffset_Inter2d::ConnexIntByIntInVert
(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d, aTolF, aDMVV); (aF, theMapSF(aF), theMES, theBuild, myMapConstantEdges, theAsDes, theAsDes2d,
aTolF, aDMVV);
} }
// //
// fuse vertices on edges // fuse vertices on edges

View File

@@ -82,6 +82,9 @@ public:
//! set the offset <Off> on the Face <F> //! set the offset <Off> on the Face <F>
Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off); Standard_EXPORT void SetOffsetOnFace (const TopoDS_Face& F, const Standard_Real Off);
//! Sets the offset face for the face in the shape.
Standard_EXPORT void SetOffsetFace (const TopoDS_Face& F, const TopoDS_Face& OF);
Standard_EXPORT void MakeOffsetShape(); Standard_EXPORT void MakeOffsetShape();
Standard_EXPORT void MakeThickSolid(); Standard_EXPORT void MakeThickSolid();
@@ -218,6 +221,9 @@ private:
Standard_Boolean myIsPlanar; Standard_Boolean myIsPlanar;
TopoDS_Shape myBadShape; TopoDS_Shape myBadShape;
TopTools_DataMapOfShapeShape myMapFaceOffsetFace; // map of the face - extended offset face
TopTools_MapOfShape myMapModifyingFaces;
TopTools_MapOfShape myMapConstantEdges;
}; };
#endif // _BRepOffset_MakeOffset_HeaderFile #endif // _BRepOffset_MakeOffset_HeaderFile

View File

@@ -4628,9 +4628,12 @@ void IntersectFaces(const TopoDS_Shape& theFInv,
{ {
// intersect faces // intersect faces
TopAbs_State aSide = TopAbs_OUT; TopAbs_State aSide = TopAbs_OUT;
TopTools_ListOfShape aLInt1, aLInt2; TopTools_ListOfShape aLInt1, aLInt2, aList;
TopoDS_Edge aNullEdge; TopoDS_Edge aNullEdge;
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide, aNullEdge); BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj),
TopoDS::Face(theFi), TopoDS::Face(theFj),
aLInt1, aLInt2, aList,
aSide, aNullEdge);
// //
if (aLInt1.IsEmpty()) { if (aLInt1.IsEmpty()) {
return; return;

View File

@@ -82,6 +82,7 @@
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx> #include <TopTools_SequenceOfShape.hxx>
//#include <BRepBuilderAPI_Copy.hxx>
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
static Standard_Boolean Affich = Standard_False; static Standard_Boolean Affich = Standard_False;
@@ -379,6 +380,8 @@ static void ComputeCurve3d(TopoDS_Edge Edge,
BRepOffset_Offset::BRepOffset_Offset() BRepOffset_Offset::BRepOffset_Offset()
{ {
myOffset = 0.;
myIsInputOffsetFace = Standard_False;
} }
@@ -404,11 +407,12 @@ BRepOffset_Offset::BRepOffset_Offset(const TopoDS_Face& Face,
BRepOffset_Offset::BRepOffset_Offset BRepOffset_Offset::BRepOffset_Offset
(const TopoDS_Face& Face, (const TopoDS_Face& Face,
const Standard_Real Offset, const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created, const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside, const Standard_Boolean OffsetOutside,
const GeomAbs_JoinType JoinType) const GeomAbs_JoinType JoinType)
{ {
Init(Face,Offset,Created,OffsetOutside,JoinType); Init(Face,Offset,InputOffsetFace,Created,OffsetOutside,JoinType);
} }
@@ -476,7 +480,8 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face,
const GeomAbs_JoinType JoinType) const GeomAbs_JoinType JoinType)
{ {
TopTools_DataMapOfShapeShape Empty; TopTools_DataMapOfShapeShape Empty;
Init(Face,Offset,Empty,OffsetOutside,JoinType); TopoDS_Face NullOffsetFace;
Init(Face,Offset,NullOffsetFace,Empty,OffsetOutside,JoinType);
} }
@@ -487,11 +492,31 @@ void BRepOffset_Offset::Init(const TopoDS_Face& Face,
void BRepOffset_Offset::Init(const TopoDS_Face& Face, void BRepOffset_Offset::Init(const TopoDS_Face& Face,
const Standard_Real Offset, const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created, const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside, const Standard_Boolean OffsetOutside,
const GeomAbs_JoinType JoinType) const GeomAbs_JoinType JoinType)
{ {
myShape = Face; myShape = Face;
myOffset = Offset;
myIsInputOffsetFace = Standard_False;
if (!InputOffsetFace.IsNull())
{
myFace = InputOffsetFace;
myIsInputOffsetFace = Standard_True;
myStatus = BRepOffset_Good;
return;
}
if (Abs(Offset) <= Precision::Confusion())
{
//myFace = TopoDS::Face(BRepBuilderAPI_Copy(myShape));
myFace = Face;
myStatus = BRepOffset_Good;
return;
}
Standard_Real myOffset = Offset; Standard_Real myOffset = Offset;
if ( Face.Orientation() == TopAbs_REVERSED) if ( Face.Orientation() == TopAbs_REVERSED)
myOffset *= -1.; myOffset *= -1.;
@@ -1676,3 +1701,23 @@ BRepOffset_Status BRepOffset_Offset::Status() const
{ {
return myStatus; return myStatus;
} }
//=======================================================================
//function : Offset
//purpose :
//=======================================================================
Standard_Real BRepOffset_Offset::Offset() const
{
return myOffset;
}
//=======================================================================
//function : IsInputOffsetFace
//purpose :
//=======================================================================
Standard_Boolean BRepOffset_Offset::IsInputOffsetFace() const
{
return myIsInputOffsetFace;
}

View File

@@ -49,7 +49,10 @@ public:
Standard_EXPORT BRepOffset_Offset(); Standard_EXPORT BRepOffset_Offset();
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, const Standard_Real Offset, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc); Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face,
const Standard_Real Offset,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
//! This method will be called when you want to share //! This method will be called when you want to share
//! the edges soon generated from an other face. //! the edges soon generated from an other face.
@@ -63,27 +66,73 @@ public:
//! E' = the image of E in the offseting of //! E' = the image of E in the offseting of
//! another face sharing E with a //! another face sharing E with a
//! continuity at least G1 //! continuity at least G1
Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face, const Standard_Real Offset, const TopTools_DataMapOfShapeShape& Created, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc); Standard_EXPORT BRepOffset_Offset(const TopoDS_Face& Face,
const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1); Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const TopoDS_Edge& FirstEdge, const TopoDS_Edge& LastEdge, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1); Standard_EXPORT BRepOffset_Offset(const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const TopoDS_Edge& FirstEdge,
const TopoDS_Edge& LastEdge,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Tol and Conti are only used if Polynomial is True //! Tol and Conti are only used if Polynomial is True
//! (Used to perfrom the approximation) //! (Used to perfrom the approximation)
Standard_EXPORT BRepOffset_Offset(const TopoDS_Vertex& Vertex, const TopTools_ListOfShape& LEdge, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1); Standard_EXPORT BRepOffset_Offset(const TopoDS_Vertex& Vertex, const TopTools_ListOfShape& LEdge, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Face& Face, const Standard_Real Offset, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc); Standard_EXPORT void Init (const TopoDS_Face& Face,
const Standard_Real Offset,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Face& Face, const Standard_Real Offset, const TopTools_DataMapOfShapeShape& Created, const Standard_Boolean OffsetOutside = Standard_True, const GeomAbs_JoinType JoinType = GeomAbs_Arc); Standard_EXPORT void Init (const TopoDS_Face& Face,
const Standard_Real Offset,
const TopoDS_Face& InputOffsetFace,
const TopTools_DataMapOfShapeShape& Created,
const Standard_Boolean OffsetOutside = Standard_True,
const GeomAbs_JoinType JoinType = GeomAbs_Arc);
Standard_EXPORT void Init (const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1); Standard_EXPORT void Init (const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
Standard_EXPORT void Init (const TopoDS_Edge& Path, const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const Standard_Real Offset, const TopoDS_Edge& FirstEdge, const TopoDS_Edge& LastEdge, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1); Standard_EXPORT void Init (const TopoDS_Edge& Path,
const TopoDS_Edge& Edge1,
const TopoDS_Edge& Edge2,
const Standard_Real Offset,
const TopoDS_Edge& FirstEdge,
const TopoDS_Edge& LastEdge,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Tol and Conti are only used if Polynomial is True //! Tol and Conti are only used if Polynomial is True
//! (Used to perfrom the approximation) //! (Used to perfrom the approximation)
Standard_EXPORT void Init (const TopoDS_Vertex& Vertex, const TopTools_ListOfShape& LEdge, const Standard_Real Offset, const Standard_Boolean Polynomial = Standard_False, const Standard_Real Tol = 1.0e-4, const GeomAbs_Shape Conti = GeomAbs_C1); Standard_EXPORT void Init (const TopoDS_Vertex& Vertex,
const TopTools_ListOfShape& LEdge,
const Standard_Real Offset,
const Standard_Boolean Polynomial = Standard_False,
const Standard_Real Tol = 1.0e-4,
const GeomAbs_Shape Conti = GeomAbs_C1);
//! Only used in Rolling Ball. Pipe on Free Boundary //! Only used in Rolling Ball. Pipe on Free Boundary
Standard_EXPORT void Init (const TopoDS_Edge& Edge, const Standard_Real Offset); Standard_EXPORT void Init (const TopoDS_Edge& Edge, const Standard_Real Offset);
@@ -96,7 +145,9 @@ public:
Standard_EXPORT BRepOffset_Status Status() const; Standard_EXPORT BRepOffset_Status Status() const;
Standard_EXPORT Standard_Boolean IsInputOffsetFace() const;
Standard_EXPORT Standard_Real Offset() const;
protected: protected:
@@ -112,8 +163,8 @@ private:
TopoDS_Shape myShape; TopoDS_Shape myShape;
BRepOffset_Status myStatus; BRepOffset_Status myStatus;
TopoDS_Face myFace; TopoDS_Face myFace;
TopTools_DataMapOfShapeShape myMap; Standard_Real myOffset;
Standard_Boolean myIsInputOffsetFace;
}; };

View File

@@ -1579,11 +1579,16 @@ static TopoDS_Edge AssembleEdge(const BOPDS_PDS& pDS,
void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1, void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
const TopoDS_Face& F2, const TopoDS_Face& F2,
const TopoDS_Face& ProF1,
const TopoDS_Face& ProF2,
TopTools_ListOfShape& L1, TopTools_ListOfShape& L1,
TopTools_ListOfShape& L2, TopTools_ListOfShape& L2,
const TopAbs_State Side, const TopTools_ListOfShape& ListOnFirst,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge, const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined) const Standard_Boolean IsRefEdgeDefined,
const Standard_Boolean F1remains,
const Standard_Boolean F2remains)
{ {
#ifdef DRAW #ifdef DRAW
if (AffichInter) { if (AffichInter) {
@@ -1595,6 +1600,29 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
} }
#endif #endif
BRep_Builder BB;
if (F1remains || F2remains)
{
TopoDS_Face ProFace = (F1remains)? ProF2 : ProF1;
TopoDS_Face NewFace = (F1remains)? F2 : F1;
TopTools_ListIteratorOfListOfShape itl(ListOnFirst);
for (; itl.More(); itl.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(itl.Value());
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge,ProFace,fpar,lpar);
Handle(Geom2d_Curve) NullPCurve;
BB.UpdateEdge(anEdge, NullPCurve, ProFace, 0.);
BB.UpdateEdge(anEdge, aPCurve, NewFace, 0.);
L1.Append(anEdge);
//L2.Append(anEdge.Reversed());
if (F1.Orientation() == F2.Orientation())
anEdge.Reverse();
L2.Append(anEdge);
}
return;
}
// Check if the faces are planar and not trimmed - in this case // Check if the faces are planar and not trimmed - in this case
// the IntTools_FaceFace intersection algorithm will be used directly. // the IntTools_FaceFace intersection algorithm will be used directly.
BRepAdaptor_Surface aBAS1(F1, Standard_False), aBAS2(F2, Standard_False); BRepAdaptor_Surface aBAS1(F1, Standard_False), aBAS2(F2, Standard_False);
@@ -3604,7 +3632,8 @@ void BRepOffset_Tool::ExtentFace (const TopoDS_Face& F,
if (ConstShapes.IsBound(E)) ToBuild.UnBind(E); if (ConstShapes.IsBound(E)) ToBuild.UnBind(E);
if (ToBuild.IsBound(E)) { if (ToBuild.IsBound(E)) {
EnLargeFace(TopoDS::Face(ToBuild(E)),StopFace,Standard_False); EnLargeFace(TopoDS::Face(ToBuild(E)),StopFace,Standard_False);
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,Standard_True); TopTools_ListOfShape aList;
BRepOffset_Tool::Inter3D (EF,StopFace,EF,StopFace,LInt1,LInt2,aList,Side,E,Standard_True);
// No intersection, it may happen for example for a chosen (non-offseted) planar face and // No intersection, it may happen for example for a chosen (non-offseted) planar face and
// its neighbour offseted cylindrical face, if the offset is directed so that // its neighbour offseted cylindrical face, if the offset is directed so that
// the radius of the cylinder becomes smaller. // the radius of the cylinder becomes smaller.
@@ -4148,4 +4177,4 @@ void PerformPlanes(const TopoDS_Face& theFace1,
Standard_Boolean IsInf(const Standard_Real theVal) Standard_Boolean IsInf(const Standard_Real theVal)
{ {
return (theVal > TheInfini*0.9); return (theVal > TheInfini*0.9);
} }

View File

@@ -83,7 +83,18 @@ public:
//! edges solution are stored in <LInt1> with the //! edges solution are stored in <LInt1> with the
//! orientation on <F1>, the sames edges are stored in //! orientation on <F1>, the sames edges are stored in
//! <Lint2> with the orientation on <F2>. //! <Lint2> with the orientation on <F2>.
Standard_EXPORT static void Inter3D (const TopoDS_Face& F1, const TopoDS_Face& F2, TopTools_ListOfShape& LInt1, TopTools_ListOfShape& LInt2, const TopAbs_State Side, const TopoDS_Edge& RefEdge, const Standard_Boolean IsRefEdgeDefined = Standard_False); Standard_EXPORT static void Inter3D (const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopoDS_Face& ProF1,
const TopoDS_Face& ProF2,
TopTools_ListOfShape& LInt1,
TopTools_ListOfShape& LInt2,
const TopTools_ListOfShape& ListOnFirst,
const TopAbs_State Side,
const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined = Standard_False,
const Standard_Boolean F1remains = Standard_False,
const Standard_Boolean F2remains = Standard_False);
//! Find if the edges <Edges> of the face <F2> are on //! Find if the edges <Edges> of the face <F2> are on
//! the face <F1>. //! the face <F1>.

View File

@@ -1106,6 +1106,27 @@ Standard_Integer offsetonface(Draw_Interpretor&, Standard_Integer n, const char*
return 0; return 0;
} }
//=======================================================================
//function : addoffsetface
//purpose :
//=======================================================================
static Standard_Integer addoffsetface(Draw_Interpretor&, Standard_Integer n, const char** a)
{
if ( n < 3) return 1;
for (Standard_Integer i = 1 ; i < n; i+=2) {
TopoDS_Shape SF = DBRep::Get(a[i],TopAbs_FACE);
if (!SF.IsNull()) {
TopoDS_Shape OF = DBRep::Get(a[i+1],TopAbs_FACE);
if (!OF.IsNull()) {
TheOffset.SetOffsetFace(TopoDS::Face(SF), TopoDS::Face(OF));
}
}
}
return 0;
}
//======================================================================= //=======================================================================
//function : offsetperform //function : offsetperform
//purpose : //purpose :
@@ -2374,6 +2395,10 @@ void BRepTest::FeatureCommands (Draw_Interpretor& theCommands)
"offsetonface face1 offset1 face2 offset2 ...", "offsetonface face1 offset1 face2 offset2 ...",
__FILE__,offsetonface,g); __FILE__,offsetonface,g);
theCommands.Add("addoffsetface",
"addoffsetface face1 offset_face1 face2 offset_face2 ...",
__FILE__,addoffsetface,g);
theCommands.Add("offsetperform", theCommands.Add("offsetperform",
"offsetperform result", "offsetperform result",
__FILE__,offsetperform,g); __FILE__,offsetperform,g);

View File

@@ -1554,12 +1554,13 @@ void BiTgte_Blend::ComputeCenters()
if (AS.ShapeType() == TopAbs_FACE) { if (AS.ShapeType() == TopAbs_FACE) {
const TopoDS_Face& F = TopoDS::Face(myFaces(i)); const TopoDS_Face& F = TopoDS::Face(myFaces(i));
TopoDS_Face NullFace;
if ( TouchedByCork.Contains(F)) { if ( TouchedByCork.Contains(F)) {
BRepOffset_Tool::EnLargeFace(F,BigF,Standard_True); BRepOffset_Tool::EnLargeFace(F,BigF,Standard_True);
OF1.Init(BigF,myRadius,EdgeTgt); OF1.Init(BigF,myRadius,NullFace,EdgeTgt);
} }
else { else {
OF1.Init(F,myRadius,EdgeTgt); OF1.Init(F,myRadius,NullFace,EdgeTgt);
} }
} }
else { // So this is a Free Border edge on which the ball rolls. else { // So this is a Free Border edge on which the ball rolls.