mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0022783: Improvement of BRepOffsetAPI_MakeFilling: keep old and new boundary edges with all pcurves
This commit is contained in:
parent
c2b143174b
commit
01697018a3
@ -50,7 +50,9 @@ uses
|
|||||||
SequenceOfEdgeFaceAndOrder from BRepFill,
|
SequenceOfEdgeFaceAndOrder from BRepFill,
|
||||||
SequenceOfFaceAndOrder from BRepFill,
|
SequenceOfFaceAndOrder from BRepFill,
|
||||||
SequenceOfPointConstraint from GeomPlate,
|
SequenceOfPointConstraint from GeomPlate,
|
||||||
MapOfShape from TopTools,
|
SequenceOfShape from TopTools,
|
||||||
|
ListOfShape from TopTools,
|
||||||
|
DataMapOfShapeListOfShape from TopTools,
|
||||||
SequenceOfPnt from TColgp
|
SequenceOfPnt from TColgp
|
||||||
|
|
||||||
raises
|
raises
|
||||||
@ -176,13 +178,13 @@ is
|
|||||||
---Purpose: Adds constraints to builder
|
---Purpose: Adds constraints to builder
|
||||||
is private;
|
is private;
|
||||||
|
|
||||||
BuildWires( me; EdgeMap : in out MapOfShape from TopTools;
|
BuildWires( me : in out; EdgeList : in out ListOfShape from TopTools;
|
||||||
WireList : out MapOfShape from TopTools )
|
WireList : out ListOfShape from TopTools )
|
||||||
---Purpose: Builds wires of maximum length
|
---Purpose: Builds wires of maximum length
|
||||||
is private;
|
is private;
|
||||||
|
|
||||||
FindExtremitiesOfHoles( me; WireMap : in out MapOfShape from TopTools;
|
FindExtremitiesOfHoles( me; WireList : ListOfShape from TopTools;
|
||||||
PntSeq : out SequenceOfPnt from TColgp )
|
VerSeq : out SequenceOfShape from TopTools )
|
||||||
---Purpose: Finds extremities of future edges to fix the holes between wires.
|
---Purpose: Finds extremities of future edges to fix the holes between wires.
|
||||||
-- Can properly operate only with convex contour
|
-- Can properly operate only with convex contour
|
||||||
is private;
|
is private;
|
||||||
@ -195,6 +197,12 @@ is
|
|||||||
Face(me) returns Face from TopoDS;
|
Face(me) returns Face from TopoDS;
|
||||||
-- returns the resulting face
|
-- returns the resulting face
|
||||||
|
|
||||||
|
Generated (me: in out; S : Shape from TopoDS)
|
||||||
|
---Purpose: Returns the list of shapes generated from the
|
||||||
|
-- shape <S>.
|
||||||
|
---C++: return const &
|
||||||
|
---Level: Public
|
||||||
|
returns ListOfShape from TopTools;
|
||||||
|
|
||||||
G0Error(me) returns Real from Standard;
|
G0Error(me) returns Real from Standard;
|
||||||
-- returns the max distance between the result and the constraints
|
-- returns the max distance between the result and the constraints
|
||||||
@ -223,6 +231,9 @@ fields
|
|||||||
myFreeConstraints : SequenceOfFaceAndOrder from BRepFill;
|
myFreeConstraints : SequenceOfFaceAndOrder from BRepFill;
|
||||||
myPoints : SequenceOfPointConstraint from GeomPlate;
|
myPoints : SequenceOfPointConstraint from GeomPlate;
|
||||||
|
|
||||||
|
myOldNewMap : DataMapOfShapeListOfShape from TopTools;
|
||||||
|
myGenerated : ListOfShape from TopTools;
|
||||||
|
|
||||||
myFace : Face from TopoDS;
|
myFace : Face from TopoDS;
|
||||||
|
|
||||||
myInitFace : Face from TopoDS;
|
myInitFace : Face from TopoDS;
|
||||||
|
@ -43,9 +43,10 @@
|
|||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
#include <BRepLib.hxx>
|
#include <BRepLib.hxx>
|
||||||
#include <TColgp_SequenceOfPnt.hxx>
|
#include <TColgp_SequenceOfPnt.hxx>
|
||||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
#include <BRepTools_WireExplorer.hxx>
|
#include <BRepTools_WireExplorer.hxx>
|
||||||
#include <TColgp_Array1OfPnt2d.hxx>
|
#include <TColgp_Array1OfPnt2d.hxx>
|
||||||
|
#include <TColGeom2d_HArray1OfCurve.hxx>
|
||||||
|
|
||||||
#include <Geom2d_BezierCurve.hxx>
|
#include <Geom2d_BezierCurve.hxx>
|
||||||
#include <Geom2d_TrimmedCurve.hxx>
|
#include <Geom2d_TrimmedCurve.hxx>
|
||||||
@ -76,6 +77,39 @@ static gp_Vec MakeFinVec( const TopoDS_Wire aWire, const TopoDS_Vertex aVertex )
|
|||||||
return gp_Vec( BRep_Tool::Pnt( Origin ), BRep_Tool::Pnt( aVertex ) );
|
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,
|
BRepFill_Filling::BRepFill_Filling( const Standard_Integer Degree,
|
||||||
const Standard_Integer NbPtsOnCur,
|
const Standard_Integer NbPtsOnCur,
|
||||||
const Standard_Integer NbIter,
|
const Standard_Integer NbIter,
|
||||||
@ -105,6 +139,10 @@ BRepFill_Filling::BRepFill_Filling( const Standard_Integer Degree,
|
|||||||
myIsDone = Standard_False;
|
myIsDone = Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetConstrParam
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepFill_Filling::SetConstrParam( const Standard_Real Tol2d,
|
void BRepFill_Filling::SetConstrParam( const Standard_Real Tol2d,
|
||||||
const Standard_Real Tol3d,
|
const Standard_Real Tol3d,
|
||||||
const Standard_Real TolAng,
|
const Standard_Real TolAng,
|
||||||
@ -116,6 +154,10 @@ void BRepFill_Filling::SetConstrParam( const Standard_Real Tol2d,
|
|||||||
myTolCurv = TolCurv;
|
myTolCurv = TolCurv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetResolParam
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepFill_Filling::SetResolParam( const Standard_Integer Degree,
|
void BRepFill_Filling::SetResolParam( const Standard_Integer Degree,
|
||||||
const Standard_Integer NbPtsOnCur,
|
const Standard_Integer NbPtsOnCur,
|
||||||
const Standard_Integer NbIter,
|
const Standard_Integer NbIter,
|
||||||
@ -127,6 +169,10 @@ void BRepFill_Filling::SetResolParam( const Standard_Integer Degree,
|
|||||||
myAnisotropie = Anisotropie;
|
myAnisotropie = Anisotropie;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetApproxParam
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepFill_Filling::SetApproxParam( const Standard_Integer MaxDeg,
|
void BRepFill_Filling::SetApproxParam( const Standard_Integer MaxDeg,
|
||||||
const Standard_Integer MaxSegments )
|
const Standard_Integer MaxSegments )
|
||||||
{
|
{
|
||||||
@ -134,12 +180,20 @@ void BRepFill_Filling::SetApproxParam( const Standard_Integer MaxDeg,
|
|||||||
myMaxSegments = MaxSegments;
|
myMaxSegments = MaxSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : LoadInitSurface
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepFill_Filling::LoadInitSurface( const TopoDS_Face& aFace )
|
void BRepFill_Filling::LoadInitSurface( const TopoDS_Face& aFace )
|
||||||
{
|
{
|
||||||
myInitFace = aFace;
|
myInitFace = aFace;
|
||||||
myIsInitFaceGiven = Standard_True;
|
myIsInitFaceGiven = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Add
|
||||||
|
//purpose : adds an edge as a constraint
|
||||||
|
//======================================================================
|
||||||
Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
||||||
const GeomAbs_Shape Order,
|
const GeomAbs_Shape Order,
|
||||||
const Standard_Boolean IsBound )
|
const Standard_Boolean IsBound )
|
||||||
@ -149,6 +203,8 @@ Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
|||||||
if (IsBound)
|
if (IsBound)
|
||||||
{
|
{
|
||||||
myBoundary.Append( EdgeFaceAndOrder );
|
myBoundary.Append( EdgeFaceAndOrder );
|
||||||
|
TopTools_ListOfShape EmptyList;
|
||||||
|
myOldNewMap.Bind(anEdge, EmptyList);
|
||||||
return myBoundary.Length();
|
return myBoundary.Length();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -158,6 +214,10 @@ Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Add
|
||||||
|
//purpose : adds an edge with supporting face as a constraint
|
||||||
|
//======================================================================
|
||||||
Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
||||||
const TopoDS_Face& Support,
|
const TopoDS_Face& Support,
|
||||||
const GeomAbs_Shape Order,
|
const GeomAbs_Shape Order,
|
||||||
@ -167,6 +227,8 @@ Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
|||||||
if (IsBound)
|
if (IsBound)
|
||||||
{
|
{
|
||||||
myBoundary.Append( EdgeFaceAndOrder );
|
myBoundary.Append( EdgeFaceAndOrder );
|
||||||
|
TopTools_ListOfShape EmptyList;
|
||||||
|
myOldNewMap.Bind(anEdge, EmptyList);
|
||||||
return myBoundary.Length();
|
return myBoundary.Length();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -176,6 +238,10 @@ Standard_Integer BRepFill_Filling::Add( const TopoDS_Edge& anEdge,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Add
|
||||||
|
//purpose : adds a "free constraint": face without edge
|
||||||
|
//======================================================================
|
||||||
Standard_Integer BRepFill_Filling::Add( const TopoDS_Face& Support,
|
Standard_Integer BRepFill_Filling::Add( const TopoDS_Face& Support,
|
||||||
const GeomAbs_Shape Order )
|
const GeomAbs_Shape Order )
|
||||||
{
|
{
|
||||||
@ -184,6 +250,10 @@ Standard_Integer BRepFill_Filling::Add( const TopoDS_Face& Support,
|
|||||||
return (myBoundary.Length() + myFreeConstraints.Length());
|
return (myBoundary.Length() + myFreeConstraints.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Add
|
||||||
|
//purpose : adds a point constraint
|
||||||
|
//======================================================================
|
||||||
Standard_Integer BRepFill_Filling::Add( const gp_Pnt& Point )
|
Standard_Integer BRepFill_Filling::Add( const gp_Pnt& Point )
|
||||||
{
|
{
|
||||||
Handle( GeomPlate_PointConstraint ) aPC = new GeomPlate_PointConstraint( Point, GeomAbs_C0, myTol3d );
|
Handle( GeomPlate_PointConstraint ) aPC = new GeomPlate_PointConstraint( Point, GeomAbs_C0, myTol3d );
|
||||||
@ -191,6 +261,10 @@ Standard_Integer BRepFill_Filling::Add( const gp_Pnt& Point )
|
|||||||
return (myBoundary.Length() + myFreeConstraints.Length() + myConstraints.Length() + myPoints.Length());
|
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,
|
Standard_Integer BRepFill_Filling::Add( const Standard_Real U,
|
||||||
const Standard_Real V,
|
const Standard_Real V,
|
||||||
const TopoDS_Face& Support,
|
const TopoDS_Face& Support,
|
||||||
@ -206,6 +280,10 @@ Standard_Integer BRepFill_Filling::Add( const Standard_Real U,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddConstraints
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints )
|
void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder& SeqOfConstraints )
|
||||||
{
|
{
|
||||||
TopoDS_Edge CurEdge;
|
TopoDS_Edge CurEdge;
|
||||||
@ -213,7 +291,8 @@ void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder
|
|||||||
GeomAbs_Shape CurOrder;
|
GeomAbs_Shape CurOrder;
|
||||||
|
|
||||||
Handle(GeomPlate_CurveConstraint) Constr;
|
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;
|
CurEdge = SeqOfConstraints(i).myEdge;
|
||||||
CurFace = SeqOfConstraints(i).myFace;
|
CurFace = SeqOfConstraints(i).myFace;
|
||||||
@ -233,11 +312,8 @@ void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder
|
|||||||
// On prend une representation Geometrique : au pif !
|
// On prend une representation Geometrique : au pif !
|
||||||
Handle( Geom_Surface ) Surface;
|
Handle( Geom_Surface ) Surface;
|
||||||
Handle( Geom2d_Curve ) C2d;
|
Handle( Geom2d_Curve ) C2d;
|
||||||
// Class BRep_Tool without fields and without Constructor :
|
|
||||||
// BRep_Tool BT;
|
|
||||||
TopLoc_Location loc;
|
TopLoc_Location loc;
|
||||||
Standard_Real f, l;
|
Standard_Real f, l;
|
||||||
// BT.CurveOnSurface( CurEdge, C2d, Surface, loc, f, l);
|
|
||||||
BRep_Tool::CurveOnSurface( CurEdge, C2d, Surface, loc, f, l);
|
BRep_Tool::CurveOnSurface( CurEdge, C2d, Surface, loc, f, l);
|
||||||
if (Surface.IsNull()) {
|
if (Surface.IsNull()) {
|
||||||
Standard_Failure::Raise( "Add" );
|
Standard_Failure::Raise( "Add" );
|
||||||
@ -293,90 +369,105 @@ void BRepFill_Filling::AddConstraints( const BRepFill_SequenceOfEdgeFaceAndOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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_Wire CurWire;
|
||||||
TopoDS_Edge CurEdge;
|
TopoDS_Edge CurEdge;
|
||||||
TopoDS_Vertex Wfirst, Wlast, Efirst, Elast;
|
TopTools_ListIteratorOfListOfShape Itl;
|
||||||
gp_Pnt Wp1, Wp2;
|
Standard_Integer i, j;
|
||||||
TopTools_MapIteratorOfMapOfShape MapIt;
|
|
||||||
|
|
||||||
while (! EdgeMap.IsEmpty())
|
while (! EdgeList.IsEmpty())
|
||||||
{
|
{
|
||||||
BRepLib_MakeWire MW;
|
BRepLib_MakeWire MW;
|
||||||
MapIt.Initialize( EdgeMap );
|
TopoDS_Edge FirstEdge = TopoDS::Edge(EdgeList.First());
|
||||||
MW.Add( TopoDS::Edge( MapIt.Key() ) );
|
MW.Add(FirstEdge);
|
||||||
EdgeMap.Remove( MapIt.Key() );
|
EdgeList.RemoveFirst();
|
||||||
CurWire = MW.Wire();
|
TopoDS_Vertex V_wire[2], V_edge[2];
|
||||||
TopExp::Vertices( CurWire, Wfirst, Wlast );
|
|
||||||
Wp1 = BRep_Tool::Pnt( Wfirst );
|
for (;;)
|
||||||
Wp2 = BRep_Tool::Pnt( Wlast );
|
{
|
||||||
|
TopoDS_Wire CurWire = MW.Wire();
|
||||||
Standard_Boolean IsFound = Standard_True;
|
TopExp::Vertices(CurWire, V_wire[0], V_wire[1]);
|
||||||
while (IsFound)
|
Standard_Boolean found = Standard_False;
|
||||||
{
|
for (Itl.Initialize( EdgeList ); Itl.More(); Itl.Next())
|
||||||
IsFound = Standard_False;
|
{
|
||||||
for (MapIt.Initialize( EdgeMap ); MapIt.More(); MapIt.Next())
|
TopoDS_Edge CurEdge = TopoDS::Edge(Itl.Value());
|
||||||
{
|
TopExp::Vertices(CurEdge, V_edge[0], V_edge[1]);
|
||||||
CurEdge = TopoDS::Edge( MapIt.Key() );
|
for (i = 0; i < 2; i++)
|
||||||
TopExp::Vertices( CurEdge, Efirst, Elast );
|
{
|
||||||
|
for (j = 0; j < 2; j++)
|
||||||
Standard_Real dist = Wp1.Distance( BRep_Tool::Pnt( Efirst ) );
|
if (V_wire[i].IsSame(V_edge[j]))
|
||||||
if (dist < BRep_Tool::Tolerance( Wfirst ) || dist < BRep_Tool::Tolerance( Efirst ))
|
{
|
||||||
{
|
MW.Add(CurEdge);
|
||||||
MW.Add( CurEdge );
|
EdgeList.Remove(Itl);
|
||||||
CurWire = MW.Wire();
|
found = Standard_True;
|
||||||
Wfirst = Elast;
|
break;
|
||||||
Wp1 = BRep_Tool::Pnt( Wfirst );
|
}
|
||||||
EdgeMap.Remove( CurEdge );
|
if (found)
|
||||||
IsFound = Standard_True;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if (found)
|
||||||
dist = Wp1.Distance( BRep_Tool::Pnt( Elast ) );
|
break;
|
||||||
if (dist < BRep_Tool::Tolerance( Wfirst ) || dist < BRep_Tool::Tolerance( Elast ))
|
}
|
||||||
{
|
if (!found) //try to find geometric coincidence
|
||||||
MW.Add( CurEdge );
|
{
|
||||||
CurWire = MW.Wire();
|
gp_Pnt P_wire[2];
|
||||||
Wfirst = Efirst;
|
P_wire[0] = BRep_Tool::Pnt(V_wire[0]);
|
||||||
Wp1 = BRep_Tool::Pnt( Wfirst );
|
P_wire[1] = BRep_Tool::Pnt(V_wire[1]);
|
||||||
EdgeMap.Remove( CurEdge );
|
for (Itl.Initialize( EdgeList ); Itl.More(); Itl.Next())
|
||||||
IsFound = Standard_True;
|
{
|
||||||
break;
|
TopoDS_Edge CurEdge = TopoDS::Edge(Itl.Value());
|
||||||
}
|
TopExp::Vertices(CurEdge, V_edge[0], V_edge[1]);
|
||||||
dist = Wp2.Distance( BRep_Tool::Pnt( Efirst ) );
|
for (i = 0; i < 2; i++)
|
||||||
if (dist < BRep_Tool::Tolerance( Wlast ) || dist < BRep_Tool::Tolerance( Efirst ))
|
{
|
||||||
{
|
for (j = 0; j < 2; j++)
|
||||||
MW.Add( CurEdge );
|
{
|
||||||
CurWire = MW.Wire();
|
Standard_Real aDist = P_wire[i].Distance(BRep_Tool::Pnt(V_edge[j]));
|
||||||
Wlast = Elast;
|
if (aDist < BRep_Tool::Tolerance(V_wire[i]) &&
|
||||||
Wp2 = BRep_Tool::Pnt( Wlast );
|
aDist < BRep_Tool::Tolerance(V_edge[j]))
|
||||||
EdgeMap.Remove( CurEdge );
|
{
|
||||||
IsFound = Standard_True;
|
MW.Add(CurEdge);
|
||||||
break;
|
myOldNewMap(CurEdge).Append(MW.Edge());
|
||||||
}
|
EdgeList.Remove(Itl);
|
||||||
dist = Wp2.Distance( BRep_Tool::Pnt( Elast ) );
|
found = Standard_True;
|
||||||
if (dist < BRep_Tool::Tolerance( Wlast ) || dist < BRep_Tool::Tolerance( Elast ))
|
break;
|
||||||
{
|
}
|
||||||
MW.Add( CurEdge );
|
}
|
||||||
CurWire = MW.Wire();
|
if (found)
|
||||||
Wlast = Efirst;
|
break;
|
||||||
Wp2 = BRep_Tool::Pnt( Wlast );
|
}
|
||||||
EdgeMap.Remove( CurEdge );
|
if (found)
|
||||||
IsFound = Standard_True;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
} //for (MapIt.Init...
|
if (!found) //end of current wire, begin next wire
|
||||||
} //while (IsFound)
|
{
|
||||||
WireMap.Add( CurWire );
|
WireList.Append( MW.Wire() );
|
||||||
} //while (! EdgeMap.IsEmpty())
|
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_SequenceOfShape WireSeq;
|
||||||
TopTools_MapIteratorOfMapOfShape MapIt( WireMap );
|
TopTools_ListIteratorOfListOfShape Itl(WireList);
|
||||||
theWire = TopoDS::Wire( MapIt.Key() );
|
for (; Itl.More(); Itl.Next())
|
||||||
WireMap.Remove( MapIt.Key() );
|
WireSeq.Append(Itl.Value());
|
||||||
|
|
||||||
|
TopoDS_Wire theWire;
|
||||||
|
theWire = TopoDS::Wire(WireSeq(1));
|
||||||
|
WireSeq.Remove(1);
|
||||||
|
|
||||||
if (theWire.Closed())
|
if (theWire.Closed())
|
||||||
return;
|
return;
|
||||||
@ -384,98 +475,83 @@ void BRepFill_Filling::FindExtremitiesOfHoles( TopTools_MapOfShape& WireMap, TCo
|
|||||||
TopoDS_Vertex Vfirst, Vlast;
|
TopoDS_Vertex Vfirst, Vlast;
|
||||||
TopExp::Vertices( theWire, Vfirst, Vlast );
|
TopExp::Vertices( theWire, Vfirst, Vlast );
|
||||||
gp_Vec FinVec = MakeFinVec( theWire, Vlast );
|
gp_Vec FinVec = MakeFinVec( theWire, Vlast );
|
||||||
gp_Pnt thePoint = BRep_Tool::Pnt( Vlast );
|
TopoDS_Vertex theVertex = Vlast;
|
||||||
PntSeq.Append( thePoint );
|
VerSeq.Append( Vlast );
|
||||||
|
|
||||||
while (! WireMap.IsEmpty())
|
while (! WireSeq.IsEmpty())
|
||||||
{
|
{
|
||||||
gp_Pnt MinPnt;
|
TopoDS_Vertex MinVtx;
|
||||||
TopoDS_Wire MinWire;
|
Standard_Integer i, MinInd;
|
||||||
#ifndef DEB
|
|
||||||
Standard_Boolean IsLast = Standard_False;
|
Standard_Boolean IsLast = Standard_False;
|
||||||
#else
|
|
||||||
Standard_Boolean IsLast ;
|
|
||||||
#endif
|
|
||||||
Standard_Real MinAngle = M_PI;
|
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 );
|
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)
|
if (angle < MinAngle)
|
||||||
{
|
{
|
||||||
MinAngle = angle;
|
MinAngle = angle;
|
||||||
MinPnt = BRep_Tool::Pnt( Vfirst );
|
MinVtx = Vfirst;
|
||||||
MinWire = CurWire;
|
MinInd = i;
|
||||||
IsLast = Standard_True;
|
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)
|
if (angle < MinAngle)
|
||||||
{
|
{
|
||||||
MinAngle = angle;
|
MinAngle = angle;
|
||||||
MinPnt = BRep_Tool::Pnt( Vlast );
|
MinVtx = Vlast;
|
||||||
MinWire = CurWire;
|
MinInd = i;
|
||||||
IsLast = Standard_False;
|
IsLast = Standard_False;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PntSeq.Append( MinPnt );
|
VerSeq.Append( MinVtx );
|
||||||
|
const TopoDS_Wire& MinWire = TopoDS::Wire(WireSeq(MinInd));
|
||||||
TopExp::Vertices( MinWire, Vfirst, Vlast );
|
TopExp::Vertices( MinWire, Vfirst, Vlast );
|
||||||
if (IsLast)
|
if (IsLast)
|
||||||
{
|
{
|
||||||
FinVec = MakeFinVec( MinWire, Vlast );
|
FinVec = MakeFinVec( MinWire, Vlast );
|
||||||
thePoint = BRep_Tool::Pnt( Vlast );
|
theVertex = Vlast;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FinVec = MakeFinVec( MinWire, Vfirst );
|
FinVec = MakeFinVec( MinWire, Vfirst );
|
||||||
thePoint = BRep_Tool::Pnt( Vfirst );
|
theVertex = Vfirst;
|
||||||
}
|
}
|
||||||
PntSeq.Append( thePoint );
|
VerSeq.Append( theVertex );
|
||||||
WireMap.Remove( MinWire );
|
WireSeq.Remove(MinInd);
|
||||||
}
|
}
|
||||||
TopExp::Vertices( theWire, Vfirst, Vlast );
|
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()
|
void BRepFill_Filling::Build()
|
||||||
{
|
{
|
||||||
GeomPlate_BuildPlateSurface thebuild( myDegree, myNbPtsOnCur, myNbIter,
|
GeomPlate_BuildPlateSurface thebuild( myDegree, myNbPtsOnCur, myNbIter,
|
||||||
myTol2d, myTol3d, myTolAng, myTolCurv, myAnisotropie );
|
myTol2d, myTol3d, myTolAng, myTolCurv, myAnisotropie );
|
||||||
|
|
||||||
myBuilder = thebuild;
|
myBuilder = thebuild;
|
||||||
TopoDS_Edge CurEdge;
|
TopoDS_Edge CurEdge;
|
||||||
TopoDS_Face CurFace;
|
TopoDS_Face CurFace;
|
||||||
Standard_Integer i, j;
|
Standard_Integer i, j;
|
||||||
|
|
||||||
//Creating array of points: extremities of wires
|
//Creating array of vertices: extremities of wires
|
||||||
TColgp_SequenceOfPnt PntSeq;
|
TopTools_SequenceOfShape VerSeq;
|
||||||
|
|
||||||
//????????????
|
|
||||||
//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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
//Building missing bounds
|
//Building missing bounds
|
||||||
TopTools_MapOfShape EdgeMap, WireMap;
|
TopTools_ListOfShape EdgeList, WireList;
|
||||||
for (i = 1; i <= myBoundary.Length(); i++)
|
for (i = 1; i <= myBoundary.Length(); i++)
|
||||||
EdgeMap.Add( myBoundary(i).myEdge );
|
EdgeList.Append( myBoundary(i).myEdge );
|
||||||
|
|
||||||
BuildWires( EdgeMap, WireMap );
|
BuildWires( EdgeList, WireList );
|
||||||
FindExtremitiesOfHoles( WireMap, PntSeq );
|
FindExtremitiesOfHoles( WireList, VerSeq );
|
||||||
|
|
||||||
//Searching for surfaces for missing bounds
|
//Searching for surfaces for missing bounds
|
||||||
for (j = 1; j <= myFreeConstraints.Length(); j++)
|
for (j = 1; j <= myFreeConstraints.Length(); j++)
|
||||||
@ -489,9 +565,13 @@ void BRepFill_Filling::Build()
|
|||||||
Handle( Geom_Surface ) CurSurface = BRep_Tool::Surface( HSurf->ChangeSurface().Face() );
|
Handle( Geom_Surface ) CurSurface = BRep_Tool::Surface( HSurf->ChangeSurface().Face() );
|
||||||
//BRepTopAdaptor_FClass2d Classifier( CurFace, Precision::Confusion() );
|
//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())
|
if (Projector.LowerDistance() > Precision::Confusion())
|
||||||
continue;
|
continue;
|
||||||
Projector.LowerDistanceParameters( U1, V1 );
|
Projector.LowerDistanceParameters( U1, V1 );
|
||||||
@ -502,8 +582,9 @@ void BRepFill_Filling::Build()
|
|||||||
if (State == TopAbs_OUT || State == TopAbs_UNKNOWN)
|
if (State == TopAbs_OUT || State == TopAbs_UNKNOWN)
|
||||||
continue;
|
continue;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Projector.Init( PntSeq.Value(i+1), CurSurface );
|
gp_Pnt LastPnt = BRep_Tool::Pnt(LastVtx);
|
||||||
|
Projector.Init( LastPnt, CurSurface );
|
||||||
if (Projector.LowerDistance() > Precision::Confusion())
|
if (Projector.LowerDistance() > Precision::Confusion())
|
||||||
continue;
|
continue;
|
||||||
Projector.LowerDistanceParameters( U2, V2 );
|
Projector.LowerDistanceParameters( U2, V2 );
|
||||||
@ -520,11 +601,11 @@ void BRepFill_Filling::Build()
|
|||||||
Points(1) = gp_Pnt2d( U1, V1 );
|
Points(1) = gp_Pnt2d( U1, V1 );
|
||||||
Points(2) = gp_Pnt2d( U2, V2 );
|
Points(2) = gp_Pnt2d( U2, V2 );
|
||||||
Handle( Geom2d_BezierCurve ) Line2d = new Geom2d_BezierCurve( Points );
|
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 );
|
Add( E, CurFace, myFreeConstraints(j).myOrder );
|
||||||
PntSeq.Remove( i, i+1 );
|
VerSeq.Remove( i, i+1 );
|
||||||
break;
|
break;
|
||||||
} //for (i = 1; i <= PntSeq.Length(); i += 2)
|
} //for (i = 1; i <= VerSeq.Length(); i += 2)
|
||||||
} //for (j = 1; j <= myFreeConstraints.Length(); j++)
|
} //for (j = 1; j <= myFreeConstraints.Length(); j++)
|
||||||
|
|
||||||
//Load initial surface to myBuilder if it is given
|
//Load initial surface to myBuilder if it is given
|
||||||
@ -562,8 +643,6 @@ void BRepFill_Filling::Build()
|
|||||||
|
|
||||||
TColgp_SequenceOfXY S2d;
|
TColgp_SequenceOfXY S2d;
|
||||||
TColgp_SequenceOfXYZ S3d;
|
TColgp_SequenceOfXYZ S3d;
|
||||||
S2d.Clear();
|
|
||||||
S3d.Clear();
|
|
||||||
myBuilder.Disc2dContour(4,S2d);
|
myBuilder.Disc2dContour(4,S2d);
|
||||||
myBuilder.Disc3dContour(4,0,S3d);
|
myBuilder.Disc3dContour(4,0,S3d);
|
||||||
seuil = Max( myTol3d, 10*myBuilder.G0Error() ); //????????
|
seuil = Max( myTol3d, 10*myBuilder.G0Error() ); //????????
|
||||||
@ -578,103 +657,129 @@ void BRepFill_Filling::Build()
|
|||||||
//Approx.Dump( cout );
|
//Approx.Dump( cout );
|
||||||
Surface = Approx.Surface();
|
Surface = Approx.Surface();
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Wire W;
|
|
||||||
//Preparing EdgeMap for method BuildWires
|
|
||||||
EdgeMap.Clear();
|
|
||||||
WireMap.Clear();
|
|
||||||
PntSeq.Clear();
|
|
||||||
BRep_Builder B;
|
|
||||||
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)
|
//Build the final wire and final face
|
||||||
{
|
TopTools_ListOfShape FinalEdges;
|
||||||
GeomAPI_ProjectPointOnSurf Projector;
|
Handle(TColGeom2d_HArray1OfCurve) CurvesOnPlate = myBuilder.Curves2d();
|
||||||
Quantity_Parameter U1, V1, U2, V2;
|
BRep_Builder BB;
|
||||||
|
for (i = 1; i <= myBoundary.Length(); i++)
|
||||||
Projector.Init( PntSeq.Value(i), Surface );
|
{
|
||||||
Projector.LowerDistanceParameters( U1, V1 );
|
const TopoDS_Edge& InitEdge = myBoundary(i).myEdge;
|
||||||
Projector.Init( PntSeq.Value(i+1), Surface );
|
TopoDS_Edge anEdge = InitEdge;
|
||||||
Projector.LowerDistanceParameters( U2, V2 );
|
if (!myOldNewMap(anEdge).IsEmpty())
|
||||||
|
anEdge = TopoDS::Edge( myOldNewMap(anEdge).First() );
|
||||||
//Making the edge on the resulting surface
|
Handle(Geom2d_Curve) aCurveOnPlate = CurvesOnPlate->Value(i);
|
||||||
TColgp_Array1OfPnt2d Points( 1, 2 );
|
|
||||||
Points(1) = gp_Pnt2d( U1, V1 );
|
TopoDS_Edge NewEdge = TopoDS::Edge(anEdge.EmptyCopied());
|
||||||
Points(2) = gp_Pnt2d( U2, V2 );
|
NewEdge.Closed(anEdge.Closed());
|
||||||
Handle( Geom2d_BezierCurve ) Line2d = new Geom2d_BezierCurve( Points );
|
TopoDS_Vertex V1, V2;
|
||||||
TopoDS_Edge E = BRepLib_MakeEdge( Line2d, Surface, Line2d->FirstParameter(), Line2d->LastParameter() );
|
TopExp::Vertices(anEdge, V1, V2, Standard_True); //with orientation
|
||||||
|
BB.UpdateVertex(V1, dmax);
|
||||||
B.UpdateVertex( TopExp::FirstVertex(E), dmax );
|
BB.UpdateVertex(V2, dmax);
|
||||||
B.UpdateVertex( TopExp::LastVertex(E), dmax );
|
BB.Add(NewEdge, V1);
|
||||||
BRepLib::BuildCurve3d( E );
|
BB.Add(NewEdge, V2);
|
||||||
EdgeMap.Add( E );
|
TopLoc_Location Loc;
|
||||||
}
|
BB.UpdateEdge(NewEdge, aCurveOnPlate, Surface, Loc, dmax);
|
||||||
WireMap.Clear();
|
//BRepLib::SameRange(NewEdge);
|
||||||
BuildWires( EdgeMap, WireMap );
|
BRepLib::SameParameter(NewEdge, dmax, Standard_True);
|
||||||
MapIt.Initialize( WireMap );
|
FinalEdges.Append(NewEdge);
|
||||||
W = TopoDS::Wire( MapIt.Key() );
|
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");
|
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
|
Standard_Boolean BRepFill_Filling::IsDone() const
|
||||||
{
|
{
|
||||||
return myIsDone;
|
return myIsDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Face
|
||||||
|
//purpose : returns the result
|
||||||
|
//======================================================================
|
||||||
TopoDS_Face BRepFill_Filling::Face() const
|
TopoDS_Face BRepFill_Filling::Face() const
|
||||||
{
|
{
|
||||||
return myFace;
|
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
|
Standard_Real BRepFill_Filling::G0Error() const
|
||||||
{
|
{
|
||||||
return myBuilder.G0Error();
|
return myBuilder.G0Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : G1Error
|
||||||
|
//purpose : returns maximum angle between the resulting surface
|
||||||
|
// and constraint surfaces at boundaries
|
||||||
|
//======================================================================
|
||||||
Standard_Real BRepFill_Filling::G1Error() const
|
Standard_Real BRepFill_Filling::G1Error() const
|
||||||
{
|
{
|
||||||
return myBuilder.G1Error();
|
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
|
Standard_Real BRepFill_Filling::G2Error() const
|
||||||
{
|
{
|
||||||
return myBuilder.G2Error();
|
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 )
|
Standard_Real BRepFill_Filling::G0Error( const Standard_Integer Index )
|
||||||
{
|
{
|
||||||
return myBuilder.G0Error( 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 )
|
Standard_Real BRepFill_Filling::G1Error( const Standard_Integer Index )
|
||||||
{
|
{
|
||||||
return myBuilder.G1Error( 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 )
|
Standard_Real BRepFill_Filling::G2Error( const Standard_Integer Index )
|
||||||
{
|
{
|
||||||
return myBuilder.G2Error( Index );
|
return myBuilder.G2Error( Index );
|
||||||
|
@ -46,6 +46,7 @@ uses
|
|||||||
Face from TopoDS,
|
Face from TopoDS,
|
||||||
Pnt from gp,
|
Pnt from gp,
|
||||||
Shape from GeomAbs,
|
Shape from GeomAbs,
|
||||||
|
ListOfShape from TopTools,
|
||||||
Filling from BRepFill
|
Filling from BRepFill
|
||||||
|
|
||||||
raises
|
raises
|
||||||
@ -202,6 +203,14 @@ is
|
|||||||
is redefined;
|
is redefined;
|
||||||
--- Purpose: Tests whether computation of the filling plate has been completed.
|
--- Purpose: Tests whether computation of the filling plate has been completed.
|
||||||
|
|
||||||
|
Generated (me: in out; S : Shape from TopoDS)
|
||||||
|
---Purpose: Returns the list of shapes generated from the
|
||||||
|
-- shape <S>.
|
||||||
|
---C++: return const &
|
||||||
|
---Level: Public
|
||||||
|
returns ListOfShape from TopTools
|
||||||
|
is redefined;
|
||||||
|
|
||||||
G0Error(me) returns Real from Standard;
|
G0Error(me) returns Real from Standard;
|
||||||
--- Purpose: Returns the maximum distance between the result and
|
--- Purpose: Returns the maximum distance between the result and
|
||||||
-- the constraints. This is set at construction time.
|
-- the constraints. This is set at construction time.
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
#include <BRepOffsetAPI_MakeFilling.ixx>
|
#include <BRepOffsetAPI_MakeFilling.ixx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Constructor
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
BRepOffsetAPI_MakeFilling::BRepOffsetAPI_MakeFilling( const Standard_Integer Degree,
|
BRepOffsetAPI_MakeFilling::BRepOffsetAPI_MakeFilling( const Standard_Integer Degree,
|
||||||
const Standard_Integer NbPtsOnCur,
|
const Standard_Integer NbPtsOnCur,
|
||||||
const Standard_Integer NbIter,
|
const Standard_Integer NbIter,
|
||||||
@ -21,6 +25,10 @@ myFilling( Degree, NbPtsOnCur, NbIter, Anisotropie, Tol2d, Tol3d, TolAng, TolCur
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetConstrParam
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepOffsetAPI_MakeFilling::SetConstrParam( const Standard_Real Tol2d,
|
void BRepOffsetAPI_MakeFilling::SetConstrParam( const Standard_Real Tol2d,
|
||||||
const Standard_Real Tol3d,
|
const Standard_Real Tol3d,
|
||||||
const Standard_Real TolAng,
|
const Standard_Real TolAng,
|
||||||
@ -29,6 +37,10 @@ void BRepOffsetAPI_MakeFilling::SetConstrParam( const Standard_Real Tol2d,
|
|||||||
myFilling.SetConstrParam( Tol2d, Tol3d, TolAng, TolCurv );
|
myFilling.SetConstrParam( Tol2d, Tol3d, TolAng, TolCurv );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetResolParam
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepOffsetAPI_MakeFilling::SetResolParam( const Standard_Integer Degree,
|
void BRepOffsetAPI_MakeFilling::SetResolParam( const Standard_Integer Degree,
|
||||||
const Standard_Integer NbPtsOnCur,
|
const Standard_Integer NbPtsOnCur,
|
||||||
const Standard_Integer NbIter,
|
const Standard_Integer NbIter,
|
||||||
@ -37,17 +49,29 @@ void BRepOffsetAPI_MakeFilling::SetResolParam( const Standard_Integer Degree,
|
|||||||
myFilling.SetResolParam( Degree, NbPtsOnCur, NbIter, Anisotropie );
|
myFilling.SetResolParam( Degree, NbPtsOnCur, NbIter, Anisotropie );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetApproxParam
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepOffsetAPI_MakeFilling::SetApproxParam( const Standard_Integer MaxDeg,
|
void BRepOffsetAPI_MakeFilling::SetApproxParam( const Standard_Integer MaxDeg,
|
||||||
const Standard_Integer MaxSegments )
|
const Standard_Integer MaxSegments )
|
||||||
{
|
{
|
||||||
myFilling.SetApproxParam( MaxDeg, MaxSegments );
|
myFilling.SetApproxParam( MaxDeg, MaxSegments );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : LoadInitSurface
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
void BRepOffsetAPI_MakeFilling::LoadInitSurface( const TopoDS_Face& Surf )
|
void BRepOffsetAPI_MakeFilling::LoadInitSurface( const TopoDS_Face& Surf )
|
||||||
{
|
{
|
||||||
myFilling.LoadInitSurface( Surf );
|
myFilling.LoadInitSurface( Surf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Add
|
||||||
|
//purpose : adds an edge as a constraint
|
||||||
|
//======================================================================
|
||||||
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
|
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
|
||||||
const GeomAbs_Shape Order,
|
const GeomAbs_Shape Order,
|
||||||
const Standard_Boolean IsBound )
|
const Standard_Boolean IsBound )
|
||||||
@ -55,6 +79,10 @@ Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
|
|||||||
return myFilling.Add( Constr, Order, 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,
|
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
|
||||||
const TopoDS_Face& Support,
|
const TopoDS_Face& Support,
|
||||||
const GeomAbs_Shape Order,
|
const GeomAbs_Shape Order,
|
||||||
@ -63,17 +91,29 @@ Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Edge& Constr,
|
|||||||
return myFilling.Add( Constr, Support, Order, IsBound );
|
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,
|
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const TopoDS_Face& Support,
|
||||||
const GeomAbs_Shape Order )
|
const GeomAbs_Shape Order )
|
||||||
{
|
{
|
||||||
return myFilling.Add( Support, Order );
|
return myFilling.Add( Support, Order );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Add
|
||||||
|
//purpose : adds a point constraint
|
||||||
|
//======================================================================
|
||||||
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const gp_Pnt& Point )
|
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const gp_Pnt& Point )
|
||||||
{
|
{
|
||||||
return myFilling.Add( Point );
|
return myFilling.Add( Point );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Add
|
||||||
|
//purpose : adds a point constraint on a face
|
||||||
|
//======================================================================
|
||||||
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const Standard_Real U,
|
Standard_Integer BRepOffsetAPI_MakeFilling::Add( const Standard_Real U,
|
||||||
const Standard_Real V,
|
const Standard_Real V,
|
||||||
const TopoDS_Face& Support,
|
const TopoDS_Face& Support,
|
||||||
@ -83,42 +123,88 @@ Standard_Integer BRepOffsetAPI_MakeFilling::Add( const Standard_Real U,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Build
|
||||||
|
//purpose : builds the resulting face
|
||||||
|
//======================================================================
|
||||||
void BRepOffsetAPI_MakeFilling::Build()
|
void BRepOffsetAPI_MakeFilling::Build()
|
||||||
{
|
{
|
||||||
myFilling.Build();
|
myFilling.Build();
|
||||||
myShape = myFilling.Face();
|
myShape = myFilling.Face();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsDone
|
||||||
|
//purpose :
|
||||||
|
//======================================================================
|
||||||
Standard_Boolean BRepOffsetAPI_MakeFilling::IsDone() const
|
Standard_Boolean BRepOffsetAPI_MakeFilling::IsDone() const
|
||||||
{
|
{
|
||||||
return myFilling.IsDone();
|
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
|
Standard_Real BRepOffsetAPI_MakeFilling::G0Error() const
|
||||||
{
|
{
|
||||||
return myFilling.G0Error();
|
return myFilling.G0Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : G1Error
|
||||||
|
//purpose : returns maximum angle between the resulting surface
|
||||||
|
// and constraint surfaces at boundaries
|
||||||
|
//======================================================================
|
||||||
Standard_Real BRepOffsetAPI_MakeFilling::G1Error() const
|
Standard_Real BRepOffsetAPI_MakeFilling::G1Error() const
|
||||||
{
|
{
|
||||||
return myFilling.G1Error();
|
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
|
Standard_Real BRepOffsetAPI_MakeFilling::G2Error() const
|
||||||
{
|
{
|
||||||
return myFilling.G2Error();
|
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 )
|
Standard_Real BRepOffsetAPI_MakeFilling::G0Error( const Standard_Integer Index )
|
||||||
{
|
{
|
||||||
return myFilling.G0Error( 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 )
|
Standard_Real BRepOffsetAPI_MakeFilling::G1Error( const Standard_Integer Index )
|
||||||
{
|
{
|
||||||
return myFilling.G1Error( 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 )
|
Standard_Real BRepOffsetAPI_MakeFilling::G2Error( const Standard_Integer Index )
|
||||||
{
|
{
|
||||||
return myFilling.G2Error( Index );
|
return myFilling.G2Error( Index );
|
||||||
|
@ -1679,6 +1679,29 @@ Standard_Integer build3d(Draw_Interpretor& di,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : reducepcurves
|
||||||
|
//purpose : remove pcurves that are unused in this shape
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Integer reducepcurves(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n, const char** a)
|
||||||
|
{
|
||||||
|
if (n < 2) return 1;
|
||||||
|
|
||||||
|
Standard_Integer i;
|
||||||
|
for (i = 1; i < n; i++)
|
||||||
|
{
|
||||||
|
TopoDS_Shape aShape = DBRep::Get(a[i]);
|
||||||
|
if (aShape.IsNull())
|
||||||
|
//cout << a[i] << " is not a valid shape" << endl;
|
||||||
|
di << a[i] << " is not a valid shape" << "\n";
|
||||||
|
else
|
||||||
|
BRepTools::RemoveUnusedPCurves(aShape);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : CurveCommands
|
//function : CurveCommands
|
||||||
@ -1786,6 +1809,10 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
|
|||||||
"build3d S [tol]",
|
"build3d S [tol]",
|
||||||
build3d, g);
|
build3d, g);
|
||||||
|
|
||||||
|
theCommands.Add("reducepcurves",
|
||||||
|
"reducepcurves shape1 shape2 ...",
|
||||||
|
reducepcurves, g);
|
||||||
|
|
||||||
theCommands.Add("concatwire",
|
theCommands.Add("concatwire",
|
||||||
"concatwire result wire [option](G1/C1)",
|
"concatwire result wire [option](G1/C1)",
|
||||||
__FILE__,
|
__FILE__,
|
||||||
|
@ -469,9 +469,9 @@ static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, cons
|
|||||||
TolCurv,
|
TolCurv,
|
||||||
MaxDeg,
|
MaxDeg,
|
||||||
MaxSegments );
|
MaxSegments );
|
||||||
TopoDS_Shape aLocalFace(DBRep::Get( a[5], TopAbs_FACE ) );
|
//TopoDS_Shape aLocalFace(DBRep::Get( a[5], TopAbs_FACE ) );
|
||||||
TopoDS_Face InitFace = TopoDS::Face( aLocalFace);
|
//TopoDS_Face InitFace = TopoDS::Face( aLocalFace);
|
||||||
// TopoDS_Face InitFace = TopoDS::Face( DBRep::Get( a[5], TopAbs_FACE ) );
|
TopoDS_Face InitFace = TopoDS::Face( DBRep::Get(a[5], TopAbs_FACE) );
|
||||||
if (! InitFace.IsNull())
|
if (! InitFace.IsNull())
|
||||||
MakeFilling.LoadInitSurface( InitFace );
|
MakeFilling.LoadInitSurface( InitFace );
|
||||||
|
|
||||||
@ -484,14 +484,14 @@ static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, cons
|
|||||||
{
|
{
|
||||||
E.Nullify();
|
E.Nullify();
|
||||||
F.Nullify();
|
F.Nullify();
|
||||||
TopoDS_Shape aLocalEdge(DBRep::Get( a[i], TopAbs_EDGE ));
|
//TopoDS_Shape aLocalEdge(DBRep::Get( a[i], TopAbs_EDGE ));
|
||||||
E = TopoDS::Edge(aLocalEdge);
|
//E = TopoDS::Edge(aLocalEdge);
|
||||||
// E = TopoDS::Edge( DBRep::Get( a[i], TopAbs_EDGE ) );
|
E = TopoDS::Edge( DBRep::Get(a[i], TopAbs_EDGE) );
|
||||||
if (! E.IsNull())
|
if (! E.IsNull())
|
||||||
i++;
|
i++;
|
||||||
aLocalFace = DBRep::Get( a[i], TopAbs_FACE ) ;
|
//aLocalFace = DBRep::Get( a[i], TopAbs_FACE ) ;
|
||||||
F = TopoDS::Face(aLocalFace);
|
//F = TopoDS::Face(aLocalFace);
|
||||||
// F = TopoDS::Face( DBRep::Get( a[i], TopAbs_FACE ) );
|
F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
|
||||||
if (! F.IsNull())
|
if (! F.IsNull())
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
@ -517,18 +517,18 @@ static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, cons
|
|||||||
{
|
{
|
||||||
E.Nullify();
|
E.Nullify();
|
||||||
F.Nullify();
|
F.Nullify();
|
||||||
TopoDS_Shape aLocalEdge(DBRep::Get( a[i++], TopAbs_EDGE ));
|
//TopoDS_Shape aLocalEdge(DBRep::Get( a[i++], TopAbs_EDGE ));
|
||||||
E = TopoDS::Edge( aLocalEdge);
|
//E = TopoDS::Edge( aLocalEdge);
|
||||||
// E = TopoDS::Edge( DBRep::Get( a[i++], TopAbs_EDGE ) );
|
E = TopoDS::Edge( DBRep::Get(a[i++], TopAbs_EDGE) );
|
||||||
if (E.IsNull())
|
if (E.IsNull())
|
||||||
{
|
{
|
||||||
//cout<<"Wrong parameters"<<endl;
|
//cout<<"Wrong parameters"<<endl;
|
||||||
di<<"Wrong parameters"<<"\n";
|
di<<"Wrong parameters"<<"\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TopoDS_Shape alocalFace(DBRep::Get( a[i], TopAbs_FACE ) );
|
//TopoDS_Shape alocalFace(DBRep::Get( a[i], TopAbs_FACE ) );
|
||||||
F = TopoDS::Face( aLocalFace);
|
//F = TopoDS::Face( alocalFace);
|
||||||
// F = TopoDS::Face( DBRep::Get( a[i], TopAbs_FACE ) );
|
F = TopoDS::Face( DBRep::Get(a[i], TopAbs_FACE) );
|
||||||
if (! F.IsNull())
|
if (! F.IsNull())
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
@ -549,9 +549,9 @@ static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, cons
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Standard_Real U = atof( a[i++] ), V = atof( a[i++] );
|
Standard_Real U = atof( a[i++] ), V = atof( a[i++] );
|
||||||
aLocalFace = DBRep::Get( a[i++], TopAbs_FACE );
|
//aLocalFace = DBRep::Get( a[i++], TopAbs_FACE );
|
||||||
F = TopoDS::Face( aLocalFace);
|
//F = TopoDS::Face( aLocalFace);
|
||||||
// F = TopoDS::Face( DBRep::Get( a[i++], TopAbs_FACE ));
|
F = TopoDS::Face( DBRep::Get(a[i++], TopAbs_FACE));
|
||||||
if (F.IsNull())
|
if (F.IsNull())
|
||||||
{
|
{
|
||||||
//cout<<"Wrong parameters"<<endl;
|
//cout<<"Wrong parameters"<<endl;
|
||||||
|
@ -196,6 +196,9 @@ is
|
|||||||
-- and removes all polygons on triangulations of the
|
-- and removes all polygons on triangulations of the
|
||||||
-- edges.
|
-- edges.
|
||||||
|
|
||||||
|
RemoveUnusedPCurves(S: Shape from TopoDS);
|
||||||
|
---Purpose: Removes all the pcurves of the edges of <S> that
|
||||||
|
-- refer to surfaces not belonging to any face of <S>
|
||||||
|
|
||||||
Triangulation(S: Shape from TopoDS; deflec: Real)
|
Triangulation(S: Shape from TopoDS; deflec: Real)
|
||||||
returns Boolean from Standard;
|
returns Boolean from Standard;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <Poly_Triangulation.hxx>
|
#include <Poly_Triangulation.hxx>
|
||||||
#include <Poly_PolygonOnTriangulation.hxx>
|
#include <Poly_PolygonOnTriangulation.hxx>
|
||||||
#include <TColStd_HArray1OfInteger.hxx>
|
#include <TColStd_HArray1OfInteger.hxx>
|
||||||
|
#include <TColStd_MapOfTransient.hxx>
|
||||||
|
|
||||||
#include <gp_Lin2d.hxx>
|
#include <gp_Lin2d.hxx>
|
||||||
#include <ElCLib.hxx>
|
#include <ElCLib.hxx>
|
||||||
@ -747,7 +748,58 @@ void BRepTools::Clean(const TopoDS_Shape& S)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : RemoveUnusedPCurves
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BRepTools::RemoveUnusedPCurves(const TopoDS_Shape& S)
|
||||||
|
{
|
||||||
|
TColStd_MapOfTransient UsedSurfaces;
|
||||||
|
|
||||||
|
TopExp_Explorer Explo(S, TopAbs_FACE);
|
||||||
|
for (; Explo.More(); Explo.Next())
|
||||||
|
{
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(Explo.Current());
|
||||||
|
TopLoc_Location aLoc;
|
||||||
|
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace, aLoc);
|
||||||
|
UsedSurfaces.Add(aSurf);
|
||||||
|
}
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape Emap;
|
||||||
|
TopExp::MapShapes(S, TopAbs_EDGE, Emap);
|
||||||
|
|
||||||
|
Standard_Integer i;
|
||||||
|
for (i = 1; i <= Emap.Extent(); i++)
|
||||||
|
{
|
||||||
|
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &Emap(i).TShape());
|
||||||
|
BRep_ListOfCurveRepresentation& lcr = TE -> ChangeCurves();
|
||||||
|
BRep_ListIteratorOfListOfCurveRepresentation itrep(lcr );
|
||||||
|
while (itrep.More())
|
||||||
|
{
|
||||||
|
Standard_Boolean ToRemove = Standard_False;
|
||||||
|
|
||||||
|
Handle(BRep_CurveRepresentation) CurveRep = itrep.Value();
|
||||||
|
if (CurveRep->IsCurveOnSurface())
|
||||||
|
{
|
||||||
|
Handle(Geom_Surface) aSurface = CurveRep->Surface();
|
||||||
|
if (!UsedSurfaces.Contains(aSurface))
|
||||||
|
ToRemove = Standard_True;
|
||||||
|
}
|
||||||
|
else if (CurveRep->IsRegularity())
|
||||||
|
{
|
||||||
|
Handle(Geom_Surface) Surf1 = CurveRep->Surface();
|
||||||
|
Handle(Geom_Surface) Surf2 = CurveRep->Surface2();
|
||||||
|
ToRemove = (!UsedSurfaces.Contains(Surf1) || !UsedSurfaces.Contains(Surf2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ToRemove)
|
||||||
|
lcr.Remove(itrep);
|
||||||
|
else
|
||||||
|
itrep.Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Triangulation
|
//function : Triangulation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user