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

0032330: Modeling Algorithms - Extend Offset algorithm with Progress Indicator and User Break

Add progress indicator to BRepOffset_MakeOffset::MakeOffsetShape().
This commit is contained in:
akaftasev 2021-03-18 19:44:11 +03:00 committed by smoskvin
parent 13b36bb14f
commit 7c6fecf9a8
20 changed files with 1085 additions and 408 deletions

View File

@ -140,7 +140,8 @@ static void BuildAncestors (const TopoDS_Shape& S,
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Analyse::Perform (const TopoDS_Shape& S, void BRepOffset_Analyse::Perform (const TopoDS_Shape& S,
const Standard_Real Angle) const Standard_Real Angle,
const Message_ProgressRange& theRange)
{ {
myShape = S; myShape = S;
myNewFaces .Clear(); myNewFaces .Clear();
@ -155,9 +156,14 @@ void BRepOffset_Analyse::Perform (const TopoDS_Shape& S,
BuildAncestors (S,myAncestors); BuildAncestors (S,myAncestors);
TopTools_ListOfShape aLETang; TopTools_ListOfShape aLETang;
TopExp_Explorer Exp(S.Oriented(TopAbs_FORWARD),TopAbs_EDGE); TopExp_Explorer Exp(S.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
for ( ; Exp.More(); Exp.Next()) { Message_ProgressScope aPSOuter(theRange, NULL, 2);
Message_ProgressScope aPS(aPSOuter.Next(), "Performing edges analysis", 1, Standard_True);
for ( ; Exp.More(); Exp.Next(), aPS.Next()) {
if (!aPS.More())
{
return;
}
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current()); const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
if (!myMapEdgeType.IsBound(E)) { if (!myMapEdgeType.IsBound(E)) {
BRepOffset_ListOfInterval LI; BRepOffset_ListOfInterval LI;
@ -196,7 +202,11 @@ void BRepOffset_Analyse::Perform (const TopoDS_Shape& S,
} }
} }
TreatTangentFaces (aLETang); TreatTangentFaces (aLETang, aPSOuter.Next());
if (!aPSOuter.More())
{
return;
}
myDone = Standard_True; myDone = Standard_True;
} }
@ -204,7 +214,7 @@ void BRepOffset_Analyse::Perform (const TopoDS_Shape& S,
//function : Generated //function : Generated
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Analyse::TreatTangentFaces (const TopTools_ListOfShape& theLE) void BRepOffset_Analyse::TreatTangentFaces (const TopTools_ListOfShape& theLE, const Message_ProgressRange& theRange)
{ {
if (theLE.IsEmpty() || myFaceOffsetMap.IsEmpty()) if (theLE.IsEmpty() || myFaceOffsetMap.IsEmpty())
{ {
@ -221,8 +231,14 @@ void BRepOffset_Analyse::TreatTangentFaces (const TopTools_ListOfShape& theLE)
// Bind vertices of the tangent edges with connected edges // Bind vertices of the tangent edges with connected edges
// of the face with smaller offset value // of the face with smaller offset value
TopTools_DataMapOfShapeShape aDMVEMin; TopTools_DataMapOfShapeShape aDMVEMin;
for (TopTools_ListOfShape::Iterator it (theLE); it.More(); it.Next()) Message_ProgressScope aPSOuter(theRange, NULL, 3);
Message_ProgressScope aPS1(aPSOuter.Next(), "Binding vertices with connected edges", theLE.Size());
for (TopTools_ListOfShape::Iterator it (theLE); it.More(); it.Next(), aPS1.Next())
{ {
if (!aPS1.More())
{
return;
}
const TopoDS_Shape& aE = it.Value(); const TopoDS_Shape& aE = it.Value();
const TopTools_ListOfShape& aLA = Ancestors (aE); const TopTools_ListOfShape& aLA = Ancestors (aE);
@ -266,8 +282,13 @@ void BRepOffset_Analyse::TreatTangentFaces (const TopTools_ListOfShape& theLE)
// Create map of Face ancestors for the vertices on tangent edges // Create map of Face ancestors for the vertices on tangent edges
TopTools_DataMapOfShapeListOfShape aDMVFAnc; TopTools_DataMapOfShapeListOfShape aDMVFAnc;
for (TopTools_ListOfShape::Iterator itE (theLE); itE.More(); itE.Next()) Message_ProgressScope aPS2(aPSOuter.Next(), "Creating map of Face ancestors", theLE.Size());
for (TopTools_ListOfShape::Iterator itE (theLE); itE.More(); itE.Next(), aPS2.Next())
{ {
if (!aPS2.More())
{
return;
}
const TopoDS_Shape& aE = itE.Value(); const TopoDS_Shape& aE = itE.Value();
if (!anEdgeOffsetMap.IsBound (aE)) if (!anEdgeOffsetMap.IsBound (aE))
continue; continue;
@ -315,8 +336,13 @@ void BRepOffset_Analyse::TreatTangentFaces (const TopTools_ListOfShape& theLE)
BOPTools_AlgoTools::MakeConnexityBlocks (aCETangent, TopAbs_VERTEX, TopAbs_EDGE, aLCB, aMVEMap); BOPTools_AlgoTools::MakeConnexityBlocks (aCETangent, TopAbs_VERTEX, TopAbs_EDGE, aLCB, aMVEMap);
// Analyze each block to find co-planar edges // Analyze each block to find co-planar edges
for (TopTools_ListOfListOfShape::Iterator itLCB (aLCB); itLCB.More(); itLCB.Next()) Message_ProgressScope aPS3(aPSOuter.Next(), "Analyzing blocks to find co-planar edges", aLCB.Size());
for (TopTools_ListOfListOfShape::Iterator itLCB (aLCB); itLCB.More(); itLCB.Next(), aPS3.Next())
{ {
if (!aPS3.More())
{
return;
}
const TopTools_ListOfShape& aCB = itLCB.Value(); const TopTools_ListOfShape& aCB = itLCB.Value();
TopTools_MapOfShape aMFence; TopTools_MapOfShape aMFence;

View File

@ -33,6 +33,9 @@
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <Message_ProgressRange.hxx>
class TopoDS_Shape; class TopoDS_Shape;
class TopoDS_Edge; class TopoDS_Edge;
class TopoDS_Vertex; class TopoDS_Vertex;
@ -59,7 +62,8 @@ public: //! @name Performing analysis
//! Performs the analysis //! Performs the analysis
Standard_EXPORT void Perform (const TopoDS_Shape& theS, Standard_EXPORT void Perform (const TopoDS_Shape& theS,
const Standard_Real theAngle); const Standard_Real theAngle,
const Message_ProgressRange& theRange = Message_ProgressRange());
public: //! @name Results public: //! @name Results
@ -171,7 +175,7 @@ private: //! @name Treatment of tangential cases
//! Treatment of the tangential cases. //! Treatment of the tangential cases.
//! @param theEdges List of edges connecting tangent faces //! @param theEdges List of edges connecting tangent faces
Standard_EXPORT void TreatTangentFaces (const TopTools_ListOfShape& theEdges); Standard_EXPORT void TreatTangentFaces (const TopTools_ListOfShape& theEdges, const Message_ProgressRange& theRange);
private: //! @name Fields private: //! @name Fields

View File

@ -28,7 +28,8 @@ enum BRepOffset_Error
BRepOffset_NotConnectedShell, BRepOffset_NotConnectedShell,
BRepOffset_CannotTrimEdges, //!< exception while trim edges BRepOffset_CannotTrimEdges, //!< exception while trim edges
BRepOffset_CannotFuseVertices, //!< exception while fuse vertices BRepOffset_CannotFuseVertices, //!< exception while fuse vertices
BRepOffset_CannotExtentEdge //!< exception while extent edges BRepOffset_CannotExtentEdge, //!< exception while extent edges
BRepOffset_UserBreak //!< user break
}; };
#endif // _BRepOffset_Error_HeaderFile #endif // _BRepOffset_Error_HeaderFile

View File

@ -1572,7 +1572,8 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopTools_IndexedMapOfShape& NewEdges, const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol, const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges, const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV) TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange)
{ {
#ifdef DRAW #ifdef DRAW
NbF2d++; NbF2d++;
@ -1600,7 +1601,12 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
Standard_Integer j, i = 1; Standard_Integer j, i = 1;
BRepAdaptor_Surface BAsurf(F); BRepAdaptor_Surface BAsurf(F);
// //
for ( it1LE.Initialize(LE) ; it1LE.More(); it1LE.Next()) { Message_ProgressScope aPS(theRange, "Intersecting edges on faces", LE.Size());
for ( it1LE.Initialize(LE) ; it1LE.More(); it1LE.Next(), aPS.Next()) {
if (!aPS.More())
{
return;
}
const TopoDS_Edge& E1 = TopoDS::Edge(it1LE.Value()); const TopoDS_Edge& E1 = TopoDS::Edge(it1LE.Value());
j = 1; j = 1;
it2LE.Initialize(LE); it2LE.Initialize(LE);
@ -1670,18 +1676,23 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
TopTools_IndexedMapOfShape& FacesWithVerts, TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV, BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges, TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV) TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange)
{ {
TopTools_DataMapOfShapeListOfShape MVE; TopTools_DataMapOfShapeListOfShape MVE;
BRepOffset_Tool::MapVertexEdges(FI,MVE); BRepOffset_Tool::MapVertexEdges(FI,MVE);
Message_ProgressScope aPS(theRange, "Intersecting edges obtained as intersection of faces", 1, Standard_True);
//--------------------- //---------------------
// Extension of edges. // Extension of edges.
//--------------------- //---------------------
TopoDS_Edge NE; TopoDS_Edge NE;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape it(MVE); TopTools_DataMapIteratorOfDataMapOfShapeListOfShape it(MVE);
for ( ; it.More(); it.Next()) { for ( ; it.More(); it.Next()) {
if (!aPS.More())
{
return Standard_False;
}
const TopTools_ListOfShape& L = it.Value(); const TopTools_ListOfShape& L = it.Value();
Standard_Boolean YaBuild = 0; Standard_Boolean YaBuild = 0;
TopTools_ListIteratorOfListOfShape itL(L); TopTools_ListIteratorOfListOfShape itL(L);
@ -1712,9 +1723,13 @@ Standard_Boolean 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);
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(), aPS.Next()) {
if (!aPS.More())
{
return Standard_False;
}
const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); const TopoDS_Wire& W = TopoDS::Wire(exp.Current());
BRepTools_WireExplorer wexp; BRepTools_WireExplorer wexp;
Standard_Boolean end = Standard_False ; Standard_Boolean end = Standard_False ;
@ -1871,7 +1886,8 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol, const Standard_Real Tol,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV) TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange)
{ {
TopoDS_Face FIO = TopoDS::Face(OFI.Face()); TopoDS_Face FIO = TopoDS::Face(OFI.Face());
if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO)); if (MES.IsBound(FIO)) FIO = TopoDS::Face(MES(FIO));
@ -1886,8 +1902,13 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// //
BRepAdaptor_Surface BAsurf(FIO); BRepAdaptor_Surface BAsurf(FIO);
// //
Message_ProgressScope aPS(theRange, "Intersecting edges created from vertices", 1, Standard_True);
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(), aPS.Next()) {
if (!aPS.More())
{
return;
}
const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); const TopoDS_Wire& W = TopoDS::Wire(exp.Current());
// //
BRepTools_WireExplorer wexp; BRepTools_WireExplorer wexp;

View File

@ -21,6 +21,7 @@
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx> #include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <Message_ProgressRange.hxx>
class BRepAlgo_AsDes; class BRepAlgo_AsDes;
class BRepAlgo_Image; class BRepAlgo_Image;
@ -49,7 +50,8 @@ public:
const TopTools_IndexedMapOfShape& NewEdges, const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol, const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges, const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV); TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
//! Computes the intersection between the offset edges of the <FI>. //! Computes the intersection between the offset edges of the <FI>.
//! All intersection vertices will be stored in AsDes2d. //! All intersection vertices will be stored in AsDes2d.
@ -68,7 +70,8 @@ public:
TopTools_IndexedMapOfShape& FacesWithVerts, TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV, BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges, TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV); TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
//! Computes the intersection between the offset edges generated //! Computes the intersection between the offset edges generated
//! from vertices and stored into AsDes as descendants of the <FI>. //! from vertices and stored into AsDes as descendants of the <FI>.
@ -84,7 +87,8 @@ public:
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Tol, const Standard_Real Tol,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV); TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Message_ProgressRange& theRange);
//! Fuses the chains of vertices in the theDMVV //! Fuses the chains of vertices in the theDMVV
//! and updates AsDes by replacing the old vertices //! and updates AsDes by replacing the old vertices

View File

@ -105,8 +105,9 @@ static void ExtentEdge(const TopoDS_Face& /*F*/,
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::CompletInt(const TopTools_ListOfShape& SetOfFaces, void BRepOffset_Inter3d::CompletInt (const TopTools_ListOfShape& SetOfFaces,
const BRepAlgo_Image& InitOffsetFace) const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange)
{ {
//--------------------------------------------------------------- //---------------------------------------------------------------
// Calculate the intersections of offset faces // Calculate the intersections of offset faces
@ -145,9 +146,13 @@ void BRepOffset_Inter3d::CompletInt(const TopTools_ListOfShape& SetOfFaces,
// Treat the selected pairs // Treat the selected pairs
const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aSelector.Pairs(); const std::vector<BOPTools_BoxPairSelector::PairIDs>& aPairs = aSelector.Pairs();
const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size()); const Standard_Integer aNbPairs = static_cast<Standard_Integer> (aPairs.size());
Message_ProgressScope aPS(theRange, "Complete intersection", aNbPairs);
for (Standard_Integer iPair = 0; iPair < aNbPairs; ++iPair) for (Standard_Integer iPair = 0; iPair < aNbPairs; ++iPair, aPS.Next())
{ {
if (!aPS.More())
{
return;
}
const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair]; const BOPTools_BoxPairSelector::PairIDs& aPair = aPairs[iPair];
const TopoDS_Face& aF1 = TopoDS::Face (aMFaces.FindKey (Min (aPair.ID1, aPair.ID2))); const TopoDS_Face& aF1 = TopoDS::Face (aMFaces.FindKey (Min (aPair.ID1, aPair.ID2)));
@ -250,9 +255,10 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces*/, void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces*/,
const TopoDS_Shape& ShapeInit, const TopoDS_Shape& ShapeInit,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace) const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange)
{ {
ChFiDS_TypeOfConcavity OT = ChFiDS_Concave; ChFiDS_TypeOfConcavity OT = ChFiDS_Concave;
if (mySide == TopAbs_OUT) OT = ChFiDS_Convex; if (mySide == TopAbs_OUT) OT = ChFiDS_Convex;
@ -261,12 +267,17 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
TopoDS_Face F1,F2; TopoDS_Face F1,F2;
TopoDS_Edge NullEdge; TopoDS_Edge NullEdge;
TopoDS_Face NullFace; TopoDS_Face NullFace;
Message_ProgressScope aPSOuter(theRange, NULL, 2);
Message_ProgressScope aPSIntF(aPSOuter.Next(), "Intersecting offset faces", 1, Standard_True);
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// etape 1 : Intersection of faces // corresponding to the initial faces // etape 1 : Intersection of faces // corresponding to the initial faces
// separated by a concave edge if offset > 0, otherwise convex. // separated by a concave edge if offset > 0, otherwise convex.
//--------------------------------------------------------------------- //---------------------------------------------------------------------
for (; Exp.More(); Exp.Next()) { for (; Exp.More(); Exp.Next(), aPSIntF.Next()) {
if (!aPSIntF.More())
{
return;
}
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current()); const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
const BRepOffset_ListOfInterval& L = Analyse.Type(E); const BRepOffset_ListOfInterval& L = Analyse.Type(E);
if (!L.IsEmpty() && L.First().Type() == OT) { if (!L.IsEmpty() && L.First().Type() == OT) {
@ -294,8 +305,12 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
//--------------------------------------------------------------------- //---------------------------------------------------------------------
TopoDS_Vertex V[2]; TopoDS_Vertex V[2];
TopTools_ListIteratorOfListOfShape it; TopTools_ListIteratorOfListOfShape it;
Message_ProgressScope aPSIntT(aPSOuter.Next(), "Intersecting tubes", 1, Standard_True);
for (Exp.Init(ShapeInit,TopAbs_EDGE); Exp.More(); Exp.Next()) { for (Exp.Init(ShapeInit,TopAbs_EDGE); Exp.More(); Exp.Next(), aPSIntT.Next()) {
if (!aPSIntT.More())
{
return;
}
const TopoDS_Edge& E1 = TopoDS::Edge(Exp.Current()); const TopoDS_Edge& E1 = TopoDS::Edge(Exp.Current());
if (InitOffsetFace.HasImage(E1)) { if (InitOffsetFace.HasImage(E1)) {
//--------------------------- //---------------------------
@ -402,6 +417,7 @@ void BRepOffset_Inter3d::ConnexIntByInt
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build, TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed, TopTools_ListOfShape& Failed,
const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar) const Standard_Boolean bIsPlanar)
{ {
TopTools_IndexedMapOfShape VEmap; TopTools_IndexedMapOfShape VEmap;
@ -414,6 +430,7 @@ void BRepOffset_Inter3d::ConnexIntByInt
// //
TopExp::MapShapes (SI, TopAbs_EDGE, VEmap); TopExp::MapShapes (SI, TopAbs_EDGE, VEmap);
// Take the vertices for treatment // Take the vertices for treatment
Message_ProgressScope aPSOuter(theRange, NULL, 10);
if (bIsPlanar) if (bIsPlanar)
{ {
aNb = VEmap.Extent(); aNb = VEmap.Extent();
@ -461,6 +478,10 @@ void BRepOffset_Inter3d::ConnexIntByInt
// Analyze faces connected through vertices // Analyze faces connected through vertices
for (i = aNb + 1, aNb = VEmap.Extent(); i <= aNb; ++i) for (i = aNb + 1, aNb = VEmap.Extent(); i <= aNb; ++i)
{ {
if (!aPSOuter.More())
{
return;
}
const TopoDS_Shape& aS = VEmap(i); const TopoDS_Shape& aS = VEmap(i);
if (aS.ShapeType() != TopAbs_VERTEX) if (aS.ShapeType() != TopAbs_VERTEX)
continue; continue;
@ -560,7 +581,12 @@ void BRepOffset_Inter3d::ConnexIntByInt
} }
// //
aNb = VEmap.Extent(); aNb = VEmap.Extent();
for (i = 1; i <= aNb; ++i) { Message_ProgressScope aPSInter(aPSOuter.Next(8), "Intersecting offset faces", aNb);
for (i = 1; i <= aNb; ++i, aPSInter.Next()) {
if (!aPSInter.More())
{
return;
}
const TopoDS_Shape& aS = VEmap(i); const TopoDS_Shape& aS = VEmap(i);
// //
TopoDS_Edge E; TopoDS_Edge E;
@ -721,7 +747,12 @@ void BRepOffset_Inter3d::ConnexIntByInt
// //
// create unique intersection for each localized shared part // create unique intersection for each localized shared part
aNb = aDMIntE.Extent(); aNb = aDMIntE.Extent();
for (i = 1; i <= aNb; ++i) { Message_ProgressScope aPSPostTreat(aPSOuter.Next(2), "Creating unique intersection", aNb);
for (i = 1; i <= aNb; ++i, aPSPostTreat.Next()) {
if (!aPSPostTreat.More())
{
return;
}
const TopTools_ListOfShape& aLS = aDMIntE(i); const TopTools_ListOfShape& aLS = aDMIntE(i);
if (aLS.Extent() < 2) { if (aLS.Extent() < 2) {
continue; continue;
@ -893,6 +924,7 @@ void BRepOffset_Inter3d::ContextIntByInt
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
TopTools_DataMapOfShapeShape& Build, TopTools_DataMapOfShapeShape& Build,
TopTools_ListOfShape& Failed, TopTools_ListOfShape& Failed,
const Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar) const Standard_Boolean bIsPlanar)
{ {
TopTools_MapOfShape MV; TopTools_MapOfShape MV;
@ -916,7 +948,12 @@ void BRepOffset_Inter3d::ContextIntByInt
} }
TopAbs_State Side = TopAbs_OUT; TopAbs_State Side = TopAbs_OUT;
for (i = 1; i <= aNb; i++) { Message_ProgressScope aPS(theRange, "Intersecting with deepening faces", aNb);
for (i = 1; i <= aNb; i++, aPS.Next()) {
if (!aPS.More())
{
return;
}
const TopoDS_Face& CF = TopoDS::Face(ContextFaces(i)); const TopoDS_Face& CF = TopoDS::Face(ContextFaces(i));
if (ExtentContext) WCF = TopoDS::Face(MES(CF)); if (ExtentContext) WCF = TopoDS::Face(MES(CF));
else WCF = CF; else WCF = CF;
@ -1076,13 +1113,12 @@ void BRepOffset_Inter3d::ContextIntByInt
//function : ContextIntByArc //function : ContextIntByArc
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& ContextFaces, void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean InSide, const Standard_Boolean InSide,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace, const BRepAlgo_Image& InitOffsetFace,
BRepAlgo_Image& InitOffsetEdge) BRepAlgo_Image& InitOffsetEdge,
const Message_ProgressRange& theRange)
{ {
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1,LInt2;
TopTools_MapOfShape MV; TopTools_MapOfShape MV;
@ -1099,7 +1135,12 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
myTouched.Add(CF); myTouched.Add(CF);
} }
for (j = 1; j <= ContextFaces.Extent(); j++) { Message_ProgressScope aPS(theRange, "Intersecting with deepening faces", ContextFaces.Extent());
for (j = 1; j <= ContextFaces.Extent(); j++, aPS.Next()) {
if (!aPS.More())
{
return;
}
const TopoDS_Face& CF = TopoDS::Face(ContextFaces(j)); const TopoDS_Face& CF = TopoDS::Face(ContextFaces(j));
for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE); for (exp.Init(CF.Oriented(TopAbs_FORWARD),TopAbs_EDGE);
exp.More(); exp.Next()) { exp.More(); exp.Next()) {
@ -1271,21 +1312,10 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
} }
} }
//=======================================================================
//function : AddCommonEdges
//purpose :
//=======================================================================
void BRepOffset_Inter3d::AddCommonEdges(const TopTools_ListOfShape&)
{
}
//======================================================================= //=======================================================================
//function : SetDone //function : SetDone
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::SetDone(const TopoDS_Face& F1, void BRepOffset_Inter3d::SetDone(const TopoDS_Face& F1,
const TopoDS_Face& F2) const TopoDS_Face& F2)
{ {
@ -1301,15 +1331,12 @@ void BRepOffset_Inter3d::SetDone(const TopoDS_Face& F1,
myDone(F2).Append(F1); myDone(F2).Append(F1);
} }
//======================================================================= //=======================================================================
//function : IsDone //function : IsDone
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BRepOffset_Inter3d::IsDone(const TopoDS_Face& F1,
Standard_Boolean BRepOffset_Inter3d::IsDone(const TopoDS_Face& F1, const TopoDS_Face& F2) const
const TopoDS_Face& F2)
const
{ {
if (myDone.IsBound(F1)) { if (myDone.IsBound(F1)) {
TopTools_ListIteratorOfListOfShape it (myDone(F1)); TopTools_ListIteratorOfListOfShape it (myDone(F1));
@ -1320,46 +1347,10 @@ const
return Standard_False; return Standard_False;
} }
//=======================================================================
//function : TouchedFaces
//purpose :
//=======================================================================
TopTools_IndexedMapOfShape& BRepOffset_Inter3d::TouchedFaces()
{
return myTouched;
}
//=======================================================================
//function : AsDes
//purpose :
//=======================================================================
Handle(BRepAlgo_AsDes) BRepOffset_Inter3d::AsDes() const
{
return myAsDes;
}
//=======================================================================
//function : NewEdges
//purpose :
//=======================================================================
TopTools_IndexedMapOfShape& BRepOffset_Inter3d::NewEdges()
{
return myNewEdges;
}
//======================================================================= //=======================================================================
//function : Store //function : Store
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_Inter3d::Store(const TopoDS_Face& F1, void BRepOffset_Inter3d::Store(const TopoDS_Face& F1,
const TopoDS_Face& F2, const TopoDS_Face& F2,
const TopTools_ListOfShape& LInt1, const TopTools_ListOfShape& LInt1,

View File

@ -17,6 +17,7 @@
#ifndef _BRepOffset_Inter3d_HeaderFile #ifndef _BRepOffset_Inter3d_HeaderFile
#define _BRepOffset_Inter3d_HeaderFile #define _BRepOffset_Inter3d_HeaderFile
#include <Message_ProgressRange.hxx>
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
@ -36,70 +37,99 @@ class TopoDS_Shape;
class BRepOffset_Analyse; class BRepOffset_Analyse;
//! Computes the intersection face face in a set of faces
//! Store the result in a SD as AsDes. //! Computes the connection of the offset and not offset faces
class BRepOffset_Inter3d //! according to the connection type required.
//! Store the result in AsDes tool.
class BRepOffset_Inter3d
{ {
public: public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
public:
Standard_EXPORT BRepOffset_Inter3d(const Handle(BRepAlgo_AsDes)& AsDes, const TopAbs_State Side, const Standard_Real Tol);
//! Constructor
Standard_EXPORT void CompletInt (const TopTools_ListOfShape& SetOfFaces, const BRepAlgo_Image& InitOffsetFace); Standard_EXPORT BRepOffset_Inter3d (const Handle (BRepAlgo_AsDes)& AsDes,
const TopAbs_State Side,
Standard_EXPORT void FaceInter (const TopoDS_Face& F1, const TopoDS_Face& F2, const BRepAlgo_Image& InitOffsetFace); const Standard_Real Tol);
Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces, const TopoDS_Shape& ShapeInit, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace); // Computes intersection of the given faces among each other
Standard_EXPORT void CompletInt (const TopTools_ListOfShape& SetOfFaces,
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); const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange);
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);
//! Computes intersection of pair of faces
Standard_EXPORT void ContextIntByArc (const TopTools_IndexedMapOfShape& ContextFaces, const Standard_Boolean ExtentContext, const BRepOffset_Analyse& Analyse, const BRepAlgo_Image& InitOffsetFace, BRepAlgo_Image& InitOffsetEdge); Standard_EXPORT void FaceInter (const TopoDS_Face& F1,
const TopoDS_Face& F2,
Standard_EXPORT void AddCommonEdges (const TopTools_ListOfShape& SetOfFaces); const BRepAlgo_Image& InitOffsetFace);
//! Computes connections of the offset faces that have to be connected by arcs.
Standard_EXPORT void ConnexIntByArc (const TopTools_ListOfShape& SetOfFaces,
const TopoDS_Shape& ShapeInit,
const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace,
const Message_ProgressRange& theRange);
//! Computes intersection of the offset faces that have to be connected by
//! sharp edges, i.e. it computes intersection between extended offset faces.
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 Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar = Standard_False);
//! Computes intersection with not offset faces .
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 Message_ProgressRange& theRange,
const Standard_Boolean bIsPlanar = Standard_False);
//! Computes connections of the not offset faces that have to be connected by arcs
Standard_EXPORT void ContextIntByArc (const TopTools_IndexedMapOfShape& ContextFaces,
const Standard_Boolean ExtentContext,
const BRepOffset_Analyse& Analyse,
const BRepAlgo_Image& InitOffsetFace,
BRepAlgo_Image& InitOffsetEdge,
const Message_ProgressRange& theRange);
//! Marks the pair of faces as already intersected
Standard_EXPORT void SetDone (const TopoDS_Face& F1, const TopoDS_Face& F2); Standard_EXPORT void SetDone (const TopoDS_Face& F1, const TopoDS_Face& F2);
Standard_EXPORT Standard_Boolean IsDone (const TopoDS_Face& F1, const TopoDS_Face& F2) const;
Standard_EXPORT TopTools_IndexedMapOfShape& TouchedFaces();
Standard_EXPORT Handle(BRepAlgo_AsDes) AsDes() const;
Standard_EXPORT TopTools_IndexedMapOfShape& NewEdges();
protected:
//! Checks if the pair of faces has already been treated.
Standard_EXPORT Standard_Boolean IsDone (const TopoDS_Face& F1,
const TopoDS_Face& F2) const;
//! Returns touched faces
TopTools_IndexedMapOfShape& TouchedFaces() { return myTouched; };
//! Returns AsDes tool
Handle (BRepAlgo_AsDes) AsDes() const { return myAsDes; }
//! Returns new edges
TopTools_IndexedMapOfShape& NewEdges() { return myNewEdges; }
private: private:
//! Stores the intersection results into AsDes
Standard_EXPORT void Store (const TopoDS_Face& F1, const TopoDS_Face& F2, const TopTools_ListOfShape& LInt1, const TopTools_ListOfShape& LInt2); Standard_EXPORT void Store (const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopTools_ListOfShape& LInt1,
const TopTools_ListOfShape& LInt2);
private:
Handle(BRepAlgo_AsDes) myAsDes; Handle (BRepAlgo_AsDes) myAsDes;
TopTools_IndexedMapOfShape myTouched; TopTools_IndexedMapOfShape myTouched;
TopTools_DataMapOfShapeListOfShape myDone; TopTools_DataMapOfShapeListOfShape myDone;
TopTools_IndexedMapOfShape myNewEdges; TopTools_IndexedMapOfShape myNewEdges;
TopAbs_State mySide; TopAbs_State mySide;
Standard_Real myTol; Standard_Real myTol;
}; };
#endif // _BRepOffset_Inter3d_HeaderFile #endif // _BRepOffset_Inter3d_HeaderFile

View File

@ -52,15 +52,21 @@ BRepOffset_MakeLoops::BRepOffset_MakeLoops()
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF, void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image, BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV) BRepAlgo_Image& theImageVV,
const Message_ProgressRange& theRange)
{ {
TopTools_ListIteratorOfListOfShape it(LF); TopTools_ListIteratorOfListOfShape it(LF);
TopTools_ListIteratorOfListOfShape itl,itLCE; TopTools_ListIteratorOfListOfShape itl,itLCE;
BRepAlgo_Loop Loops; BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute( myVerVerMap ); Loops.VerticesForSubstitute( myVerVerMap );
Loops.SetImageVV (theImageVV); Loops.SetImageVV (theImageVV);
Message_ProgressScope aPSOuter(theRange, NULL, 2);
for (; it.More(); it.Next()) { Message_ProgressScope aPS1(aPSOuter.Next(), "Init loops", LF.Size());
for (; it.More(); it.Next(), aPS1.Next()) {
if (!aPS1.More())
{
return;
}
const TopoDS_Face& F = TopoDS::Face(it.Value()); const TopoDS_Face& F = TopoDS::Face(it.Value());
//--------------------------- //---------------------------
// Initialization of Loops. // Initialization of Loops.
@ -124,44 +130,49 @@ void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
if (myVerVerMap.IsEmpty()) if (myVerVerMap.IsEmpty())
return; return;
BRep_Builder BB; BRep_Builder BB;
for (it.Initialize( LF ); it.More(); it.Next()) Message_ProgressScope aPS2(aPSOuter.Next(), "Building loops", LF.Size());
for (it.Initialize(LF); it.More(); it.Next(), aPS2.Next())
{
if (!aPS2.More())
{ {
TopoDS_Shape F = it.Value(); return;
TopTools_ListOfShape LIF;
Image.LastImage( F, LIF );
for (itl.Initialize(LIF); itl.More(); itl.Next())
{
const TopoDS_Shape& IF = itl.Value();
TopExp_Explorer EdExp( IF, TopAbs_EDGE );
for (; EdExp.More(); EdExp.Next())
{
TopoDS_Shape E = EdExp.Current();
TopTools_ListOfShape VList;
TopoDS_Iterator VerExp( E );
for (; VerExp.More(); VerExp.Next())
VList.Append( VerExp.Value() );
TopTools_ListIteratorOfListOfShape itlv( VList );
for (; itlv.More(); itlv.Next())
{
const TopoDS_Shape& V = itlv.Value();
if (myVerVerMap.IsBound( V ))
{
TopoDS_Shape NewV = myVerVerMap( V );
E.Free( Standard_True );
NewV.Orientation( V.Orientation() );
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
if (TV->Tolerance() > NewTV->Tolerance())
NewTV->Tolerance( TV->Tolerance() );
NewTV->ChangePoints().Append( TV->ChangePoints() );
AsDes->Replace( V, NewV );
BB.Remove( E, V );
BB.Add( E, NewV );
}
}
}
}
} }
TopoDS_Shape F = it.Value();
TopTools_ListOfShape LIF;
Image.LastImage(F, LIF);
for (itl.Initialize(LIF); itl.More(); itl.Next())
{
const TopoDS_Shape& IF = itl.Value();
TopExp_Explorer EdExp(IF, TopAbs_EDGE);
for (; EdExp.More(); EdExp.Next())
{
TopoDS_Shape E = EdExp.Current();
TopTools_ListOfShape VList;
TopoDS_Iterator VerExp(E);
for (; VerExp.More(); VerExp.Next())
VList.Append(VerExp.Value());
TopTools_ListIteratorOfListOfShape itlv(VList);
for (; itlv.More(); itlv.Next())
{
const TopoDS_Shape& V = itlv.Value();
if (myVerVerMap.IsBound(V))
{
TopoDS_Shape NewV = myVerVerMap(V);
E.Free(Standard_True);
NewV.Orientation(V.Orientation());
Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
Handle(BRep_TVertex)& NewTV = *((Handle(BRep_TVertex)*) &NewV.TShape());
if (TV->Tolerance() > NewTV->Tolerance())
NewTV->Tolerance(TV->Tolerance());
NewTV->ChangePoints().Append(TV->ChangePoints());
AsDes->Replace(V, NewV);
BB.Remove(E, V);
BB.Add(E, NewV);
}
}
}
}
}
} }
//======================================================================= //=======================================================================
@ -196,10 +207,11 @@ static Standard_Boolean IsBetweenCorks(const TopoDS_Shape& E,
//======================================================================= //=======================================================================
void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext, void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image, BRepAlgo_Image& Image,
const Standard_Boolean InSide) const Standard_Boolean InSide,
const Message_ProgressRange& theRange)
{ {
//----------------------------------------- //-----------------------------------------
// unwinding of caps. // unwinding of caps.
@ -211,7 +223,12 @@ void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext
TopExp_Explorer exp; TopExp_Explorer exp;
TopTools_MapOfShape MapExtent; TopTools_MapOfShape MapExtent;
for (; it.More(); it.Next()) { Message_ProgressScope aPS(theRange, "Building deepening faces", LContext.Extent());
for (; it.More(); it.Next(), aPS.Next()) {
if (!aPS.More())
{
return;
}
const TopoDS_Face& F = TopoDS::Face(it.Value()); const TopoDS_Face& F = TopoDS::Face(it.Value());
TopTools_MapOfShape MBound; TopTools_MapOfShape MBound;
//----------------------------------------------- //-----------------------------------------------
@ -383,7 +400,8 @@ void BRepOffset_MakeLoops::BuildOnContext(const TopTools_ListOfShape& LContext
void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF, void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image) BRepAlgo_Image& Image,
const Message_ProgressRange& theRange)
{ {
TopTools_ListIteratorOfListOfShape itr,itl,itLCE; TopTools_ListIteratorOfListOfShape itr,itl,itLCE;
Standard_Boolean ToRebuild; Standard_Boolean ToRebuild;
@ -394,7 +412,12 @@ void BRepOffset_MakeLoops::BuildFaces(const TopTools_ListOfShape& LF,
//---------------------------------- //----------------------------------
// Loop on all faces //. // Loop on all faces //.
//---------------------------------- //----------------------------------
for (itr.Initialize(LF); itr.More(); itr.Next()) { Message_ProgressScope aPS(theRange, "Building faces", LF.Size());
for (itr.Initialize(LF); itr.More(); itr.Next(), aPS.Next()) {
if (!aPS.More())
{
return;
}
TopoDS_Face F = TopoDS::Face(itr.Value()); TopoDS_Face F = TopoDS::Face(itr.Value());
Loops.Init(F); Loops.Init(F);
ToRebuild = Standard_False; ToRebuild = Standard_False;

View File

@ -17,6 +17,8 @@
#ifndef _BRepOffset_MakeLoops_HeaderFile #ifndef _BRepOffset_MakeLoops_HeaderFile
#define _BRepOffset_MakeLoops_HeaderFile #define _BRepOffset_MakeLoops_HeaderFile
#include <Message_ProgressRange.hxx>
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_DefineAlloc.hxx> #include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx> #include <Standard_Handle.hxx>
@ -42,17 +44,20 @@ public:
Standard_EXPORT void Build (const TopTools_ListOfShape& LF, Standard_EXPORT void Build (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image, BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV); BRepAlgo_Image& theImageVV,
const Message_ProgressRange& theRange);
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext, Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image, BRepAlgo_Image& Image,
const Standard_Boolean InSide); const Standard_Boolean InSide,
const Message_ProgressRange& theRange);
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF, Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image); BRepAlgo_Image& Image,
const Message_ProgressRange& theRange);

View File

@ -241,6 +241,46 @@ static void DEBVerticesControl (const TopTools_IndexedMapOfShape& NewEdges,
} }
#endif #endif
namespace
{
//=======================================================================
//function : BRepOffset_PIOperation
//purpose : List of operations to be supported by the Progress Indicator
//=======================================================================
enum BRepOffset_PIOperation
{
PIOperation_CheckInputData = 0,
PIOperation_Analyse,
PIOperation_BuildOffsetBy,
PIOperation_Intersection,
PIOperation_MakeMissingWalls,
PIOperation_MakeShells,
PIOperation_MakeSolid,
PIOperation_Sewing,
PIOperation_Last
};
//=======================================================================
//function : normalizeSteps
//purpose : Normalization of progress steps
//=======================================================================
static void normalizeSteps(const Standard_Real theWhole,
TColStd_Array1OfReal& theSteps)
{
Standard_Real aSum = 0.;
for (Standard_Integer i = theSteps.Lower(); i <= theSteps.Upper(); ++i)
{
aSum += theSteps(i);
}
// Normalize steps
for (Standard_Integer i = theSteps.Lower(); i <= theSteps.Upper(); ++i)
{
theSteps(i) = theWhole * theSteps(i) / aSum;
}
}
}
//======================================================================= //=======================================================================
// static methods // static methods
@ -256,7 +296,8 @@ static
static static
Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF, Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
BRepAlgo_Image& theImage, BRepAlgo_Image& theImage,
TopoDS_Shape& theShells); TopoDS_Shape& theShells,
const Message_ProgressRange& theRange);
static static
Standard_Boolean GetSubShapes(const TopoDS_Shape& theShape, Standard_Boolean GetSubShapes(const TopoDS_Shape& theShape,
@ -581,13 +622,14 @@ BRepOffset_MakeOffset::BRepOffset_MakeOffset()
BRepOffset_MakeOffset::BRepOffset_MakeOffset(const TopoDS_Shape& S, BRepOffset_MakeOffset::BRepOffset_MakeOffset(const TopoDS_Shape& S,
const Standard_Real Offset, const Standard_Real Offset,
const Standard_Real Tol, const Standard_Real Tol,
const BRepOffset_Mode Mode, const BRepOffset_Mode Mode,
const Standard_Boolean Inter, const Standard_Boolean Inter,
const Standard_Boolean SelfInter, const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join, const GeomAbs_JoinType Join,
const Standard_Boolean Thickening, const Standard_Boolean Thickening,
const Standard_Boolean RemoveIntEdges) const Standard_Boolean RemoveIntEdges,
const Message_ProgressRange& theRange)
: :
myOffset (Offset), myOffset (Offset),
myTol (Tol), myTol (Tol),
@ -604,7 +646,7 @@ myDone (Standard_False)
myAsDes = new BRepAlgo_AsDes(); myAsDes = new BRepAlgo_AsDes();
myIsLinearizationAllowed = Standard_True; myIsLinearizationAllowed = Standard_True;
MakeOffsetShape(); MakeOffsetShape(theRange);
} }
@ -835,7 +877,7 @@ void BRepOffset_MakeOffset::SetFacesWithOffset()
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeOffsetShape() void BRepOffset_MakeOffset::MakeOffsetShape(const Message_ProgressRange& theRange)
{ {
myDone = Standard_False; myDone = Standard_False;
// //
@ -857,7 +899,12 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
RemoveCorks (myFaceComp, myFaces); RemoveCorks (myFaceComp, myFaces);
} }
if (!CheckInputData()) Message_ProgressScope aPS(theRange, "Making offset shape", 100);
TColStd_Array1OfReal aSteps(0, PIOperation_Last - 1);
analyzeProgress(100., aSteps);
if (!CheckInputData(aPS.Next(aSteps(PIOperation_CheckInputData))) || myError != BRepOffset_NoError)
{ {
// There is error in input data. // There is error in input data.
// Check Error() method. // Check Error() method.
@ -879,7 +926,12 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
myAnalyse.SetOffsetValue (myOffset); myAnalyse.SetOffsetValue (myOffset);
myAnalyse.SetFaceOffsetMap (myFaceOffset); myAnalyse.SetFaceOffsetMap (myFaceOffset);
} }
myAnalyse.Perform(myFaceComp,TolAngle); myAnalyse.Perform(myFaceComp,TolAngle, aPS.Next(aSteps(PIOperation_Analyse)));
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
//--------------------------------------------------- //---------------------------------------------------
// Construction of Offset from preanalysis. // Construction of Offset from preanalysis.
//--------------------------------------------------- //---------------------------------------------------
@ -889,9 +941,9 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
UpdateFaceOffset(); UpdateFaceOffset();
if (myJoin == GeomAbs_Arc) if (myJoin == GeomAbs_Arc)
BuildOffsetByArc(); BuildOffsetByArc(aPS.Next(aSteps(PIOperation_BuildOffsetBy)));
else if (myJoin == GeomAbs_Intersection) else if (myJoin == GeomAbs_Intersection)
BuildOffsetByInter(); BuildOffsetByInter(aPS.Next(aSteps(PIOperation_BuildOffsetBy)));
if (myError != BRepOffset_NoError) if (myError != BRepOffset_NoError)
{ {
return; return;
@ -903,32 +955,71 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
//----------------- //-----------------
// Intersection 3d . // Intersection 3d .
//----------------- //-----------------
Message_ProgressScope aPSInter(aPS.Next(aSteps(PIOperation_Intersection)), NULL, 100);
aPSInter.SetName((myJoin == GeomAbs_Arc) ? "Connect offset faces by arc" :
"Connect offset faces by intersection");
BRepOffset_Inter3d Inter(myAsDes,Side,myTol); BRepOffset_Inter3d Inter(myAsDes,Side,myTol);
Intersection3D (Inter); Intersection3D (Inter, aPSInter.Next(90));
if (myError != BRepOffset_NoError)
{
return;
}
//----------------- //-----------------
// Intersection2D // Intersection2D
//----------------- //-----------------
TopTools_IndexedMapOfShape& Modif = Inter.TouchedFaces(); TopTools_IndexedMapOfShape& Modif = Inter.TouchedFaces();
TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges(); TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges();
if (!Modif.IsEmpty()) Intersection2D (Modif,NewEdges); if (!Modif.IsEmpty())
{
Intersection2D(Modif, NewEdges, aPSInter.Next(4));
if (myError != BRepOffset_NoError)
{
return;
}
}
//------------------------------------------------------- //-------------------------------------------------------
// Unwinding 2D and reconstruction of modified faces // Unwinding 2D and reconstruction of modified faces
//---------------------------------------------------- //----------------------------------------------------
MakeLoops (Modif); MakeLoops (Modif, aPSInter.Next(4));
if (myError != BRepOffset_NoError)
{
return;
}
//----------------------------------------------------- //-----------------------------------------------------
// Reconstruction of non modified faces sharing // Reconstruction of non modified faces sharing
// reconstructed edges // reconstructed edges
//------------------------------------------------------ //------------------------------------------------------
if (!Modif.IsEmpty()) MakeFaces (Modif); if (!Modif.IsEmpty())
{
MakeFaces(Modif, aPSInter.Next(2));
if (myError != BRepOffset_NoError)
{
return;
}
}
aPSInter.Close();
if (myThickening) if (myThickening)
MakeMissingWalls(); {
MakeMissingWalls(aPS.Next(aSteps(PIOperation_MakeMissingWalls)));
if (myError != BRepOffset_NoError)
{
return;
}
}
//------------------------- //-------------------------
// Construction of shells. // Construction of shells.
//------------------------- //-------------------------
MakeShells (); MakeShells (aPS.Next(aSteps(PIOperation_MakeShells)));
if (myError != BRepOffset_NoError)
{
return;
}
if (myOffsetShape.IsNull()) { if (myOffsetShape.IsNull()) {
// not done // not done
myDone = Standard_False; myDone = Standard_False;
@ -955,8 +1046,11 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
//---------------------- //----------------------
// Creation of solids. // Creation of solids.
//---------------------- //----------------------
MakeSolid (); MakeSolid (aPS.Next(aSteps(PIOperation_MakeSolid)));
if (myError != BRepOffset_NoError)
{
return;
}
//----------------------------- //-----------------------------
// MAJ Tolerance edge and Vertex // MAJ Tolerance edge and Vertex
// ---------------------------- // ----------------------------
@ -973,13 +1067,22 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
{ {
BRepBuilderAPI_Sewing aSew(myTol); BRepBuilderAPI_Sewing aSew(myTol);
aSew.Add(myOffsetShape); aSew.Add(myOffsetShape);
aSew.Perform(); aSew.Perform(aPS.Next(aSteps(PIOperation_Sewing) / 2.));
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
myOffsetShape = aSew.SewedShape(); myOffsetShape = aSew.SewedShape();
// Rebuild solid. // Rebuild solid.
// Offset shape expected to be really closed after sewing. // Offset shape expected to be really closed after sewing.
myOffsetShape.Closed(Standard_True); myOffsetShape.Closed(Standard_True);
MakeSolid(); MakeSolid(aPS.Next(aSteps(PIOperation_Sewing) / 2.));
if (myError != BRepOffset_NoError)
{
return;
}
} }
myDone = Standard_True; myDone = Standard_True;
@ -992,12 +1095,12 @@ void BRepOffset_MakeOffset::MakeOffsetShape()
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeThickSolid() void BRepOffset_MakeOffset::MakeThickSolid(const Message_ProgressRange& theRange)
{ {
//-------------------------------------------------------------- //--------------------------------------------------------------
// Construction of shell parallel to shell (initial without cap). // Construction of shell parallel to shell (initial without cap).
//-------------------------------------------------------------- //--------------------------------------------------------------
MakeOffsetShape (); MakeOffsetShape (theRange);
if (!myDone) if (!myDone)
{ {
@ -1115,7 +1218,7 @@ const TopoDS_Shape& BRepOffset_MakeOffset::Shape() const
//function : MakeOffsetFaces //function : MakeOffsetFaces
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF) void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF, const Message_ProgressRange& theRange)
{ {
Standard_Real aCurOffset; Standard_Real aCurOffset;
TopTools_ListOfShape aLF; TopTools_ListOfShape aLF;
@ -1126,8 +1229,14 @@ void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& the
// //
BRepLib::SortFaces(myFaceComp, aLF); BRepLib::SortFaces(myFaceComp, aLF);
// //
Message_ProgressScope aPS(theRange, "Making offset faces", aLF.Size());
aItLF.Initialize(aLF); aItLF.Initialize(aLF);
for (; aItLF.More(); aItLF.Next()) { for (; aItLF.More(); aItLF.Next(), aPS.Next()) {
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
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); BRepOffset_Offset OF(aF, aCurOffset, ShapeTgt, OffsetOutside, myJoin);
@ -1175,7 +1284,7 @@ void BRepOffset_MakeOffset::MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& the
//function : BuildOffsetByInter //function : BuildOffsetByInter
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::BuildOffsetByInter() void BRepOffset_MakeOffset::BuildOffsetByInter(const Message_ProgressRange& theRange)
{ {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if ( ChronBuild) { if ( ChronBuild) {
@ -1185,14 +1294,57 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
} }
#endif #endif
Message_ProgressScope aPSOuter(theRange, "Connect offset faces by intersection", 100);
// just for better management and visualization of the progress steps
// define a nested enum listing all the steps of the current method.
enum BuildOffsetByInter_PISteps
{
BuildOffsetByInter_MakeOffsetFaces = 0,
BuildOffsetByInter_ConnexIntByInt,
BuildOffsetByInter_ContextIntByInt,
BuildOffsetByInter_IntersectEdges,
BuildOffsetByInter_CompleteEdgesIntersection,
BuildOffsetByInter_BuildFaces,
BuildOffsetByInter_FillHistoryForOffsets,
BuildOffsetByInter_FillHistoryForDeepenings,
BuildOffsetByInter_Last
};
Standard_Real aNbFaces = myFaceComp.NbChildren() + myAnalyse.NewFaces().Extent() + myFaces.Extent();
Standard_Real anOffsetsPart = (myFaceComp.NbChildren() + myAnalyse.NewFaces().Extent()) / aNbFaces;
Standard_Real aDeepeningsPart = myFaces.Extent() / aNbFaces;
TColStd_Array1OfReal aSteps(0, BuildOffsetByInter_Last - 1);
{
aSteps.Init(0);
Standard_Boolean isInter = myJoin == GeomAbs_Intersection;
Standard_Real aFaceInter = isInter ? 25. : 50.;
Standard_Real aBuildFaces = isInter ? 50. : 25.;
aSteps(BuildOffsetByInter_MakeOffsetFaces) = 5.;
aSteps(BuildOffsetByInter_ConnexIntByInt) = aFaceInter * anOffsetsPart;
aSteps(BuildOffsetByInter_ContextIntByInt) = aFaceInter * aDeepeningsPart;
aSteps(BuildOffsetByInter_IntersectEdges) = 10.;
aSteps(BuildOffsetByInter_CompleteEdgesIntersection) = 5.;
aSteps(BuildOffsetByInter_BuildFaces) = aBuildFaces;
aSteps(BuildOffsetByInter_FillHistoryForOffsets) = 5. * anOffsetsPart;
aSteps(BuildOffsetByInter_FillHistoryForDeepenings) = 5. * aDeepeningsPart;
normalizeSteps(100., aSteps);
}
TopExp_Explorer Exp, Exp2, ExpC; TopExp_Explorer Exp, Exp2, ExpC;
TopTools_ListIteratorOfListOfShape itLF; TopTools_ListIteratorOfListOfShape itLF;
//-------------------------------------------------------- //--------------------------------------------------------
// Construction of faces parallel to initial faces // Construction of faces parallel to initial faces
//-------------------------------------------------------- //--------------------------------------------------------
BRepOffset_DataMapOfShapeOffset MapSF; BRepOffset_DataMapOfShapeOffset MapSF;
MakeOffsetFaces(MapSF); MakeOffsetFaces(MapSF, aPSOuter.Next(aSteps(BuildOffsetByInter_MakeOffsetFaces)));
if (!aPSOuter.More())
{
myError = BRepOffset_UserBreak;
return;
}
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// MES : Map of OffsetShape -> Extended Shapes. // MES : Map of OffsetShape -> Extended Shapes.
// Build : Map of Initial SS -> OffsetShape build by Inter. // Build : Map of Initial SS -> OffsetShape build by Inter.
@ -1212,9 +1364,21 @@ 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(myFaceComp,MapSF,myAnalyse,MES,Build,Failed,myIsPlanar); Inter3.ConnexIntByInt(myFaceComp, MapSF, myAnalyse, MES, Build, Failed,
aPSOuter.Next(aSteps(BuildOffsetByInter_ConnexIntByInt)), myIsPlanar);
if (!aPSOuter.More())
{
myError = BRepOffset_UserBreak;
return;
}
// 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,
aPSOuter.Next(aSteps(BuildOffsetByInter_ContextIntByInt)), myIsPlanar);
if (!aPSOuter.More())
{
myError = BRepOffset_UserBreak;
return;
}
TopTools_ListOfShape aLFaces; TopTools_ListOfShape aLFaces;
for (Exp.Init(myFaceComp,TopAbs_FACE) ; Exp.More(); Exp.Next()) for (Exp.Init(myFaceComp,TopAbs_FACE) ; Exp.More(); Exp.Next())
@ -1225,7 +1389,8 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
// Extension of neighbor edges of new edges and intersection between neighbors. // Extension of neighbor edges of new edges and intersection between neighbors.
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
Handle(BRepAlgo_AsDes) AsDes2d = new BRepAlgo_AsDes(); Handle(BRepAlgo_AsDes) AsDes2d = new BRepAlgo_AsDes();
IntersectEdges(aLFaces, MapSF, MES, Build, AsDes, AsDes2d); IntersectEdges(aLFaces, MapSF, MES, Build, AsDes, AsDes2d,
aPSOuter.Next(aSteps(BuildOffsetByInter_IntersectEdges)));
if (myError != BRepOffset_NoError) if (myError != BRepOffset_NoError)
{ {
return; return;
@ -1240,7 +1405,8 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
//Map of edges obtained after FACE-FACE (offsetted) intersection. //Map of edges obtained after FACE-FACE (offsetted) intersection.
//Key1 is edge trimmed by intersection points with other edges; //Key1 is edge trimmed by intersection points with other edges;
//Item is not-trimmed edge. //Item is not-trimmed edge.
if (!TrimEdges(myFaceComp, myOffset, myAnalyse, MapSF, MES, Build, AsDes, AsDes2d, NewEdges, aETrimEInf, anEdgesOrigins)) if (!TrimEdges(myFaceComp, myOffset, myAnalyse, MapSF, MES, Build,
AsDes, AsDes2d, NewEdges, aETrimEInf, anEdgesOrigins))
{ {
myError = BRepOffset_CannotTrimEdges; myError = BRepOffset_CannotTrimEdges;
return; return;
@ -1256,21 +1422,34 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
GetEnlargedFaces(aLFaces, MapSF, MES, aFacesOrigins, IMOE, LFE); GetEnlargedFaces(aLFaces, MapSF, MES, aFacesOrigins, IMOE, LFE);
// //
TopTools_ListIteratorOfListOfShape itLFE(LFE); TopTools_ListIteratorOfListOfShape itLFE(LFE);
Message_ProgressScope aPS2d(aPSOuter.Next(aSteps(BuildOffsetByInter_CompleteEdgesIntersection)), NULL, 2);
Message_ProgressScope aPS2dOffsets(aPS2d.Next(2. * anOffsetsPart), NULL, LFE.Size());
for (; itLFE.More(); itLFE.Next()) for (; itLFE.More(); itLFE.Next())
{ {
if (!aPS2dOffsets.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value()); const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value());
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF); Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF);
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV); BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV, aPS2dOffsets.Next());
} }
//---------------------------------------------- //----------------------------------------------
// Intersections 2d on caps. // Intersections 2d on caps.
//---------------------------------------------- //----------------------------------------------
Standard_Integer i; Standard_Integer i;
Message_ProgressScope aPS2dCaps(aPS2d.Next(2. * aDeepeningsPart), NULL, myFaces.Extent());
for (i = 1; i <= myFaces.Extent(); i++) for (i = 1; i <= myFaces.Extent(); i++)
{ {
if (!aPS2dCaps.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Face& Cork = TopoDS::Face(myFaces(i)); const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork); Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork);
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV); BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV, aPS2dCaps.Next());
} }
// //
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes, myImageVV); BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes, myImageVV);
@ -1281,7 +1460,12 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
TopTools_MapOfShape aMFDone; TopTools_MapOfShape aMFDone;
// //
if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) { if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) {
BuildSplitsOfExtendedFaces(LFE, myAnalyse, AsDes, anEdgesOrigins, aFacesOrigins, aETrimEInf, IMOE); BuildSplitsOfExtendedFaces(LFE, myAnalyse, AsDes, anEdgesOrigins, aFacesOrigins, aETrimEInf,
IMOE, aPSOuter.Next(aSteps(BuildOffsetByInter_BuildFaces)));
if (myError != BRepOffset_NoError)
{
return;
}
// //
TopTools_ListIteratorOfListOfShape aItLF(LFE); TopTools_ListIteratorOfListOfShape aItLF(LFE);
for (; aItLF.More(); aItLF.Next()) { for (; aItLF.More(); aItLF.Next()) {
@ -1290,7 +1474,12 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
} }
} }
else { else {
myMakeLoops.Build(LFE, AsDes, IMOE, myImageVV); myMakeLoops.Build(LFE, AsDes, IMOE, myImageVV, aPSOuter.Next(aSteps(BuildOffsetByInter_BuildFaces)));
if (!aPSOuter.More())
{
myError = BRepOffset_UserBreak;
return;
}
} }
// //
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
@ -1299,8 +1488,15 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
//--------------------------- //---------------------------
// MAJ SD. for faces // // MAJ SD. for faces //
//--------------------------- //---------------------------
for (TopTools_ListOfShape::Iterator it (aLFaces); it.More(); it.Next()) Message_ProgressScope aPSHist(aPSOuter.Next(aSteps(BuildOffsetByInter_FillHistoryForOffsets)),
"Fill history for offset faces", aLFaces.Size());
for (TopTools_ListOfShape::Iterator it (aLFaces); it.More(); it.Next(), aPSHist.Next())
{ {
if (!aPSHist.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Shape& FI = it.Value(); const TopoDS_Shape& FI = it.Value();
myInitOffsetFace.SetRoot(FI); myInitOffsetFace.SetRoot(FI);
TopoDS_Face OF = MapSF(FI).Face(); TopoDS_Face OF = MapSF(FI).Face();
@ -1420,7 +1616,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
TopoDS_Vertex CV1,CV2; TopoDS_Vertex CV1,CV2;
TopExp::Vertices(COE,CV1,CV2); TopExp::Vertices(COE,CV1,CV2);
if (!CV1.IsNull()) myAsDes->Add(COE,CV1.Oriented(TopAbs_FORWARD)); if (!CV1.IsNull()) myAsDes->Add(COE,CV1.Oriented(TopAbs_FORWARD));
if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED)); if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED));
} }
} }
} }
@ -1491,7 +1687,14 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
// MAJ SD. for caps // MAJ SD. for caps
//--------------------------- //---------------------------
//TopTools_MapOfShape View; //TopTools_MapOfShape View;
for (i = 1; i <= myFaces.Extent(); i++) { Message_ProgressScope aPSHist2(aPSOuter.Next(aSteps(BuildOffsetByInter_FillHistoryForDeepenings)),
"Fill history for deepening faces", myFaces.Extent());
for (i = 1; i <= myFaces.Extent(); i++, aPSHist2.Next()) {
if (!aPSHist2.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Shape& Cork = myFaces(i); const TopoDS_Shape& Cork = myFaces(i);
const TopTools_ListOfShape& LE = AsDes->Descendant(Cork); const TopTools_ListOfShape& LE = AsDes->Descendant(Cork);
for (itLF.Initialize(LE) ; itLF.More(); itLF.Next()) { for (itLF.Initialize(LE) ; itLF.More(); itLF.Next()) {
@ -1514,7 +1717,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
TopoDS_Vertex CV1,CV2; TopoDS_Vertex CV1,CV2;
TopExp::Vertices(COE,CV1,CV2); TopExp::Vertices(COE,CV1,CV2);
if (!CV1.IsNull()) myAsDes->Add(COE,CV1.Oriented(TopAbs_FORWARD)); if (!CV1.IsNull()) myAsDes->Add(COE,CV1.Oriented(TopAbs_FORWARD));
if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED)); if (!CV2.IsNull()) myAsDes->Add(COE,CV2.Oriented(TopAbs_REVERSED));
} }
} }
} }
@ -1604,7 +1807,7 @@ void BRepOffset_MakeOffset::BuildFaceComp()
//function : BuildOffsetByArc //function : BuildOffsetByArc
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::BuildOffsetByArc() void BRepOffset_MakeOffset::BuildOffsetByArc(const Message_ProgressRange& theRange)
{ {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if ( ChronBuild) { if ( ChronBuild) {
@ -1617,19 +1820,29 @@ void BRepOffset_MakeOffset::BuildOffsetByArc()
TopExp_Explorer Exp; TopExp_Explorer Exp;
TopTools_ListIteratorOfListOfShape itLF; TopTools_ListIteratorOfListOfShape itLF;
TopTools_MapOfShape Done; TopTools_MapOfShape Done;
Message_ProgressScope aPSOuter(theRange, NULL, 10);
//-------------------------------------------------------- //--------------------------------------------------------
// Construction of faces parallel to initial faces // Construction of faces parallel to initial faces
//-------------------------------------------------------- //--------------------------------------------------------
BRepOffset_DataMapOfShapeOffset MapSF; BRepOffset_DataMapOfShapeOffset MapSF;
MakeOffsetFaces(MapSF); MakeOffsetFaces(MapSF, aPSOuter.Next());
if (myError != BRepOffset_NoError)
{
return;
}
//-------------------------------------------------------- //--------------------------------------------------------
// Construction of tubes on edge. // Construction of tubes on edge.
//-------------------------------------------------------- //--------------------------------------------------------
ChFiDS_TypeOfConcavity OT = ChFiDS_Convex; ChFiDS_TypeOfConcavity OT = ChFiDS_Convex;
if (myOffset < 0.) OT = ChFiDS_Concave; if (myOffset < 0.) OT = ChFiDS_Concave;
for (Exp.Init(myFaceComp,TopAbs_EDGE); Exp.More(); Exp.Next()) { Message_ProgressScope aPS1(aPSOuter.Next(4), "Constructing tubes on edges", 1, Standard_True);
for (Exp.Init(myFaceComp,TopAbs_EDGE); Exp.More(); Exp.Next(), aPS1.Next()) {
if (!aPS1.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Edge& E = TopoDS::Edge(Exp.Current()); const TopoDS_Edge& E = TopoDS::Edge(Exp.Current());
if (Done.Add(E)) { if (Done.Add(E)) {
const TopTools_ListOfShape& Anc = myAnalyse.Ancestors(E); const TopTools_ListOfShape& Anc = myAnalyse.Ancestors(E);
@ -1697,8 +1910,13 @@ void BRepOffset_MakeOffset::BuildOffsetByArc()
//-------------------------------------------------------- //--------------------------------------------------------
Done.Clear(); Done.Clear();
TopTools_ListIteratorOfListOfShape it; TopTools_ListIteratorOfListOfShape it;
Message_ProgressScope aPS2(aPSOuter.Next(4), "Constructing spheres on vertices", 1, Standard_True);
for (Exp.Init(myFaceComp,TopAbs_VERTEX); Exp.More(); Exp.Next()) { for (Exp.Init(myFaceComp,TopAbs_VERTEX); Exp.More(); Exp.Next(), aPS2.Next()) {
if (!aPS2.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Vertex& V = TopoDS::Vertex (Exp.Current()); const TopoDS_Vertex& V = TopoDS::Vertex (Exp.Current());
if (Done.Add(V)) { if (Done.Add(V)) {
const TopTools_ListOfShape& LA = myAnalyse.Ancestors(V); const TopTools_ListOfShape& LA = myAnalyse.Ancestors(V);
@ -1758,7 +1976,13 @@ void BRepOffset_MakeOffset::BuildOffsetByArc()
ChFiDS_TypeOfConcavity RT = ChFiDS_Concave; ChFiDS_TypeOfConcavity RT = ChFiDS_Concave;
if (myOffset < 0.) RT = ChFiDS_Convex; if (myOffset < 0.) RT = ChFiDS_Convex;
BRepOffset_DataMapIteratorOfDataMapOfShapeOffset It(MapSF); BRepOffset_DataMapIteratorOfDataMapOfShapeOffset It(MapSF);
for ( ; It.More(); It.Next()) { Message_ProgressScope aPS3(aPSOuter.Next(), NULL, MapSF.Size());
for ( ; It.More(); It.Next(), aPS3.Next()) {
if (!aPS3.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Shape& SI = It.Key(); const TopoDS_Shape& SI = It.Key();
const BRepOffset_Offset& SF = It.Value(); const BRepOffset_Offset& SF = It.Value();
if (SF.Status() == BRepOffset_Reversed || if (SF.Status() == BRepOffset_Reversed ||
@ -2449,7 +2673,7 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter) void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter, const Message_ProgressRange& theRange)
{ {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if (ChronBuild) { if (ChronBuild) {
@ -2458,6 +2682,7 @@ void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter)
Clock.Start(); Clock.Start();
} }
#endif #endif
Message_ProgressScope aPS(theRange, NULL, (myFaces.Extent() && myJoin == GeomAbs_Arc) ? 2 : 1);
// In the Complete Intersection mode, implemented currently for planar // In the Complete Intersection mode, implemented currently for planar
// solids only, there is no need to intersect the faces here. // solids only, there is no need to intersect the faces here.
@ -2480,13 +2705,18 @@ void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter)
// between the cap and the part. // between the cap and the part.
if (myJoin == GeomAbs_Arc) if (myJoin == GeomAbs_Arc)
Inter.ContextIntByArc (myFaces,InSide,myAnalyse,myInitOffsetFace,myInitOffsetEdge); Inter.ContextIntByArc (myFaces,InSide,myAnalyse,myInitOffsetFace,myInitOffsetEdge, aPS.Next());
} }
if (myInter) { if (myInter) {
//------------- //-------------
//Complete. //Complete.
//------------- //-------------
Inter.CompletInt (OffsetFaces,myInitOffsetFace); Inter.CompletInt (OffsetFaces,myInitOffsetFace, aPS.Next());
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges(); TopTools_IndexedMapOfShape& NewEdges = Inter.NewEdges();
if (myJoin == GeomAbs_Intersection) { if (myJoin == GeomAbs_Intersection) {
BRepOffset_Tool::CorrectOrientation (myFaceComp,NewEdges,myAsDes,myInitOffsetFace,myOffset); BRepOffset_Tool::CorrectOrientation (myFaceComp,NewEdges,myAsDes,myInitOffsetFace,myOffset);
@ -2496,7 +2726,12 @@ void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter)
//-------------------------------- //--------------------------------
// Only between neighbor faces. // Only between neighbor faces.
//-------------------------------- //--------------------------------
Inter.ConnexIntByArc(OffsetFaces,myFaceComp,myAnalyse,myInitOffsetFace); Inter.ConnexIntByArc(OffsetFaces,myFaceComp,myAnalyse,myInitOffsetFace, aPS.Next());
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
} }
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if ( ChronBuild) Clock.Show(); if ( ChronBuild) Clock.Show();
@ -2508,8 +2743,9 @@ void BRepOffset_MakeOffset::Intersection3D(BRepOffset_Inter3d& Inter)
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Modif, void BRepOffset_MakeOffset::Intersection2D (const TopTools_IndexedMapOfShape& Modif,
const TopTools_IndexedMapOfShape& NewEdges) const TopTools_IndexedMapOfShape& NewEdges,
const Message_ProgressRange& theRange)
{ {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if (ChronBuild) { if (ChronBuild) {
@ -2528,9 +2764,15 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Mod
//----------------------------------------------- //-----------------------------------------------
TopTools_IndexedDataMapOfShapeListOfShape aDMVV; TopTools_IndexedDataMapOfShapeListOfShape aDMVV;
Standard_Integer i; Standard_Integer i;
Message_ProgressScope aPS(theRange, "Intersection 2D", Modif.Extent());
for (i = 1; i <= Modif.Extent(); i++) { for (i = 1; i <= Modif.Extent(); i++) {
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
const TopoDS_Face& F = TopoDS::Face(Modif(i)); const TopoDS_Face& F = TopoDS::Face(Modif(i));
BRepOffset_Inter2d::Compute(myAsDes, F, NewEdges, myTol, myEdgeIntEdges, aDMVV); BRepOffset_Inter2d::Compute(myAsDes, F, NewEdges, myTol, myEdgeIntEdges, aDMVV, aPS.Next());
} }
// //
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, myImageVV); BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, myImageVV);
@ -2549,7 +2791,7 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Mod
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif) void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange)
{ {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if (ChronBuild) { if (ChronBuild) {
@ -2569,11 +2811,17 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
LF.Append(Modif(i)); LF.Append(Modif(i));
} }
// //
Message_ProgressScope aPS(theRange, NULL, LF.Extent() + myFaces.Extent());
if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) { if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) {
BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset); BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset, aPS.Next(LF.Extent()));
} }
else { else {
myMakeLoops.Build(LF,myAsDes,myImageOffset,myImageVV); myMakeLoops.Build(LF,myAsDes,myImageOffset,myImageVV, aPS.Next(LF.Extent()));
}
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
} }
//----------------------------------------- //-----------------------------------------
@ -2584,7 +2832,7 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
Standard_Boolean InSide = 1; Standard_Boolean InSide = 1;
if (myOffset > 0 ) InSide = 0; if (myOffset > 0 ) InSide = 0;
myMakeLoops.BuildOnContext(LC,myAnalyse,myAsDes,myImageOffset,InSide); myMakeLoops.BuildOnContext(LC,myAnalyse,myAsDes,myImageOffset,InSide, aPS.Next(LC.Extent()));
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if ( ChronBuild) Clock.Show(); if ( ChronBuild) Clock.Show();
@ -2597,10 +2845,11 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
// share edges that were reconstructed. // share edges that were reconstructed.
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeFaces(TopTools_IndexedMapOfShape& /*Modif*/) void BRepOffset_MakeOffset::MakeFaces (TopTools_IndexedMapOfShape& /*Modif*/,
const Message_ProgressRange& theRange)
{ {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if (ChronBuild) { if (ChronBuild) {
std::cout << " RECONSTRUCTION OF FACES:" << std::endl; std::cout << " RECONSTRUCTION OF FACES:" << std::endl;
Clock.Reset(); Clock.Reset();
Clock.Start(); Clock.Start();
@ -2619,13 +2868,18 @@ void BRepOffset_MakeOffset::MakeFaces(TopTools_IndexedMapOfShape& /*Modif*/)
} }
} }
// //
Message_ProgressScope aPS(theRange, NULL, 1);
if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) { if ((myJoin == GeomAbs_Intersection) && myInter && myIsPlanar) {
BuildSplitsOfTrimmedFaces(LOF, myAsDes, myImageOffset); BuildSplitsOfTrimmedFaces(LOF, myAsDes, myImageOffset, aPS.Next());
} }
else { else {
myMakeLoops.BuildFaces(LOF,myAsDes,myImageOffset); myMakeLoops.BuildFaces(LOF, myAsDes, myImageOffset, aPS.Next());
}
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
} }
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if ( ChronBuild) Clock.Show(); if ( ChronBuild) Clock.Show();
#endif #endif
@ -2672,7 +2926,7 @@ static void UpdateInitOffset (BRepAlgo_Image& myInitOffset,
//function : MakeMissingWalls //function : MakeMissingWalls
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeMissingWalls () void BRepOffset_MakeOffset::MakeMissingWalls (const Message_ProgressRange& theRange)
{ {
TopTools_IndexedDataMapOfShapeListOfShape Contours; //Start vertex + list of connected edges (free boundary) TopTools_IndexedDataMapOfShapeListOfShape Contours; //Start vertex + list of connected edges (free boundary)
TopTools_DataMapOfShapeShape MapEF; //Edges of contours: edge + face TopTools_DataMapOfShapeShape MapEF; //Edges of contours: edge + face
@ -2680,8 +2934,14 @@ void BRepOffset_MakeOffset::MakeMissingWalls ()
FillContours(myFaceComp, myAnalyse, Contours, MapEF); FillContours(myFaceComp, myAnalyse, Contours, MapEF);
for (Standard_Integer ic = 1; ic <= Contours.Extent(); ic++) Message_ProgressScope aPS(theRange, "Making missing walls", Contours.Extent());
for (Standard_Integer ic = 1; ic <= Contours.Extent(); ic++, aPS.Next())
{ {
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
TopoDS_Vertex StartVertex = TopoDS::Vertex(Contours.FindKey(ic)); TopoDS_Vertex StartVertex = TopoDS::Vertex(Contours.FindKey(ic));
TopoDS_Edge StartEdge; TopoDS_Edge StartEdge;
const TopTools_ListOfShape& aContour = Contours(ic); const TopTools_ListOfShape& aContour = Contours(ic);
@ -3105,7 +3365,7 @@ void BRepOffset_MakeOffset::MakeMissingWalls ()
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeShells () void BRepOffset_MakeOffset::MakeShells (const Message_ProgressRange& theRange)
{ {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if (ChronBuild) { if (ChronBuild) {
@ -3115,12 +3375,18 @@ void BRepOffset_MakeOffset::MakeShells ()
} }
#endif #endif
// //
Message_ProgressScope aPS(theRange, "Making shells", 1);
// Prepare list of splits of the offset faces to make the shells // Prepare list of splits of the offset faces to make the shells
TopTools_ListOfShape aLSF; TopTools_ListOfShape aLSF;
const TopTools_ListOfShape& R = myImageOffset.Roots(); const TopTools_ListOfShape& R = myImageOffset.Roots();
TopTools_ListIteratorOfListOfShape it(R); TopTools_ListIteratorOfListOfShape it(R);
// //
for (; it.More(); it.Next()) { for (; it.More(); it.Next()) {
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
TopoDS_Shape aF = it.Value(); TopoDS_Shape aF = it.Value();
if (myThickening) //offsetted faces must change their orientations if (myThickening) //offsetted faces must change their orientations
aF.Reverse(); aF.Reverse();
@ -3158,7 +3424,7 @@ void BRepOffset_MakeOffset::MakeShells ()
IsSolid(myShape) && myIsPlanar) { IsSolid(myShape) && myIsPlanar) {
// //
TopoDS_Shape aShells; TopoDS_Shape aShells;
bDone = BuildShellsCompleteInter(aLSF, myImageOffset, aShells); bDone = BuildShellsCompleteInter(aLSF, myImageOffset, aShells, aPS.Next());
if (bDone) { if (bDone) {
myOffsetShape = aShells; myOffsetShape = aShells;
} }
@ -3193,7 +3459,7 @@ void BRepOffset_MakeOffset::MakeShells ()
//purpose : //purpose :
//======================================================================= //=======================================================================
void BRepOffset_MakeOffset::MakeSolid () void BRepOffset_MakeOffset::MakeSolid (const Message_ProgressRange& theRange)
{ {
if (myOffsetShape.IsNull()) return; if (myOffsetShape.IsNull()) return;
@ -3209,11 +3475,18 @@ void BRepOffset_MakeOffset::MakeSolid ()
TopoDS_Shape S1; TopoDS_Shape S1;
B.MakeCompound (NC); B.MakeCompound (NC);
Message_ProgressScope aPS(theRange, "Making solid", 1);
TopoDS_Solid Sol; TopoDS_Solid Sol;
B.MakeSolid(Sol); B.MakeSolid(Sol);
Sol.Closed(Standard_True); Sol.Closed(Standard_True);
Standard_Boolean aMakeSolid = (myShape.ShapeType() == TopAbs_SOLID) || myThickening; Standard_Boolean aMakeSolid = (myShape.ShapeType() == TopAbs_SOLID) || myThickening;
for (exp.Init(myOffsetShape,TopAbs_SHELL); exp.More(); exp.Next()) { for (exp.Init(myOffsetShape,TopAbs_SHELL); exp.More(); exp.Next()) {
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return;
}
TopoDS_Shell Sh = TopoDS::Shell(exp.Current()); TopoDS_Shell Sh = TopoDS::Shell(exp.Current());
if (myThickening && myOffset > 0.) if (myThickening && myOffset > 0.)
Sh.Reverse(); Sh.Reverse();
@ -3714,13 +3987,13 @@ void CorrectSolid(TopoDS_Solid& theSol, TopTools_ListOfShape& theSolList)
//function : CheckInputData //function : CheckInputData
//purpose : Check input data for possibility of offset perform. //purpose : Check input data for possibility of offset perform.
//======================================================================= //=======================================================================
Standard_Boolean BRepOffset_MakeOffset::CheckInputData() Standard_Boolean BRepOffset_MakeOffset::CheckInputData(const Message_ProgressRange& theRange)
{ {
// Set initial error state. // Set initial error state.
myError = BRepOffset_NoError; myError = BRepOffset_NoError;
TopoDS_Shape aTmpShape; TopoDS_Shape aTmpShape;
myBadShape = aTmpShape; myBadShape = aTmpShape;
Message_ProgressScope aPS(theRange, NULL, 1);
// Non-null offset. // Non-null offset.
if (Abs(myOffset) <= myTol) if (Abs(myOffset) <= myTol)
{ {
@ -3759,6 +4032,11 @@ Standard_Boolean BRepOffset_MakeOffset::CheckInputData()
gp_Pnt2d aPnt2d; gp_Pnt2d aPnt2d;
for( ; anExpSF.More(); anExpSF.Next()) for( ; anExpSF.More(); anExpSF.Next())
{ {
if (!aPS.More())
{
myError = BRepOffset_UserBreak;
return Standard_False;
}
const TopoDS_Face& aF = TopoDS::Face(anExpSF.Current()); const TopoDS_Face& aF = TopoDS::Face(anExpSF.Current());
if (aPresenceMap.Contains(aF.TShape())) if (aPresenceMap.Contains(aF.TShape()))
@ -3992,30 +4270,44 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
TopTools_DataMapOfShapeShape& theMES, TopTools_DataMapOfShapeShape& theMES,
TopTools_DataMapOfShapeShape& theBuild, TopTools_DataMapOfShapeShape& theBuild,
Handle(BRepAlgo_AsDes)& theAsDes, Handle(BRepAlgo_AsDes)& theAsDes,
Handle(BRepAlgo_AsDes)& theAsDes2d) Handle(BRepAlgo_AsDes)& theAsDes2d,
const Message_ProgressRange& theRange)
{ {
Standard_Real aTolF; Standard_Real aTolF;
TopTools_IndexedDataMapOfShapeListOfShape aDMVV; TopTools_IndexedDataMapOfShapeListOfShape aDMVV;
// intersect edges created from edges // intersect edges created from edges
TopTools_IndexedMapOfShape aMFV; TopTools_IndexedMapOfShape aMFV;
Message_ProgressScope aPSOuter(theRange, NULL , 2);
Message_ProgressScope aPS1(aPSOuter.Next(), NULL, theFaces.Size());
for (TopTools_ListOfShape::Iterator it (theFaces); it.More(); it.Next()) for (TopTools_ListOfShape::Iterator it (theFaces); it.More(); it.Next())
{ {
const TopoDS_Face& aF = TopoDS::Face (it.Value()); const TopoDS_Face& aF = TopoDS::Face (it.Value());
aTolF = BRep_Tool::Tolerance (aF); aTolF = BRep_Tool::Tolerance (aF);
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d, if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d,
myOffset, aTolF, myAnalyse, aMFV, myImageVV, myEdgeIntEdges, aDMVV)) myOffset, aTolF, myAnalyse, aMFV, myImageVV, myEdgeIntEdges, aDMVV, aPS1.Next()))
{ {
myError = BRepOffset_CannotExtentEdge; myError = BRepOffset_CannotExtentEdge;
return; return;
} }
if (!aPS1.More())
{
myError = BRepOffset_UserBreak;
return;
}
} }
// intersect edges created from vertices // intersect edges created from vertices
Standard_Integer i, aNbF = aMFV.Extent(); Standard_Integer i, aNbF = aMFV.Extent();
Message_ProgressScope aPS2(aPSOuter.Next(), "Intersecting edges created from vertices", aNbF);
for (i = 1; i <= aNbF; ++i) { for (i = 1; i <= aNbF; ++i) {
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, myAnalyse, aDMVV); (aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d, aTolF, myAnalyse, aDMVV, aPS2.Next());
if (!aPS2.More())
{
myError = BRepOffset_UserBreak;
return;
}
} }
// //
// fuse vertices on edges // fuse vertices on edges
@ -4294,15 +4586,17 @@ void GetEnlargedFaces(const TopTools_ListOfShape& theFaces,
//======================================================================= //=======================================================================
Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF, Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
BRepAlgo_Image& theImage, BRepAlgo_Image& theImage,
TopoDS_Shape& theShells) TopoDS_Shape& theShells,
const Message_ProgressRange& theRange)
{ {
Message_ProgressScope aPS(theRange, NULL, 5);
// make solids // make solids
BOPAlgo_MakerVolume aMV1; BOPAlgo_MakerVolume aMV1;
aMV1.SetArguments(theLF); aMV1.SetArguments(theLF);
// we need to intersect the faces to process the tangential faces // we need to intersect the faces to process the tangential faces
aMV1.SetIntersect(Standard_True); aMV1.SetIntersect(Standard_True);
aMV1.SetAvoidInternalShapes(Standard_True); aMV1.SetAvoidInternalShapes(Standard_True);
aMV1.Perform(); aMV1.Perform(aPS.Next(3));
// //
Standard_Boolean bDone = ! aMV1.HasErrors(); Standard_Boolean bDone = ! aMV1.HasErrors();
if (!bDone) { if (!bDone) {
@ -4382,7 +4676,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
// no need to intersect this time // no need to intersect this time
aMV2.SetIntersect(Standard_False); aMV2.SetIntersect(Standard_False);
aMV2.SetAvoidInternalShapes(Standard_True); aMV2.SetAvoidInternalShapes(Standard_True);
aMV2.Perform(); aMV2.Perform(aPS.Next());
bDone = ! aMV2.HasErrors(); bDone = ! aMV2.HasErrors();
if (!bDone) { if (!bDone) {
return bDone; return bDone;
@ -4433,7 +4727,7 @@ Standard_Boolean BuildShellsCompleteInter(const TopTools_ListOfShape& theLF,
aMV3.SetArguments(aLF); aMV3.SetArguments(aLF);
aMV3.SetIntersect(Standard_False); aMV3.SetIntersect(Standard_False);
aMV3.SetAvoidInternalShapes(Standard_True); aMV3.SetAvoidInternalShapes(Standard_True);
aMV3.Perform(); aMV3.Perform(aPS.Next());
bDone = ! aMV3.HasErrors(); bDone = ! aMV3.HasErrors();
if (!bDone) { if (!bDone) {
return bDone; return bDone;
@ -4613,6 +4907,43 @@ Standard_Boolean GetSubShapes(const TopoDS_Shape& theShape,
return Standard_True; return Standard_True;
} }
//=======================================================================
//function : analyzeProgress
//purpose :
//=======================================================================
void BRepOffset_MakeOffset::analyzeProgress (const Standard_Real theWhole,
TColStd_Array1OfReal& theSteps) const
{
theSteps.Init(0.0);
// Set, approximately, the proportions for each operation.
// It is not a problem that the sum of the set values will not
// be equal to 100%, as the values will be normalized.
// The main point is to make the proportions valid relatively each other.
// Proportions will be different for different connection types
Standard_Boolean isArc = (myJoin == GeomAbs_Arc);
Standard_Boolean isPlanarIntCase = myInter && !isArc && myIsPlanar && !myThickening &&
myFaces.IsEmpty() && IsSolid(myShape);
theSteps(PIOperation_CheckInputData) = 1.;
theSteps(PIOperation_Analyse) = 2.;
theSteps(PIOperation_BuildOffsetBy) = isPlanarIntCase ? 70. : (isArc ? 20. : 50.);
theSteps(PIOperation_Intersection) = isPlanarIntCase ? 0. : (isArc ? 50. : 20.);
if (myThickening)
{
theSteps(PIOperation_MakeMissingWalls) = 5.;
}
theSteps(PIOperation_MakeShells) = isPlanarIntCase ? 25. : 5.;
theSteps(PIOperation_MakeSolid) = 5.;
if (myIsPerformSewing && myThickening)
{
theSteps(PIOperation_Sewing) = 10.;
}
normalizeSteps(theWhole, theSteps);
}
//======================================================================= //=======================================================================
//function : IsPlanar //function : IsPlanar
//purpose : Checks if all the faces of the shape are planes //purpose : Checks if all the faces of the shape are planes

View File

@ -36,6 +36,9 @@
#include <BRepOffset_MakeLoops.hxx> #include <BRepOffset_MakeLoops.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <BRepOffset_DataMapOfShapeOffset.hxx> #include <BRepOffset_DataMapOfShapeOffset.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <Message_ProgressRange.hxx>
class BRepAlgo_AsDes; class BRepAlgo_AsDes;
class TopoDS_Shape; class TopoDS_Shape;
class TopoDS_Face; class TopoDS_Face;
@ -44,7 +47,6 @@ class BRepAlgo_Image;
class BRepOffset_Inter3d; class BRepOffset_Inter3d;
class BRepOffset_MakeOffset class BRepOffset_MakeOffset
{ {
public: public:
@ -61,7 +63,8 @@ public:
const Standard_Boolean SelfInter = Standard_False, const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc, const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean Thickening = Standard_False, const Standard_Boolean Thickening = Standard_False,
const Standard_Boolean RemoveIntEdges = Standard_False); const Standard_Boolean RemoveIntEdges = Standard_False,
const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void Initialize (const TopoDS_Shape& S, Standard_EXPORT void Initialize (const TopoDS_Shape& S,
const Standard_Real Offset, const Standard_Real Offset,
@ -85,9 +88,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);
Standard_EXPORT void MakeOffsetShape(); Standard_EXPORT void MakeOffsetShape(const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT void MakeThickSolid(); Standard_EXPORT void MakeThickSolid(const Message_ProgressRange& theRange = Message_ProgressRange());
Standard_EXPORT const BRepOffset_Analyse& GetAnalyse() const; Standard_EXPORT const BRepOffset_Analyse& GetAnalyse() const;
@ -124,7 +127,7 @@ public:
//! 3) Check continuity of input surfaces. //! 3) Check continuity of input surfaces.
//! 4) Check for normals existence on grid. //! 4) Check for normals existence on grid.
//! @return True if possible make computations and false otherwise. //! @return True if possible make computations and false otherwise.
Standard_EXPORT Standard_Boolean CheckInputData(); Standard_EXPORT Standard_Boolean CheckInputData(const Message_ProgressRange& theRange);
//! Return bad shape, which obtained in CheckInputData. //! Return bad shape, which obtained in CheckInputData.
Standard_EXPORT const TopoDS_Shape& GetBadShape() const; Standard_EXPORT const TopoDS_Shape& GetBadShape() const;
@ -142,7 +145,11 @@ public: //! @name History methods
protected: protected:
//! Analyze progress steps of the whole operation.
//! @param theWhole - sum of progress of all operations.
//! @oaram theSteps - steps of the operations supported by PI
Standard_EXPORT void analyzeProgress (const Standard_Real theWhole,
TColStd_Array1OfReal& theSteps) const;
private: private:
@ -159,26 +166,28 @@ private:
Standard_EXPORT void BuildFaceComp(); Standard_EXPORT void BuildFaceComp();
Standard_EXPORT void BuildOffsetByArc(); Standard_EXPORT void BuildOffsetByArc(const Message_ProgressRange& theRange);
Standard_EXPORT void BuildOffsetByInter(); Standard_EXPORT void BuildOffsetByInter(const Message_ProgressRange& theRange);
//! Make Offset faces //! Make Offset faces
Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF); Standard_EXPORT void MakeOffsetFaces(BRepOffset_DataMapOfShapeOffset& theMapSF, const Message_ProgressRange& theRange);
Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif); Standard_EXPORT void SelfInter (TopTools_MapOfShape& Modif);
Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter); Standard_EXPORT void Intersection3D (BRepOffset_Inter3d& Inter, const Message_ProgressRange& theRange);
Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif, const TopTools_IndexedMapOfShape& NewEdges); Standard_EXPORT void Intersection2D (const TopTools_IndexedMapOfShape& Modif,
const TopTools_IndexedMapOfShape& NewEdges,
const Message_ProgressRange& theRange);
Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif); Standard_EXPORT void MakeLoops (TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange);
Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif); Standard_EXPORT void MakeLoopsOnContext (TopTools_MapOfShape& Modif);
Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif); Standard_EXPORT void MakeFaces (TopTools_IndexedMapOfShape& Modif, const Message_ProgressRange& theRange);
Standard_EXPORT void MakeShells(); Standard_EXPORT void MakeShells(const Message_ProgressRange& theRange);
Standard_EXPORT void SelectShells(); Standard_EXPORT void SelectShells();
@ -187,7 +196,7 @@ private:
//! Replace roots in history maps //! Replace roots in history maps
Standard_EXPORT void ReplaceRoots(); Standard_EXPORT void ReplaceRoots();
Standard_EXPORT void MakeSolid(); Standard_EXPORT void MakeSolid(const Message_ProgressRange& theRange);
Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF); Standard_EXPORT void ToContext (BRepOffset_DataMapOfShapeOffset& MapSF);
@ -198,7 +207,7 @@ private:
Standard_EXPORT void CorrectConicalFaces(); Standard_EXPORT void CorrectConicalFaces();
//! Private method used to build walls for thickening the shell //! Private method used to build walls for thickening the shell
Standard_EXPORT void MakeMissingWalls(); Standard_EXPORT void MakeMissingWalls(const Message_ProgressRange& theRange);
//! Removes INTERNAL edges from the result //! Removes INTERNAL edges from the result
Standard_EXPORT void RemoveInternalEdges(); Standard_EXPORT void RemoveInternalEdges();
@ -209,7 +218,8 @@ private:
TopTools_DataMapOfShapeShape& theMES, TopTools_DataMapOfShapeShape& theMES,
TopTools_DataMapOfShapeShape& theBuild, TopTools_DataMapOfShapeShape& theBuild,
Handle(BRepAlgo_AsDes)& theAsDes, Handle(BRepAlgo_AsDes)& theAsDes,
Handle(BRepAlgo_AsDes)& theAsDes2d); Handle(BRepAlgo_AsDes)& theAsDes2d,
const Message_ProgressRange& theRange);
//! Building of the splits of the offset faces for mode Complete //! Building of the splits of the offset faces for mode Complete
//! and joint type Intersection. This method is an advanced alternative //! and joint type Intersection. This method is an advanced alternative
@ -221,13 +231,15 @@ private:
TopTools_DataMapOfShapeListOfShape& theEdgesOrigins, TopTools_DataMapOfShapeListOfShape& theEdgesOrigins,
TopTools_DataMapOfShapeShape& theFacesOrigins, TopTools_DataMapOfShapeShape& theFacesOrigins,
TopTools_DataMapOfShapeShape& theETrimEInf, TopTools_DataMapOfShapeShape& theETrimEInf,
BRepAlgo_Image& theImage); BRepAlgo_Image& theImage,
const Message_ProgressRange& theRange);
//! Building of the splits of the already trimmed offset faces for mode Complete //! Building of the splits of the already trimmed offset faces for mode Complete
//! and joint type Intersection. //! and joint type Intersection.
Standard_EXPORT void BuildSplitsOfTrimmedFaces(const TopTools_ListOfShape& theLF, Standard_EXPORT void BuildSplitsOfTrimmedFaces(const TopTools_ListOfShape& theLF,
const Handle(BRepAlgo_AsDes)& theAsDes, const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImage); BRepAlgo_Image& theImage,
const Message_ProgressRange& theRange);
Standard_Real myOffset; Standard_Real myOffset;
Standard_Real myTol; Standard_Real myTol;

File diff suppressed because it is too large Load Diff

View File

@ -41,14 +41,15 @@ void BRepOffsetAPI_MakeOffsetShape::PerformByJoin
const Standard_Boolean Intersection, const Standard_Boolean Intersection,
const Standard_Boolean SelfInter, const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join, const GeomAbs_JoinType Join,
const Standard_Boolean RemoveIntEdges) const Standard_Boolean RemoveIntEdges,
const Message_ProgressRange& theRange)
{ {
NotDone(); NotDone();
myLastUsedAlgo = OffsetAlgo_JOIN; myLastUsedAlgo = OffsetAlgo_JOIN;
myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter, myOffsetShape.Initialize (S,Offset,Tol,Mode,Intersection,SelfInter,
Join, Standard_False, RemoveIntEdges); Join, Standard_False, RemoveIntEdges);
myOffsetShape.MakeOffsetShape(); myOffsetShape.MakeOffsetShape(theRange);
if (!myOffsetShape.IsDone()) if (!myOffsetShape.IsDone())
return; return;

View File

@ -114,7 +114,8 @@ public:
const Standard_Boolean Intersection = Standard_False, const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False, const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc, const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean RemoveIntEdges = Standard_False); const Standard_Boolean RemoveIntEdges = Standard_False,
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Returns instance of the unrelying intersection / arc algorithm. //! Returns instance of the unrelying intersection / arc algorithm.
Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const; Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const;

View File

@ -41,12 +41,13 @@ void BRepOffsetAPI_MakeThickSolid::MakeThickSolidByJoin
(const TopoDS_Shape& S, (const TopoDS_Shape& S,
const TopTools_ListOfShape& ClosingFaces, const TopTools_ListOfShape& ClosingFaces,
const Standard_Real Offset, const Standard_Real Offset,
const Standard_Real Tol, const Standard_Real Tol,
const BRepOffset_Mode Mode, const BRepOffset_Mode Mode,
const Standard_Boolean Intersection, const Standard_Boolean Intersection,
const Standard_Boolean SelfInter, const Standard_Boolean SelfInter,
const GeomAbs_JoinType Join, const GeomAbs_JoinType Join,
const Standard_Boolean RemoveIntEdges) const Standard_Boolean RemoveIntEdges,
const Message_ProgressRange& theRange)
{ {
NotDone(); NotDone();
myLastUsedAlgo = OffsetAlgo_JOIN; myLastUsedAlgo = OffsetAlgo_JOIN;
@ -57,7 +58,7 @@ void BRepOffsetAPI_MakeThickSolid::MakeThickSolidByJoin
for (; it.More(); it.Next()) for (; it.More(); it.Next())
myOffsetShape.AddFace(TopoDS::Face(it.Value())); myOffsetShape.AddFace(TopoDS::Face(it.Value()));
myOffsetShape.MakeThickSolid(); myOffsetShape.MakeThickSolid(theRange);
if (!myOffsetShape.IsDone()) if (!myOffsetShape.IsDone())
return; return;

View File

@ -110,7 +110,8 @@ public:
const Standard_Boolean Intersection = Standard_False, const Standard_Boolean Intersection = Standard_False,
const Standard_Boolean SelfInter = Standard_False, const Standard_Boolean SelfInter = Standard_False,
const GeomAbs_JoinType Join = GeomAbs_Arc, const GeomAbs_JoinType Join = GeomAbs_Arc,
const Standard_Boolean RemoveIntEdges = Standard_False); const Standard_Boolean RemoveIntEdges = Standard_False,
const Message_ProgressRange& theRange = Message_ProgressRange());
// Does nothing. // Does nothing.
Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;

View File

@ -17,6 +17,7 @@
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <Draw_Appli.hxx> #include <Draw_Appli.hxx>
#include <DrawTrSurf.hxx> #include <DrawTrSurf.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
@ -976,10 +977,12 @@ Standard_Integer thickshell(Draw_Interpretor& theCommands,
if (n > 5) if (n > 5)
Tol = Draw::Atof(a[5]); Tol = Draw::Atof(a[5]);
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theCommands, 1);
BRepOffset_MakeOffset B; BRepOffset_MakeOffset B;
B.Initialize(S, Of, Tol, BRepOffset_Skin, Inter, 0, JT, Standard_True); B.Initialize(S, Of, Tol, BRepOffset_Skin, Inter, 0, JT, Standard_True);
B.MakeOffsetShape(); B.MakeOffsetShape(aProgress->Start());
const BRepOffset_Error aRetCode = B.Error(); const BRepOffset_Error aRetCode = B.Error();
reportOffsetState(theCommands, aRetCode); reportOffsetState(theCommands, aRetCode);
@ -1037,8 +1040,9 @@ Standard_Integer offsetshape(Draw_Interpretor& theCommands,
} }
} }
if (!YaBouchon) B.MakeOffsetShape(); Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theCommands, 1);
else B.MakeThickSolid(); if (!YaBouchon) B.MakeOffsetShape(aProgress->Start());
else B.MakeThickSolid(aProgress->Start());
const BRepOffset_Error aRetCode = B.Error(); const BRepOffset_Error aRetCode = B.Error();
reportOffsetState(theCommands, aRetCode); reportOffsetState(theCommands, aRetCode);
@ -1169,10 +1173,11 @@ Standard_Integer offsetperform(Draw_Interpretor& theCommands,
{ {
if (theNArg < 2) return 1; if (theNArg < 2) return 1;
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theCommands, 1);
if (theYaBouchon) if (theYaBouchon)
TheOffset.MakeThickSolid(); TheOffset.MakeThickSolid(aProgress->Start());
else else
TheOffset.MakeOffsetShape(); TheOffset.MakeOffsetShape(aProgress->Start());
if (TheOffset.IsDone()) if (TheOffset.IsDone())
{ {

View File

@ -20,6 +20,7 @@
#include <Draw_Interpretor.hxx> #include <Draw_Interpretor.hxx>
#include <DBRep.hxx> #include <DBRep.hxx>
#include <DrawTrSurf.hxx> #include <DrawTrSurf.hxx>
#include <Draw_ProgressIndicator.hxx>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -392,7 +393,7 @@ Standard_Integer MakeBoss(Draw_Interpretor& , Standard_Integer , const char** a)
//function : MakeShell //function : MakeShell
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const char** a) Standard_Integer MakeShell(Draw_Interpretor& theDI, Standard_Integer , const char** a)
{ {
TopoDS_Shape aShape = DBRep::Get( a[1] ); TopoDS_Shape aShape = DBRep::Get( a[1] );
@ -404,12 +405,14 @@ Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const char** a
Standard_Real Off = -Draw::Atof( a[3] ); Standard_Real Off = -Draw::Atof( a[3] );
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator(theDI, 1);
BRepOffset_MakeOffset Offset; BRepOffset_MakeOffset Offset;
Offset.Initialize( aShape, Off, 1.0e-3, BRepOffset_Skin, Offset.Initialize( aShape, Off, 1.0e-3, BRepOffset_Skin,
Standard_True , Standard_False , GeomAbs_Arc ); Standard_True , Standard_False , GeomAbs_Arc );
Offset.AddFace( F ); Offset.AddFace( F );
Offset.MakeThickSolid(); Offset.MakeThickSolid(aProgress->Start());
if( Offset.IsDone() ) { if( Offset.IsDone() ) {
// SaveShape::Save(Offset.Shape(), "ss"); // SaveShape::Save(Offset.Shape(), "ss");

View File

@ -1781,12 +1781,8 @@ void BiTgte_Blend::ComputeCenters()
} }
} }
TopTools_DataMapOfShapeListOfShape anEmptyMap; TopTools_DataMapOfShapeListOfShape anEmptyMap;
BRepOffset_Inter2d::Compute(myAsDes, BRepOffset_Inter2d::Compute(myAsDes, CurOF, myEdges, myTol,
CurOF, anEmptyMap, aDMVV, Message_ProgressRange());
myEdges,
myTol,
anEmptyMap,
aDMVV);
} }
} }
@ -1816,12 +1812,8 @@ void BiTgte_Blend::ComputeCenters()
} }
TopTools_DataMapOfShapeListOfShape anEmptyMap; TopTools_DataMapOfShapeListOfShape anEmptyMap;
BRepOffset_Inter2d::Compute(myAsDes, BRepOffset_Inter2d::Compute(myAsDes, CurOF, myEdges, myTol,
CurOF, anEmptyMap, aDMVV, Message_ProgressRange());
myEdges,
myTol,
anEmptyMap,
aDMVV);
} }
// //
// fuse vertices on edges stored in AsDes // fuse vertices on edges stored in AsDes
@ -1831,7 +1823,7 @@ void BiTgte_Blend::ComputeCenters()
// unwinding // unwinding
// ------------ // ------------
BRepOffset_MakeLoops MakeLoops; BRepOffset_MakeLoops MakeLoops;
MakeLoops.Build (LOF, myAsDes, myImageOffset, anEmptyImage); MakeLoops.Build (LOF, myAsDes, myImageOffset, anEmptyImage, Message_ProgressRange());
// ------------------------------------------------------------ // ------------------------------------------------------------
// It is possible to unwind edges at least one ancestor which of // It is possible to unwind edges at least one ancestor which of

View File

@ -0,0 +1,47 @@
puts "============================================"
puts "0032330: Modeling Algorithms - Extend Offset algorithm with Progress Indicator and User Break"
puts "============================================"
puts ""
proc isTracked { theOutput } {
if {![regexp "Progress" $theOutput]} {
puts "Error: progress is not tracked"
}
}
XProgress +t
# check that progress is tracked for offsetshape operation
box s1 100 100 100
explode s1 f
set log [offsetshape result1 s1 -5 s1_1]
isTracked $log
# check that progress is tracked for offsetperform operation
restore [locate_data_file bug27908.brep] s2
offsetparameter 1e-7 p i
offsetload s2 10
set log [offsetperform result2]
isTracked $log
polyline p 0 0 0 5 0 0 7 0 3 3 0 3 4 0 1 1 0 1 2 0 3 -2 0 3 0 0 0
mkplane f p
prism s3 f 0 5 0
offsetparameter 1e-7 c i
offsetload s3 1
set log [offsetperform result3]
isTracked $log
box s4 10 10 10
offsetparameter 1e-7 c a
offsetload s4 5
set log [offsetperform result4]
isTracked $log
offsetparameter 1e-7 p a
offsetload s4 5
set log [offsetperform result5]
isTracked $log