#include <BRep_Builder.hxx>
#include <BRepLib.hxx>
#include <TColgp_SequenceOfPnt.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
+#include <TColGeom2d_HArray1OfCurve.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
return gp_Vec( BRep_Tool::Pnt( Origin ), BRep_Tool::Pnt( aVertex ) );
}
+static TopoDS_Wire WireFromList(TopTools_ListOfShape& Edges)
+{
+ BRepLib_MakeWire MW;
+ TopoDS_Edge anEdge = TopoDS::Edge(Edges.First());
+ MW.Add(anEdge);
+ Edges.RemoveFirst();
+
+ while (!Edges.IsEmpty())
+ {
+ TopoDS_Wire CurWire = MW.Wire();
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(CurWire, V1, V2);
+ TopTools_ListIteratorOfListOfShape itl(Edges);
+ for (; itl.More(); itl.Next())
+ {
+ anEdge = TopoDS::Edge(itl.Value());
+ TopoDS_Vertex V3, V4;
+ TopExp::Vertices(anEdge, V3, V4);
+ if (V1.IsSame(V3) || V1.IsSame(V4) ||
+ V2.IsSame(V3) || V2.IsSame(V4))
+ break;
+ }
+ MW.Add(anEdge);
+ Edges.Remove(itl);
+ }
+
+ return (MW.Wire());
+}
+
+//=======================================================================
+//function : Constructor
+//purpose :
+//======================================================================
BRepFill_Filling::BRepFill_Filling( const Standard_Integer Degree,
const Standard_Integer NbPtsOnCur,
const Standard_Integer NbIter,
myIsDone = Standard_False;
}
+//=======================================================================
+//function : SetConstrParam
+//purpose :
+//======================================================================
void BRepFill_Filling::SetConstrParam( const Standard_Real Tol2d,
const Standard_Real Tol3d,
const Standard_Real TolAng,
myTolCurv = TolCurv;
}
+//=======================================================================
+//function : SetResolParam
+//purpose :
+//======================================================================
void BRepFill_Filling::SetResolParam( const Standard_Integer Degree,
const Standard_Integer NbPtsOnCur,
const Standard_Integer NbIter,
myAnisotropie = Anisotropie;
}
+//=======================================================================
+//function : SetApproxParam
+//purpose :
+//======================================================================
void BRepFill_Filling::SetApproxParam( const Standard_Integer MaxDeg,
const Standard_Integer MaxSegments )
{
myMaxSegments = MaxSegments;
}
+//=======================================================================
+//function : LoadInitSurface
+//purpose :
+//======================================================================
void BRepFill_Filling::LoadInitSurface( const TopoDS_Face& aFace )
{
myInitFace = aFace;
myIsInitFaceGiven = Standard_True;
}
+//=======================================================================
+//function : Add
+//purpose : adds an edge as a constraint
+//======================================================================
Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
const GeomAbs_Shape Order,
const Standard_Boolean IsBound )
if (IsBound)
{
myBoundary.Append( EdgeFaceAndOrder );
+ TopTools_ListOfShape EmptyList;
+ myOldNewMap.Bind(anEdge, EmptyList);
return myBoundary.Length();
}
else
}
}
+//=======================================================================
+//function : Add
+//purpose : adds an edge with supporting face as a constraint
+//======================================================================
Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
const TopoDS_Face& Support,
const GeomAbs_Shape Order,
if (IsBound)
{
myBoundary.Append( EdgeFaceAndOrder );
+ TopTools_ListOfShape EmptyList;
+ myOldNewMap.Bind(anEdge, EmptyList);
return myBoundary.Length();
}
else
}
}
+//=======================================================================
+//function : Add
+//purpose : adds a "free constraint": face without edge
+//======================================================================
Standard_Integer BRepFill_Filling::Add( const TopoDS_Face& Support,
const GeomAbs_Shape Order )
{
return (myBoundary.Length() + myFreeConstraints.Length());
}
+//=======================================================================
+//function : Add
+//purpose : adds a point constraint
+//======================================================================
Standard_Integer BRepFill_Filling::Add( const gp_Pnt& Point )
{
Handle( GeomPlate_PointConstraint ) aPC = new GeomPlate_PointConstraint( Point, GeomAbs_C0, myTol3d );
return (myBoundary.Length() + myFreeConstraints.Length() + myConstraints.Length() + myPoints.Length());
}
+//=======================================================================
+//function : Add
+//purpose : adds a point constraint on a face
+//======================================================================
Standard_Integer BRepFill_Filling::Add( const Standard_Real U,
const Standard_Real V,
const TopoDS_Face& Support,
}
+//=======================================================================
+//function : AddConstraints
+//purpose :
+//======================================================================
void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints )
{
TopoDS_Edge CurEdge;
GeomAbs_Shape CurOrder;
Handle(GeomPlate_CurveConstraint) Constr;
- for (Standard_Integer i = 1; i <= SeqOfConstraints.Length(); i++)
+ Standard_Integer i;
+ for (i = 1; i <= SeqOfConstraints.Length(); i++)
{
CurEdge = SeqOfConstraints(i).myEdge;
CurFace = SeqOfConstraints(i).myFace;
// On prend une representation Geometrique : au pif !
Handle( Geom_Surface ) Surface;
Handle( Geom2d_Curve ) C2d;
-// Class BRep_Tool without fields and without Constructor :
-// BRep_Tool BT;
TopLoc_Location loc;
Standard_Real f, l;
-// BT.CurveOnSurface( CurEdge, C2d, Surface, loc, f, l);
BRep_Tool::CurveOnSurface( CurEdge, C2d, Surface, loc, f, l);
if (Surface.IsNull()) {
Standard_Failure::Raise( "Add" );
}
}
-void BRepFill_Filling::BuildWires( TopTools_MapOfShape& EdgeMap, TopTools_MapOfShape& WireMap ) const
+//=======================================================================
+//function : BuildWires
+//purpose :
+//======================================================================
+void BRepFill_Filling::BuildWires( TopTools_ListOfShape& EdgeList, TopTools_ListOfShape& WireList )
{
TopoDS_Wire CurWire;
TopoDS_Edge CurEdge;
- TopoDS_Vertex Wfirst, Wlast, Efirst, Elast;
- gp_Pnt Wp1, Wp2;
- TopTools_MapIteratorOfMapOfShape MapIt;
+ TopTools_ListIteratorOfListOfShape Itl;
+ Standard_Integer i, j;
- while (! EdgeMap.IsEmpty())
+ while (! EdgeList.IsEmpty())
{
BRepLib_MakeWire MW;
- MapIt.Initialize( EdgeMap );
- MW.Add( TopoDS::Edge( MapIt.Key() ) );
- EdgeMap.Remove( MapIt.Key() );
- CurWire = MW.Wire();
- TopExp::Vertices( CurWire, Wfirst, Wlast );
- Wp1 = BRep_Tool::Pnt( Wfirst );
- Wp2 = BRep_Tool::Pnt( Wlast );
-
- Standard_Boolean IsFound = Standard_True;
- while (IsFound)
- {
- IsFound = Standard_False;
- for (MapIt.Initialize( EdgeMap ); MapIt.More(); MapIt.Next())
- {
- CurEdge = TopoDS::Edge( MapIt.Key() );
- TopExp::Vertices( CurEdge, Efirst, Elast );
-
- Standard_Real dist = Wp1.Distance( BRep_Tool::Pnt( Efirst ) );
- if (dist < BRep_Tool::Tolerance( Wfirst ) || dist < BRep_Tool::Tolerance( Efirst ))
- {
- MW.Add( CurEdge );
- CurWire = MW.Wire();
- Wfirst = Elast;
- Wp1 = BRep_Tool::Pnt( Wfirst );
- EdgeMap.Remove( CurEdge );
- IsFound = Standard_True;
- break;
- }
- dist = Wp1.Distance( BRep_Tool::Pnt( Elast ) );
- if (dist < BRep_Tool::Tolerance( Wfirst ) || dist < BRep_Tool::Tolerance( Elast ))
- {
- MW.Add( CurEdge );
- CurWire = MW.Wire();
- Wfirst = Efirst;
- Wp1 = BRep_Tool::Pnt( Wfirst );
- EdgeMap.Remove( CurEdge );
- IsFound = Standard_True;
- break;
- }
- dist = Wp2.Distance( BRep_Tool::Pnt( Efirst ) );
- if (dist < BRep_Tool::Tolerance( Wlast ) || dist < BRep_Tool::Tolerance( Efirst ))
- {
- MW.Add( CurEdge );
- CurWire = MW.Wire();
- Wlast = Elast;
- Wp2 = BRep_Tool::Pnt( Wlast );
- EdgeMap.Remove( CurEdge );
- IsFound = Standard_True;
- break;
- }
- dist = Wp2.Distance( BRep_Tool::Pnt( Elast ) );
- if (dist < BRep_Tool::Tolerance( Wlast ) || dist < BRep_Tool::Tolerance( Elast ))
- {
- MW.Add( CurEdge );
- CurWire = MW.Wire();
- Wlast = Efirst;
- Wp2 = BRep_Tool::Pnt( Wlast );
- EdgeMap.Remove( CurEdge );
- IsFound = Standard_True;
- break;
- }
- } //for (MapIt.Init...
- } //while (IsFound)
- WireMap.Add( CurWire );
- } //while (! EdgeMap.IsEmpty())
+ TopoDS_Edge FirstEdge = TopoDS::Edge(EdgeList.First());
+ MW.Add(FirstEdge);
+ EdgeList.RemoveFirst();
+ TopoDS_Vertex V_wire[2], V_edge[2];
+
+ for (;;)
+ {
+ TopoDS_Wire CurWire = MW.Wire();
+ TopExp::Vertices(CurWire, V_wire[0], V_wire[1]);
+ Standard_Boolean found = Standard_False;
+ for (Itl.Initialize( EdgeList ); Itl.More(); Itl.Next())
+ {
+ TopoDS_Edge CurEdge = TopoDS::Edge(Itl.Value());
+ TopExp::Vertices(CurEdge, V_edge[0], V_edge[1]);
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 2; j++)
+ if (V_wire[i].IsSame(V_edge[j]))
+ {
+ MW.Add(CurEdge);
+ EdgeList.Remove(Itl);
+ found = Standard_True;
+ break;
+ }
+ if (found)
+ break;
+ }
+ if (found)
+ break;
+ }
+ if (!found) //try to find geometric coincidence
+ {
+ gp_Pnt P_wire[2];
+ P_wire[0] = BRep_Tool::Pnt(V_wire[0]);
+ P_wire[1] = BRep_Tool::Pnt(V_wire[1]);
+ for (Itl.Initialize( EdgeList ); Itl.More(); Itl.Next())
+ {
+ TopoDS_Edge CurEdge = TopoDS::Edge(Itl.Value());
+ TopExp::Vertices(CurEdge, V_edge[0], V_edge[1]);
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ Standard_Real aDist = P_wire[i].Distance(BRep_Tool::Pnt(V_edge[j]));
+ if (aDist < BRep_Tool::Tolerance(V_wire[i]) &&
+ aDist < BRep_Tool::Tolerance(V_edge[j]))
+ {
+ MW.Add(CurEdge);
+ myOldNewMap(CurEdge).Append(MW.Edge());
+ EdgeList.Remove(Itl);
+ found = Standard_True;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
+ if (found)
+ break;
+ }
+ }
+ if (!found) //end of current wire, begin next wire
+ {
+ WireList.Append( MW.Wire() );
+ break;
+ }
+ } //end of for (;;)
+ } //end of while (! EdgeList.IsEmpty())
}
-void BRepFill_Filling::FindExtremitiesOfHoles( TopTools_MapOfShape& WireMap, TColgp_SequenceOfPnt& PntSeq ) const
+//=======================================================================
+//function : FindExtremitiesOfHoles
+//purpose :
+//======================================================================
+void BRepFill_Filling::FindExtremitiesOfHoles(const TopTools_ListOfShape& WireList,
+ TopTools_SequenceOfShape& VerSeq ) const
{
- TopoDS_Wire theWire, CurWire;
- TopTools_MapIteratorOfMapOfShape MapIt( WireMap );
- theWire = TopoDS::Wire( MapIt.Key() );
- WireMap.Remove( MapIt.Key() );
+ TopTools_SequenceOfShape WireSeq;
+ TopTools_ListIteratorOfListOfShape Itl(WireList);
+ for (; Itl.More(); Itl.Next())
+ WireSeq.Append(Itl.Value());
+
+ TopoDS_Wire theWire;
+ theWire = TopoDS::Wire(WireSeq(1));
+ WireSeq.Remove(1);
if (theWire.Closed())
return;
TopoDS_Vertex Vfirst, Vlast;
TopExp::Vertices( theWire, Vfirst, Vlast );
gp_Vec FinVec = MakeFinVec( theWire, Vlast );
- gp_Pnt thePoint = BRep_Tool::Pnt( Vlast );
- PntSeq.Append( thePoint );
+ TopoDS_Vertex theVertex = Vlast;
+ VerSeq.Append( Vlast );
- while (! WireMap.IsEmpty())
+ while (! WireSeq.IsEmpty())
{
- gp_Pnt MinPnt;
- TopoDS_Wire MinWire;
-#ifndef DEB
+ TopoDS_Vertex MinVtx;
+ Standard_Integer i, MinInd;
Standard_Boolean IsLast = Standard_False;
-#else
- Standard_Boolean IsLast ;
-#endif
Standard_Real MinAngle = M_PI;
- for (MapIt.Initialize( WireMap ); MapIt.More(); MapIt.Next())
+ for (i = 1; i <= WireSeq.Length(); i++)
{
- CurWire = TopoDS::Wire( MapIt.Key() );
+ const TopoDS_Wire& CurWire = TopoDS::Wire( WireSeq(i) );
TopExp::Vertices( CurWire, Vfirst, Vlast );
- Standard_Real angle = FinVec.Angle( gp_Vec( thePoint, BRep_Tool::Pnt( Vfirst ) ) );
+ Standard_Real angle =
+ FinVec.Angle(gp_Vec(BRep_Tool::Pnt(theVertex), BRep_Tool::Pnt(Vfirst)));
if (angle < MinAngle)
{
MinAngle = angle;
- MinPnt = BRep_Tool::Pnt( Vfirst );
- MinWire = CurWire;
+ MinVtx = Vfirst;
+ MinInd = i;
IsLast = Standard_True;
}
- angle = FinVec.Angle( gp_Vec( thePoint, BRep_Tool::Pnt( Vlast ) ) );
+ angle = FinVec.Angle(gp_Vec(BRep_Tool::Pnt(theVertex), BRep_Tool::Pnt(Vlast)));
if (angle < MinAngle)
{
MinAngle = angle;
- MinPnt = BRep_Tool::Pnt( Vlast );
- MinWire = CurWire;
+ MinVtx = Vlast;
+ MinInd = i;
IsLast = Standard_False;
}
}
- PntSeq.Append( MinPnt );
+ VerSeq.Append( MinVtx );
+ const TopoDS_Wire& MinWire = TopoDS::Wire(WireSeq(MinInd));
TopExp::Vertices( MinWire, Vfirst, Vlast );
if (IsLast)
{
FinVec = MakeFinVec( MinWire, Vlast );
- thePoint = BRep_Tool::Pnt( Vlast );
+ theVertex = Vlast;
}
else
{
FinVec = MakeFinVec( MinWire, Vfirst );
- thePoint = BRep_Tool::Pnt( Vfirst );
+ theVertex = Vfirst;
}
- PntSeq.Append( thePoint );
- WireMap.Remove( MinWire );
+ VerSeq.Append( theVertex );
+ WireSeq.Remove(MinInd);
}
TopExp::Vertices( theWire, Vfirst, Vlast );
- PntSeq.Append( BRep_Tool::Pnt( Vfirst ) );
+ VerSeq.Append( Vfirst );
}
+//=======================================================================
+//function : Build
+//purpose : builds the resulting face
+//======================================================================
void BRepFill_Filling::Build()
{
GeomPlate_BuildPlateSurface thebuild( myDegree, myNbPtsOnCur, myNbIter,
- myTol2d, myTol3d, myTolAng, myTolCurv, myAnisotropie );
+ myTol2d, myTol3d, myTolAng, myTolCurv, myAnisotropie );
myBuilder = thebuild;
TopoDS_Edge CurEdge;
TopoDS_Face CurFace;
Standard_Integer i, j;
- //Creating array of points: extremities of wires
- TColgp_SequenceOfPnt PntSeq;
-
- //????????????
- //Setting tollerance
- for (i = 1; i <= myBoundary.Length(); i++)
- {
- TopoDS_Edge E (myBoundary(i).myEdge);
- TopoDS_Vertex V1 (TopExp::FirstVertex( E ));
- Handle(BRep_TVertex)& TV1 = *((Handle(BRep_TVertex)*) &V1.TShape());
- if (TV1->Tolerance() > 0.001)
- TV1->Tolerance( 0.001 );
- TV1->Modified( Standard_True );
- TopoDS_Vertex V2 (TopExp::LastVertex( E ));
- Handle(BRep_TVertex)& TV2 = *((Handle(BRep_TVertex)*) &V2.TShape());
- if (TV2->Tolerance() > 0.001)
- TV2->Tolerance( 0.001 );
- TV2->Modified( Standard_True );
- }
+ //Creating array of vertices: extremities of wires
+ TopTools_SequenceOfShape VerSeq;
//Building missing bounds
- TopTools_MapOfShape EdgeMap, WireMap;
+ TopTools_ListOfShape EdgeList, WireList;
for (i = 1; i <= myBoundary.Length(); i++)
- EdgeMap.Add( myBoundary(i).myEdge );
+ EdgeList.Append( myBoundary(i).myEdge );
- BuildWires( EdgeMap, WireMap );
- FindExtremitiesOfHoles( WireMap, PntSeq );
+ BuildWires( EdgeList, WireList );
+ FindExtremitiesOfHoles( WireList, VerSeq );
//Searching for surfaces for missing bounds
for (j = 1; j <= myFreeConstraints.Length(); j++)
Handle( Geom_Surface ) CurSurface = BRep_Tool::Surface( HSurf->ChangeSurface().Face() );
//BRepTopAdaptor_FClass2d Classifier( CurFace, Precision::Confusion() );
- for (i = 1; i <= PntSeq.Length(); i += 2)
+ for (i = 1; i <= VerSeq.Length(); i += 2)
{
- Projector.Init( PntSeq.Value(i), CurSurface );
+ const TopoDS_Vertex& FirstVtx = TopoDS::Vertex(VerSeq(i));
+ const TopoDS_Vertex& LastVtx = TopoDS::Vertex(VerSeq(i+1));
+
+ gp_Pnt FirstPnt = BRep_Tool::Pnt(FirstVtx);
+ Projector.Init( FirstPnt, CurSurface );
if (Projector.LowerDistance() > Precision::Confusion())
continue;
Projector.LowerDistanceParameters( U1, V1 );
if (State == TopAbs_OUT || State == TopAbs_UNKNOWN)
continue;
*/
-
- Projector.Init( PntSeq.Value(i+1), CurSurface );
+
+ gp_Pnt LastPnt = BRep_Tool::Pnt(LastVtx);
+ Projector.Init( LastPnt, CurSurface );
if (Projector.LowerDistance() > Precision::Confusion())
continue;
Projector.LowerDistanceParameters( U2, V2 );
Points(1) = gp_Pnt2d( U1, V1 );
Points(2) = gp_Pnt2d( U2, V2 );
Handle( Geom2d_BezierCurve ) Line2d = new Geom2d_BezierCurve( Points );
- TopoDS_Edge E = BRepLib_MakeEdge( Line2d, CurSurface, Line2d->FirstParameter(), Line2d->LastParameter() );
+ TopoDS_Edge E = BRepLib_MakeEdge( Line2d, CurSurface, FirstVtx, LastVtx );
Add( E, CurFace, myFreeConstraints(j).myOrder );
- PntSeq.Remove( i, i+1 );
+ VerSeq.Remove( i, i+1 );
break;
- } //for (i = 1; i <= PntSeq.Length(); i += 2)
+ } //for (i = 1; i <= VerSeq.Length(); i += 2)
} //for (j = 1; j <= myFreeConstraints.Length(); j++)
//Load initial surface to myBuilder if it is given
TColgp_SequenceOfXY S2d;
TColgp_SequenceOfXYZ S3d;
- S2d.Clear();
- S3d.Clear();
myBuilder.Disc2dContour(4,S2d);
myBuilder.Disc3dContour(4,0,S3d);
seuil = Max( myTol3d, 10*myBuilder.G0Error() ); //????????
//Approx.Dump( cout );
Surface = Approx.Surface();
}
-
- TopoDS_Wire W;
- //Preparing EdgeMap for method BuildWires
- EdgeMap.Clear();
- WireMap.Clear();
- PntSeq.Clear();
- BRep_Builder B;
+
+ //Build the final wire and final face
+ TopTools_ListOfShape FinalEdges;
+ Handle(TColGeom2d_HArray1OfCurve) CurvesOnPlate = myBuilder.Curves2d();
+ BRep_Builder BB;
for (i = 1; i <= myBoundary.Length(); i++)
- {
- TopoDS_Edge E;
- Handle( GeomPlate_CurveConstraint ) CC = myBuilder.CurveConstraint(i);
- E = BRepLib_MakeEdge( CC->Curve2dOnSurf(),
- Surface,
- CC->FirstParameter(),
- CC->LastParameter());
-
- B.UpdateVertex( TopExp::FirstVertex(E), dmax );
- B.UpdateVertex( TopExp::LastVertex(E), dmax );
- BRepLib::BuildCurve3d( E );
- EdgeMap.Add( E );
- }
- //Fixing the holes
- TopTools_MapOfShape EdgeMap2;
- TopTools_MapIteratorOfMapOfShape MapIt( EdgeMap );
- for (; MapIt.More(); MapIt.Next())
- EdgeMap2.Add( MapIt.Key() );
- BuildWires( EdgeMap2, WireMap );
- FindExtremitiesOfHoles( WireMap, PntSeq );
-
- for (i = 1; i <= PntSeq.Length(); i += 2)
- {
- GeomAPI_ProjectPointOnSurf Projector;
- Quantity_Parameter U1, V1, U2, V2;
-
- Projector.Init( PntSeq.Value(i), Surface );
- Projector.LowerDistanceParameters( U1, V1 );
- Projector.Init( PntSeq.Value(i+1), Surface );
- Projector.LowerDistanceParameters( U2, V2 );
-
- //Making the edge on the resulting surface
- TColgp_Array1OfPnt2d Points( 1, 2 );
- Points(1) = gp_Pnt2d( U1, V1 );
- Points(2) = gp_Pnt2d( U2, V2 );
- Handle( Geom2d_BezierCurve ) Line2d = new Geom2d_BezierCurve( Points );
- TopoDS_Edge E = BRepLib_MakeEdge( Line2d, Surface, Line2d->FirstParameter(), Line2d->LastParameter() );
-
- B.UpdateVertex( TopExp::FirstVertex(E), dmax );
- B.UpdateVertex( TopExp::LastVertex(E), dmax );
- BRepLib::BuildCurve3d( E );
- EdgeMap.Add( E );
- }
- WireMap.Clear();
- BuildWires( EdgeMap, WireMap );
- MapIt.Initialize( WireMap );
- W = TopoDS::Wire( MapIt.Key() );
+ {
+ const TopoDS_Edge& InitEdge = myBoundary(i).myEdge;
+ TopoDS_Edge anEdge = InitEdge;
+ if (!myOldNewMap(anEdge).IsEmpty())
+ anEdge = TopoDS::Edge( myOldNewMap(anEdge).First() );
+ Handle(Geom2d_Curve) aCurveOnPlate = CurvesOnPlate->Value(i);
+
+ TopoDS_Edge NewEdge = TopoDS::Edge(anEdge.EmptyCopied());
+ NewEdge.Closed(anEdge.Closed());
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(anEdge, V1, V2, Standard_True); //with orientation
+ BB.UpdateVertex(V1, dmax);
+ BB.UpdateVertex(V2, dmax);
+ BB.Add(NewEdge, V1);
+ BB.Add(NewEdge, V2);
+ TopLoc_Location Loc;
+ BB.UpdateEdge(NewEdge, aCurveOnPlate, Surface, Loc, dmax);
+ //BRepLib::SameRange(NewEdge);
+ BRepLib::SameParameter(NewEdge, dmax, Standard_True);
+ FinalEdges.Append(NewEdge);
+ myOldNewMap(InitEdge).Clear();
+ myOldNewMap(InitEdge).Append(NewEdge);
+ }
- if (!(W.Closed()))
+ TopoDS_Wire FinalWire = WireFromList(FinalEdges);
+ if (!(FinalWire.Closed()))
Standard_Failure::Raise("Wire is not closed");
-
- myFace = BRepLib_MakeFace( Surface, W );
+
+ myFace = BRepLib_MakeFace( Surface, FinalWire );
}
+//=======================================================================
+//function : IsDone
+//purpose :
+//======================================================================
Standard_Boolean BRepFill_Filling::IsDone() const
{
return myIsDone;
}
+//=======================================================================
+//function : Face
+//purpose : returns the result
+//======================================================================
TopoDS_Face BRepFill_Filling::Face() const
{
return myFace;
}
+//=======================================================================
+//function : Generated
+//purpose : returns the new edge (first in list) made from old edge "S"
+//=======================================================================
+ const TopTools_ListOfShape& BRepFill_Filling::Generated(const TopoDS_Shape& S)
+{
+ myGenerated.Clear();
+
+ if (myOldNewMap.IsBound(S))
+ myGenerated.Append(myOldNewMap(S));
+
+ return myGenerated;
+}
+
+//==========================================================================
+//function : G0Error
+//purpose : returns maximum distance from boundary to the resulting surface
+//==========================================================================
Standard_Real BRepFill_Filling::G0Error() const
{
return myBuilder.G0Error();
}
+//=======================================================================
+//function : G1Error
+//purpose : returns maximum angle between the resulting surface
+// and constraint surfaces at boundaries
+//======================================================================
Standard_Real BRepFill_Filling::G1Error() const
{
return myBuilder.G1Error();
}
+//=======================================================================
+//function : G2Error
+//purpose : returns maximum difference of curvature between
+// the resulting surface and constraint surfaces at boundaries
+//======================================================================
Standard_Real BRepFill_Filling::G2Error() const
{
return myBuilder.G2Error();
}
+//==========================================================================
+//function : G0Error
+//purpose : returns maximum distance between the constraint number Index
+// and the resulting surface
+//==========================================================================
Standard_Real BRepFill_Filling::G0Error( const Standard_Integer Index )
{
return myBuilder.G0Error( Index );
}
+//==========================================================================
+//function : G1Error
+//purpose : returns maximum angle between the constraint number Index
+// and the resulting surface
+//==========================================================================
Standard_Real BRepFill_Filling::G1Error( const Standard_Integer Index )
{
return myBuilder.G1Error( Index );
}
+//==========================================================================
+//function : G2Error
+//purpose : returns maximum difference of curvature between
+// the constraint number Index and the resulting surface
+//==========================================================================
Standard_Real BRepFill_Filling::G2Error( const Standard_Integer Index )
{
return myBuilder.G2Error( Index );
#include <BRepOffsetAPI_MakeFilling.ixx>
+//=======================================================================
+//function : Constructor
+//purpose :
+//======================================================================
BRepOffsetAPI_MakeFilling::BRepOffsetAPI_MakeFilling( const Standard_Integer Degree,
const Standard_Integer NbPtsOnCur,
const Standard_Integer NbIter,
{
}
+//=======================================================================
+//function : SetConstrParam
+//purpose :
+//======================================================================
void BRepOffsetAPI_MakeFilling::SetConstrParam( const Standard_Real Tol2d,
const Standard_Real Tol3d,
const Standard_Real TolAng,
myFilling.SetConstrParam( Tol2d, Tol3d, TolAng, TolCurv );
}
+//=======================================================================
+//function : SetResolParam
+//purpose :
+//======================================================================
void BRepOffsetAPI_MakeFilling::SetResolParam( const Standard_Integer Degree,
const Standard_Integer NbPtsOnCur,
const Standard_Integer NbIter,
myFilling.SetResolParam( Degree, NbPtsOnCur, NbIter, Anisotropie );
}
+//=======================================================================
+//function : SetApproxParam
+//purpose :
+//======================================================================
void BRepOffsetAPI_MakeFilling::SetApproxParam( const Standard_Integer MaxDeg,
const Standard_Integer MaxSegments )
{
myFilling.SetApproxParam( MaxDeg, MaxSegments );
}
+//=======================================================================
+//function : LoadInitSurface
+//purpose :
+//======================================================================
void BRepOffsetAPI_MakeFilling::LoadInitSurface( const TopoDS_Face& Surf )
{
myFilling.LoadInitSurface( Surf );
}
+//=======================================================================
+//function : Add
+//purpose : adds an edge as a constraint
+//======================================================================
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
const GeomAbs_Shape Order,
const Standard_Boolean IsBound )
return myFilling.Add( Constr, Order, IsBound );
}
+//=======================================================================
+//function : Add
+//purpose : adds an edge with supporting face as a constraint
+//======================================================================
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
const TopoDS_Face& Support,
const GeomAbs_Shape Order,
return myFilling.Add( Constr, Support, Order, IsBound );
}
+//=======================================================================
+//function : Add
+//purpose : adds a "free constraint": face without edge
+//======================================================================
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Face& Support,
const GeomAbs_Shape Order )
{
return myFilling.Add( Support, Order );
}
+//=======================================================================
+//function : Add
+//purpose : adds a point constraint
+//======================================================================
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const gp_Pnt& Point )
{
return myFilling.Add( Point );
}
+//=======================================================================
+//function : Add
+//purpose : adds a point constraint on a face
+//======================================================================
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const Standard_Real U,
const Standard_Real V,
const TopoDS_Face& Support,
}
+//=======================================================================
+//function : Build
+//purpose : builds the resulting face
+//======================================================================
void BRepOffsetAPI_MakeFilling::Build()
{
myFilling.Build();
myShape = myFilling.Face();
}
+//=======================================================================
+//function : IsDone
+//purpose :
+//======================================================================
Standard_Boolean BRepOffsetAPI_MakeFilling::IsDone() const
{
return myFilling.IsDone();
}
+//=======================================================================
+//function : Generated
+//purpose : returns the new edge (first in list) made from old edge "S"
+//=======================================================================
+const TopTools_ListOfShape& BRepOffsetAPI_MakeFilling::Generated(const TopoDS_Shape& S)
+{
+ return myFilling.Generated(S);
+}
+
+//==========================================================================
+//function : G0Error
+//purpose : returns maximum distance from boundary to the resulting surface
+//==========================================================================
Standard_Real BRepOffsetAPI_MakeFilling::G0Error() const
{
return myFilling.G0Error();
}
+//=======================================================================
+//function : G1Error
+//purpose : returns maximum angle between the resulting surface
+// and constraint surfaces at boundaries
+//======================================================================
Standard_Real BRepOffsetAPI_MakeFilling::G1Error() const
{
return myFilling.G1Error();
}
+//=======================================================================
+//function : G2Error
+//purpose : returns maximum difference of curvature between
+// the resulting surface and constraint surfaces at boundaries
+//======================================================================
Standard_Real BRepOffsetAPI_MakeFilling::G2Error() const
{
return myFilling.G2Error();
}
+//==========================================================================
+//function : G0Error
+//purpose : returns maximum distance between the constraint number Index
+// and the resulting surface
+//==========================================================================
Standard_Real BRepOffsetAPI_MakeFilling::G0Error( const Standard_Integer Index )
{
return myFilling.G0Error( Index );
}
+//==========================================================================
+//function : G1Error
+//purpose : returns maximum angle between the constraint number Index
+// and the resulting surface
+//==========================================================================
Standard_Real BRepOffsetAPI_MakeFilling::G1Error( const Standard_Integer Index )
{
return myFilling.G1Error( Index );
}
+//==========================================================================
+//function : G2Error
+//purpose : returns maximum difference of curvature between
+// the constraint number Index and the resulting surface
+//==========================================================================
Standard_Real BRepOffsetAPI_MakeFilling::G2Error( const Standard_Integer Index )
{
return myFilling.G2Error( Index );