1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

...

9 Commits

Author SHA1 Message Date
nbv
99ecc57f23 Debug 2018-04-28 10:29:31 +03:00
nbv
7908f97c1b 0029523: Problem with BRepOffsetAPI_MakeEvolved
1. New class BRepFill_Voluved has been created in order to provide new OCCT-algorithm combining BRepFill_PipeShell and BOPAlgo_MakerVolume.

2. The interface of DRAW-command "evolved" has been corrected.

3. DRAW-command "evolvedsolid" has been deleted. Currently it can be replaced with DRAW-command "evolved" with specific options.

4. Some test cases have been corrected.

5. Testgrid "evolved" has been created.
2018-04-28 10:13:53 +03:00
nbv
9a49e2ce57 # Warning: Building 2D curve of edge on face has failed.
(cherry picked from commit d0d712265120631f5cc58c3d480492e79a6c5123)
2018-04-28 09:31:21 +03:00
nbv
bf878e54e3 # Walking hangs 2018-04-28 09:31:20 +03:00
nbv
efb8681bfc 0029663: Exception in BRepFill_PipeShell algorithm
BRepFill_Sweep algorithm is improved to handle cases when generated revolution surface has degenerated point in the middle.

Added test bugs modalg_7 bug29663

TODO added in test bugs modalg_1 bug1477_11: here two additional self-intersecting faces are now created, previously missing from the result.

(cherry picked from commit c37f570215)
2018-04-28 09:31:18 +03:00
nbv
34b2e62bd6 0029660: Misprint in BuildEdge(...) static function of BRepFill_Sweep.cxx file
Misprint has been eliminated.

(cherry picked from commit 10a55e0d05)
2018-04-28 09:31:16 +03:00
jgv
8c2adc035d 0029204: BRepOffsetAPI_MakePipeShell produces invalid result and raises exception in Draw
1.The algorithm searching the section in the corner (ChooseSection) is modified to be able to find simple cases with rather big tolerance.

2. The constructor of BRepFill_Section is modified: now it removes locations in the shape of section like it was done in BRepFill_Pipe.

3. Correction of U-edges by Same Parameter has been added to the method BRepFill_Sweep::Build.

(cherry picked from commit 833e75611f)
2018-04-28 09:31:15 +03:00
emv
a829053aed 0029351: Boolean Operations create invalid pcurves
When making pcurve for edge on face make sure that the produced 2D curve will have the same range as 3D curve of the edge.

(cherry picked from commit 0a807dd9a3)
2018-04-28 09:31:13 +03:00
emv
f109d88899 0029073: Regression: General Cut produces invalid shape
Boolean Operations:
1. Face/Face intersection post treatment - Unify vertices put on the section curves, which were rejected as existing ones, with the vertices of edges by which these section curves have been rejected.

2. Extend Warnings Reporting system of Boolean operations with the new warnings:
- BOPAlgo_AlertIntersectionOfPairOfShapesFailed - to be added when the intersection of pair of sub-shapes of the arguments has failed;
- BOPAlgo_AlertBuildingPCurveFailed - to be added when the building of the 2D curve of the edge on face has failed;
- BOPAlgo_AlertAcquiredSelfIntersection - to be added when the positioning and tolerances of the arguments leads to creation of self-interfered shapes.

These new warnings allow completing the operation even if intersection of some of the sub-shapes or building of some of the PCurves has failed. Moreover, they allow getting the pairs of sub-shapes on which the intersection/projection has failed, providing the user ability to analyze the intersection results.

Note that if some of these warnings appear, the result of the operation should be carefully analyzed for validity.

3. Print messages for the Warnings/Errors met during checking of the shape on self-intersection ("bopcheck" command).

(cherry picked from commit ad8b073e19)
2018-04-19 15:33:38 +03:00
81 changed files with 4020 additions and 520 deletions

View File

@@ -68,6 +68,7 @@ FILE_TO_LIST ("adm/RESOURCES" RESOURCES)
foreach (CurrentResource ${RESOURCES})
get_filename_component (CurrentResource_FileName "${CurrentResource}" NAME)
if ("${CurrentResource_FileName}" STREQUAL TObj.msg OR
"${CurrentResource_FileName}" STREQUAL BOPAlgo.msg OR
"${CurrentResource_FileName}" STREQUAL Units.dat OR
"${CurrentResource}" STREQUAL XSMessage OR
"${CurrentResource}" STREQUAL SHMessage OR

View File

@@ -67,3 +67,12 @@ Warning: Removal of internal boundaries among Faces has failed
.BOPAlgo_AlertRemovalOfIBForEdgesFailed
Warning: Removal of internal boundaries among Edges has failed
.BOPAlgo_AlertIntersectionOfPairOfShapesFailed
Warning: Intersection of pair of shapes has failed
.BOPAlgo_AlertBuildingPCurveFailed
Warning: Building 2D curve of edge on face has failed
.BOPAlgo_AlertAcquiredSelfIntersection
Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered

View File

@@ -78,4 +78,14 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShellSplitterFailed)
//! Some edges are too small and have no valid range
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertTooSmallEdge)
//! Intersection of pair of shapes has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertIntersectionOfPairOfShapesFailed)
//! Building 2D curve of edge on face has failed
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertBuildingPCurveFailed)
//! Some sub-shapes of some of the argument become connected through
//! other shapes and the argument became self-interfered
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertAcquiredSelfIntersection)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

@@ -69,4 +69,13 @@ static const char BOPAlgo_BOPAlgo_msg[] =
"Warning: Removal of internal boundaries among Faces has failed\n"
"\n"
".BOPAlgo_AlertRemovalOfIBForEdgesFailed\n"
"Warning: Removal of internal boundaries among Edges has failed\n";
"Warning: Removal of internal boundaries among Edges has failed\n"
"\n"
".BOPAlgo_AlertIntersectionOfPairOfShapesFailed\n"
"Warning: Intersection of pair of shapes has failed\n"
"\n"
".BOPAlgo_AlertBuildingPCurveFailed\n"
"Warning: Building 2D curve of edge on face has failed\n"
"\n"
".BOPAlgo_AlertAcquiredSelfIntersection\n"
"Warning: Some sub-shapes of some of the argument become connected through other shapes and the argument became self-interfered\n";

View File

@@ -294,6 +294,8 @@ void BOPAlgo_PaveFiller::PerformInternal()
//
UpdateBlocksWithSharedVertices();
//
myDS->RefineFaceInfoIn();
//
MakeSplitEdges();
if (HasErrors()) {
return;

View File

@@ -87,13 +87,19 @@ class TopoDS_Face;
//! - *Gluing options* - allows to speed up the calculation on the special
//! cases, in which some sub-shapes are coincide.<br>
//!
//! The algorithm returns the following Warning statuses:<br>
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;<br>
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;<br>
//! The algorithm returns the following Warning statuses:
//! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering shapes;
//! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;
//! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small
//! valid range so it cannot be split;<br>
//! valid range so it cannot be split;
//! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation
//! of small edges.<br>
//! of small edges;
//! - *BOPAlgo_AlertIntersectionOfPairOfShapesFailed* - in case intersection of some of the
//! sub-shapes has failed;
//! - *BOPAlgo_AlertAcquiredSelfIntersection* - in case some sub-shapes of the argument become connected
//! through other shapes;
//! - *BOPAlgo_AlertBuildingPCurveFailed* - in case building 2D curve for some of the edges
//! on the faces has failed.
//!
//! The algorithm returns the following Error alerts:
//! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to
@@ -290,6 +296,7 @@ protected:
BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges,
BOPCol_DataMapOfIntegerInteger& theDMNewSD,
const BOPCol_IndexedMapOfShape& theMicroEdges,
const BOPCol_IndexedMapOfShape& theVertsOnRejectedPB,
const BOPCol_BaseAllocator& theAllocator);
Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB);
@@ -474,6 +481,8 @@ protected:
//! In case self-interference is found the warning is added.
Standard_EXPORT void CheckSelfInterference();
//! Adds the warning about failed intersection of pair of sub-shapes
Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1, const TopoDS_Shape& theS2);
BOPCol_ListOfShape myArguments;
BOPDS_PDS myDS;

View File

@@ -112,7 +112,8 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
}
//
if (aLE.Extent() > 1) {
// Add warning
// Add the acquired self-interference warning:
// The same common block contains several edges from one argument
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
@@ -122,7 +123,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
aBB.Add(aWC, aE1);
}
//
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
}
}
}
@@ -168,7 +169,8 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
for (j = 1; j <= aNbC; ++j) {
const BOPCol_IndexedMapOfShape& aMCS = aMCSI(j);
if (aMCS.Extent() > 1) {
// Add self-interference warning
// Add acquired self-interference warning:
// Several faces from one argument contain the same vertex or edge
TopoDS_Compound aWC;
aBB.MakeCompound(aWC);
//
@@ -177,7 +179,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference()
const TopoDS_Shape& aSx = aMCS(iS);
aBB.Add(aWC, aSx);
}
AddWarning (new BOPAlgo_AlertSelfInterferingShape (aWC));
AddWarning (new BOPAlgo_AlertAcquiredSelfIntersection (aWC));
}
}
}

View File

@@ -17,6 +17,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_NCVector.hxx>
#include <BOPCol_Parallel.hxx>
@@ -27,6 +28,7 @@
#include <BOPDS_PaveBlock.hxx>
#include <BOPDS_VectorOfInterfVE.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <gp_Pnt.hxx>
#include <IntTools_Context.hxx>
@@ -110,7 +112,16 @@ class BOPAlgo_VertexEdge : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
try
{
OCC_CATCH_SIGNALS
myFlag=myContext->ComputeVE (myV, myE, myT, myTolVNew, myFuzzyValue);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
};
//
protected:
@@ -267,6 +278,11 @@ void BOPAlgo_PaveFiller::IntersectVE
for (i = 0; i < aNbVE; ++i) {
const BOPAlgo_VertexEdge& aVESolver = aVVE(i);
if (aVESolver.Flag() != 0) {
if (aVESolver.HasErrors())
{
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aVESolver.Vertex(), aVESolver.Edge());
}
continue;
}
//
@@ -491,3 +507,19 @@ void BOPAlgo_PaveFiller::SplitPaveBlocks(const BOPCol_MapOfInteger& theMEdges,
}
}
}
//=======================================================================
// function: AddIntersectionFailedWarning
// purpose:
//=======================================================================
void BOPAlgo_PaveFiller::AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
const TopoDS_Shape& theS2)
{
// Create the warn shape
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, theS1);
BRep_Builder().Add(aWC, theS2);
// Add the warning
AddWarning(new BOPAlgo_AlertIntersectionOfPairOfShapesFailed(aWC));
}

View File

@@ -93,7 +93,16 @@ class BOPAlgo_EdgeEdge :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeEdge::Perform();
try
{
OCC_CATCH_SIGNALS
IntTools_EdgeEdge::Perform();
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -229,7 +238,11 @@ void BOPAlgo_PaveFiller::PerformEE()
Bnd_Box aBB1, aBB2;
//
BOPAlgo_EdgeEdge& anEdgeEdge=aVEdgeEdge(k);
if (!anEdgeEdge.IsDone()) {
if (!anEdgeEdge.IsDone() || anEdgeEdge.HasErrors()) {
// Warn about failed intersection of sub-shapes
const TopoDS_Shape& aE1 = myDS->Shape(anEdgeEdge.PaveBlock1()->OriginalEdge());
const TopoDS_Shape& aE2 = myDS->Shape(anEdgeEdge.PaveBlock2()->OriginalEdge());
AddIntersectionFailedWarning(aE1, aE2);
continue;
}
//

View File

@@ -17,6 +17,7 @@
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_NCVector.hxx>
@@ -107,7 +108,16 @@ class BOPAlgo_VertexFace : public BOPAlgo_Algo {
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
try
{
OCC_CATCH_SIGNALS
myFlag=myContext->ComputeVF(myV, myF, myT1, myT2, myTolVNew, myFuzzyValue);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -212,7 +222,12 @@ void BOPAlgo_PaveFiller::PerformVF()
const BOPAlgo_VertexFace& aVertexFace=aVVF(k);
//
iFlag=aVertexFace.Flag();
if (iFlag) {
if (iFlag != 0) {
if (aVertexFace.HasErrors())
{
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aVertexFace.Vertex(), aVertexFace.Face());
}
continue;
}
//

View File

@@ -103,7 +103,16 @@ class BOPAlgo_EdgeFace :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_EdgeFace::Perform();
try
{
OCC_CATCH_SIGNALS
IntTools_EdgeFace::Perform();
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -258,7 +267,9 @@ void BOPAlgo_PaveFiller::PerformEF()
//
for (k=0; k < aNbEdgeFace; ++k) {
BOPAlgo_EdgeFace& aEdgeFace=aVEdgeFace(k);
if (!aEdgeFace.IsDone()) {
if (!aEdgeFace.IsDone() || aEdgeFace.HasErrors()) {
// Warn about failed intersection of sub-shapes
AddIntersectionFailedWarning(aEdgeFace.Edge(), aEdgeFace.Face());
continue;
}
//

View File

@@ -144,7 +144,16 @@ class BOPAlgo_FaceFace :
//
virtual void Perform() {
BOPAlgo_Algo::UserBreak();
IntTools_FaceFace::Perform(myF1, myF2);
try
{
OCC_CATCH_SIGNALS
IntTools_FaceFace::Perform(myF1, myF2);
}
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertIntersectionFailed);
}
}
//
protected:
@@ -263,10 +272,12 @@ void BOPAlgo_PaveFiller::PerformFF()
for (k = 0; k < aNbFaceFace; ++k) {
BOPAlgo_FaceFace& aFaceFace = aVFaceFace(k);
aFaceFace.Indices(nF1, nF2);
if (!aFaceFace.IsDone()) {
if (!aFaceFace.IsDone() || aFaceFace.HasErrors()) {
BOPDS_InterfFF& aFF = aFFs.Append1();
aFF.SetIndices(nF1, nF2);
aFF.Init(0, 0);
// Warn about failed intersection of faces
AddIntersectionFailedWarning(aFaceFace.Face1(), aFaceFace.Face2());
continue;
}
//
@@ -373,6 +384,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
BOPCol_DataMapOfIntegerListOfInteger aDMBV(100, aAllocator);
BOPCol_DataMapIteratorOfDataMapOfIntegerReal aItMV;
BOPCol_IndexedMapOfShape aMicroEdges(100, aAllocator);
BOPCol_IndexedMapOfShape aVertsOnRejectedPB;
//
for (i=0; i<aNbFF; ++i) {
//
@@ -557,6 +569,19 @@ void BOPAlgo_PaveFiller::MakeBlocks()
if (!bInBothFaces) {
aMPBAdd.Add(aPBOut);
PreparePostTreatFF(i, j, aPBOut, aMSCPB, aMVI, aLPBC);
// Try fusing the vertices of the existing pave block
// with the vertices put on the real section curve (except
// for technological vertices, which will be removed)
Standard_Integer nVOut1, nVOut2;
aPBOut->Indices(nVOut1, nVOut2);
if (nV1 != nVOut1 && nV1 != nVOut2 && !aMVBounds.Contains(nV1))
{
aVertsOnRejectedPB.Add(aV1);
}
if (nV2 != nVOut1 && nV2 != nVOut2 && !aMVBounds.Contains(nV2))
{
aVertsOnRejectedPB.Add(aV2);
}
}
}
continue;
@@ -639,7 +664,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
//
// post treatment
MakeSDVerticesFF(aDMVLV, aDMNewSD);
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aAllocator);
PostTreatFF(aMSCPB, aDMExEdges, aDMNewSD, aMicroEdges, aVertsOnRejectedPB, aAllocator);
if (HasErrors()) {
return;
}
@@ -697,6 +722,7 @@ void BOPAlgo_PaveFiller::PostTreatFF
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
BOPCol_DataMapOfIntegerInteger& aDMNewSD,
const BOPCol_IndexedMapOfShape& theMicroEdges,
const BOPCol_IndexedMapOfShape& theVertsOnRejectedPB,
const Handle(NCollection_BaseAllocator)& theAllocator)
{
Standard_Integer aNbS = theMSCPB.Extent();
@@ -724,8 +750,9 @@ void BOPAlgo_PaveFiller::PostTreatFF
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
Standard_Integer aNbME = theMicroEdges.Extent();
Standard_Integer aNbVOnRPB = theVertsOnRejectedPB.Extent();
// 0
if (aNbS==1 && (aNbME == 0)) {
if (aNbS==1 && (aNbME == 0) && (aNbVOnRPB == 0)) {
const TopoDS_Shape& aS=theMSCPB.FindKey(1);
const BOPDS_CoupleOfPaveBlocks &aCPB=theMSCPB.FindFromIndex(1);
//
@@ -824,6 +851,20 @@ void BOPAlgo_PaveFiller::PostTreatFF
aBB.UpdateVertex(aVerts[1], aTolV2 + aDist);
}
}
// Add vertices put on the real section curves to unify them with the
// vertices of the edges, by which these sections curves have been rejected
for (Standard_Integer i = 1; i <= aNbVOnRPB; ++i)
{
TopoDS_Shape aVer = theVertsOnRejectedPB(i);
Standard_Integer iVer = myDS->Index(aVer);
const Standard_Integer* pSD = aDMNewSD.Seek(iVer);
if (pSD)
aVer = myDS->Shape(*pSD);
if (anAddedSD.Add(aVer))
aLS.Append(aVer);
}
//
// 2 Fuse shapes
aPF.SetProgressIndicator(myProgressIndicator);

View File

@@ -16,6 +16,7 @@
// commercial license or contractual agreement.
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_SectionAttribute.hxx>
#include <BOPAlgo_Tools.hxx>
#include <BOPCol_IndexedMapOfShape.hxx>
@@ -241,28 +242,37 @@ class BOPAlgo_MPC : public BOPAlgo_Algo {
}
//
virtual void Perform() {
Standard_Integer iErr;
//
iErr=1;
if (!myEz.IsNull()) {
TopoDS_Edge aSpz;
try
{
OCC_CATCH_SIGNALS
Standard_Integer iErr;
//
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
myV2, myT2, aSpz);
iErr=1;
if (!myEz.IsNull()) {
TopoDS_Edge aSpz;
//
BOPTools_AlgoTools::MakeSplitEdge(myEz,myV1, myT1,
myV2, myT2, aSpz);
//
iErr=
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
myE,
myF,
myContext);
}
//
iErr=
BOPTools_AlgoTools2D::AttachExistingPCurve(aSpz,
myE,
myF,
myContext);
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
UpdateVertices(myE, myF);
}
}
//
if (iErr) {
BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(myE, myF, myContext);
}
//
if (myFlag) {
UpdateVertices(myE, myF);
catch (Standard_Failure)
{
AddError(new BOPAlgo_AlertBuildingPCurveFailed(TopoDS_Shape()));
}
}
//
@@ -676,6 +686,20 @@ void BOPAlgo_PaveFiller::MakePCurves()
//======================================================
BOPAlgo_MPCCnt::Perform(myRunParallel, aVMPC, myContext);
//======================================================
// Add warnings of the failed projections
Standard_Integer aNb = aVMPC.Extent();
for (i = 0; i < aNb; ++i)
{
if (aVMPC(i).HasErrors())
{
TopoDS_Compound aWC;
BRep_Builder().MakeCompound(aWC);
BRep_Builder().Add(aWC, aVMPC(i).Edge());
BRep_Builder().Add(aWC, aVMPC(i).Face());
AddWarning(new BOPAlgo_AlertBuildingPCurveFailed(aWC));
}
}
}
//=======================================================================
//function : UpdateVertices

View File

@@ -1418,6 +1418,44 @@ void BOPDS_DS::RefineFaceInfoOn()
}
}
}
//=======================================================================
//function : RefineFaceInfoIn
//purpose :
//=======================================================================
void BOPDS_DS::RefineFaceInfoIn()
{
for (Standard_Integer i = 0; i < myNbSourceShapes; ++i)
{
const BOPDS_ShapeInfo& aSI = ShapeInfo(i);
if (aSI.ShapeType() != TopAbs_FACE)
continue;
if (!aSI.HasReference())
continue;
BOPDS_FaceInfo& aFI = ChangeFaceInfo(i);
const BOPDS_IndexedMapOfPaveBlock& aMPBOn = aFI.PaveBlocksOn();
BOPDS_IndexedMapOfPaveBlock& aMPBIn = aFI.ChangePaveBlocksIn();
if (aMPBIn.IsEmpty() || aMPBOn.IsEmpty())
continue;
BOPDS_IndexedMapOfPaveBlock aMPBInNew;
const Standard_Integer aNbPBIn = aMPBIn.Extent();
for (Standard_Integer j = 1; j <= aNbPBIn; ++j)
{
if (!aMPBOn.Contains(aMPBIn(j)))
aMPBInNew.Add(aMPBIn(j));
}
if (aMPBInNew.Extent() < aNbPBIn)
aMPBIn = aMPBInNew;
}
}
//=======================================================================
//function : AloneVertices
//purpose :

View File

@@ -302,6 +302,9 @@ Standard_EXPORT virtual ~BOPDS_DS();
//! ++
Standard_EXPORT void RefineFaceInfoOn();
//! Removes faces with state ON from the
//! list of IN-faces
Standard_EXPORT void RefineFaceInfoIn();
//! Returns information about ON/IN subshapes of the given faces.
//! @param theMVOnIn the indices of ON/IN vertices from both faces

View File

@@ -235,6 +235,8 @@ Standard_Integer bopcheck (Draw_Interpretor& di,
//
aTimer.Stop();
//
BOPTest::ReportAlerts(aChecker);
//
iErr=aChecker.HasErrors();
//
const BOPDS_DS& aDS=*(aChecker.PDS());

View File

@@ -46,6 +46,7 @@
#include <GeomAdaptor_HSurface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomInt.hxx>
#include <GeomLib.hxx>
#include <GeomProjLib.hxx>
#include <gp.hxx>
#include <gp_Cylinder.hxx>
@@ -667,12 +668,25 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
}
//
TolReached2d=aTolR;
//
// Adjust curve for periodic surface
Handle(Geom2d_Curve) aC2DA;
BOPTools_AlgoTools2D::AdjustPCurveOnSurf (*pBAS, aT1, aT2, aC2D, aC2DA);
//
aC2D=aC2DA;
//
aC2D = aC2DA;
// Make sure that the range of the 2D curve is sufficient for representation of the 3D curve.
Standard_Real aTCFirst = aC2D->FirstParameter();
Standard_Real aTCLast = aC2D->LastParameter();
if ((aTCFirst - aT1) > Precision::PConfusion() ||
(aT2 - aTCLast ) > Precision::PConfusion())
{
if (aTCFirst < aT1) aTCFirst = aT1;
if (aTCLast > aT2) aTCLast = aT2;
GeomLib::SameRange(Precision::PConfusion(), aC2D,
aTCFirst, aTCLast, aT1, aT2, aC2D);
}
// compute the appropriate tolerance for the edge
Handle(Geom_Surface) aS = pBAS->Surface().Surface();
aS = Handle(Geom_Surface)::DownCast(aS->Transformed(pBAS->Trsf()));

View File

@@ -102,40 +102,6 @@ static Standard_Boolean UpdateMap(const TopoDS_Shape& theKey,
return !found;
}
static void ReverseModifiedEdges(TopoDS_Shape& aShape,
TopTools_MapOfShape& Emap)
{
TopExp_Explorer Explo(aShape, TopAbs_FACE);
BRep_Builder BB;
for (; Explo.More(); Explo.Next())
{
TopoDS_Shape aFace = Explo.Current();
TopoDS_Iterator itf(aFace);
for (; itf.More(); itf.Next())
{
TopoDS_Shape aWire = itf.Value();
TopTools_ListOfShape Ledges;
TopoDS_Iterator itw(aWire);
for (; itw.More(); itw.Next())
Ledges.Append(itw.Value());
aWire.Free(Standard_True);
TopTools_ListIteratorOfListOfShape itl(Ledges);
for (; itl.More(); itl.Next())
BB.Remove(aWire, itl.Value());
for (itl.Initialize(Ledges); itl.More(); itl.Next())
{
TopoDS_Shape anEdge = itl.Value();
if (Emap.Contains(anEdge))
anEdge.Reverse();
BB.Add(aWire, anEdge);
}
}
}
}
static void UpdateTolFromTopOrBottomPCurve(const TopoDS_Face& aFace,
TopoDS_Edge& anEdge)
{
@@ -739,9 +705,6 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
result = MkSw.Shape();
UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
myErrorOnSurf = MkSw.ErrorOnSurface();
//Correct <myFirst> and <myLast>
ReverseModifiedEdges(myFirst, myReversedEdges);
ReverseModifiedEdges(myLast, myReversedEdges);
// Labeling of elements
if (mySections.IsNull()) {

View File

@@ -583,28 +583,15 @@ void BRepFill_PipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
//=======================================================================
void BRepFill_PipeShell::DeleteProfile(const TopoDS_Shape& Profile)
{
Standard_Boolean isVertex = (Profile.ShapeType() == TopAbs_VERTEX);
Standard_Boolean Trouve=Standard_False;
Standard_Integer ii;
for (ii=1; ii<=mySeq.Length() && !Trouve; ii++) {
Standard_Boolean found = Standard_False;
const TopoDS_Wire& aWire = mySeq.Value(ii).Wire();
if (isVertex)
{
TopExp_Explorer Explo(aWire, TopAbs_VERTEX);
for (; Explo.More(); Explo.Next())
if (Profile.IsSame(Explo.Current()))
found = Standard_True;
}
else if (Profile.IsSame(aWire))
found = Standard_True;
if (found)
{
Trouve = Standard_True;
mySeq.Remove(ii);
}
const TopoDS_Shape& aSection = mySeq.Value(ii).OriginalShape();
if (Profile.IsSame(aSection))
{
Trouve = Standard_True;
mySeq.Remove(ii);
}
}
if (Trouve) mySection.Nullify();
@@ -760,7 +747,8 @@ void BRepFill_PipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
MkSw.SetAngularControl(angmin, angmax);
MkSw.SetForceApproxC1(myForceApproxC1);
MkSw.SetBounds(TopoDS::Wire(myFirst),
TopoDS::Wire(myLast));
TopoDS::Wire(myLast));
GeomAbs_Shape theContinuity = GeomAbs_C2;
if (myTrihedron == GeomFill_IsDiscreteTrihedron)
theContinuity = GeomAbs_C0;
@@ -914,13 +902,9 @@ const TopoDS_Shape& BRepFill_PipeShell::LastShape() const
//function : Generated
//purpose :
//=======================================================================
// void BRepFill_PipeShell::Generated(const TopoDS_Shape& ,
// TopTools_ListOfShape& )
void BRepFill_PipeShell::Generated(const TopoDS_Shape& theShape,
TopTools_ListOfShape& theList)
{
// throw Standard_NotImplemented("Generated:Pas Fait");
theList.Clear();
if(myGenMap.IsBound(theShape)) {
@@ -1197,9 +1181,6 @@ void BRepFill_PipeShell::Place(const BRepFill_Section& Sec,
Sec.WithCorrection());
TopoDS_Wire TmpWire = Sec.Wire();
aTrsf = Place.Transformation();
//TopLoc_Location Loc2(Place.Transformation()), Loc1;
//Loc1 = TmpWire.Location();
//W.Location(Loc2.Multiplied(Loc1));
//Transform the copy
W = TopoDS::Wire(BRepBuilderAPI_Transform(TmpWire, aTrsf, Standard_True));
////////////////////////////////////
@@ -1240,37 +1221,40 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
TopoDS_Iterator itw;
for (indw = 1; indw <= mySeq.Length(); indw++)
{
const TopoDS_Wire& aSection = mySeq(indw).Wire();
const TopoDS_Shape& Section = mySeq(indw).OriginalShape();
TopoDS_Wire aSection;
Standard_Boolean IsPunctual = mySeq(indw).IsPunctual();
if (IsPunctual)
{
//for punctual sections (first or last)
//we take all the wires generated along the path
TopExp_Explorer Explo(aSection, TopAbs_VERTEX);
const TopoDS_Shape& VerSection = Explo.Current();
TopTools_ListOfShape Elist;
for (Standard_Integer i = 1; i <= anUEdges->UpperRow(); i++)
for (Standard_Integer j = 1; j <= anUEdges->UpperCol(); j++)
Elist.Append(anUEdges->Value(i,j));
myGenMap.Bind(VerSection, Elist);
myGenMap.Bind(Section, Elist);
continue;
}
else
aSection = TopoDS::Wire(Section);
//Take the real index of section on the path
Standard_Integer IndOfW = myIndOfSec(indw);
const TopoDS_Wire& theWire = TopoDS::Wire(WSeq(IndOfW));
BRepTools_WireExplorer wexp_sec(aSection);
for (inde = 1; wexp_sec.More(); wexp_sec.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(wexp_sec.Current());
const TopoDS_Edge& anOriginalEdge = TopoDS::Edge(wexp_sec.Current());
TopoDS_Edge anEdge = TopoDS::Edge(mySeq(indw).ModifiedShape(anOriginalEdge));
if (BRep_Tool::Degenerated(anEdge))
continue;
TopoDS_Shell aShell;
BB.MakeShell(aShell);
TopoDS_Vertex aVertex [2];
TopExp::Vertices(anEdge, aVertex[0], aVertex[1]);
TopExp::Vertices(anOriginalEdge, aVertex[0], aVertex[1]);
Standard_Integer SignOfAnEdge =
(anEdge.Orientation() == TopAbs_FORWARD)? 1 : -1;
(anOriginalEdge.Orientation() == TopAbs_FORWARD)? 1 : -1;
//For each non-degenerated inde-th edge of <aSection>
//we find inde-th edge in <theWire>
@@ -1422,7 +1406,7 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
TopTools_ListOfShape ListShell;
ListShell.Append(aShell);
myGenMap.Bind(anEdge, ListShell);
myGenMap.Bind(anOriginalEdge, ListShell);
////////////////////////
inde++;

View File

@@ -168,6 +168,10 @@ public:
Standard_EXPORT void Simulate (const Standard_Integer NumberOfSection, TopTools_ListOfShape& Sections);
//! Builds the resulting shape (redefined from MakeShape).
//! If theIsToCheckValidity == FALSE then BRepFill_Sweep algorithm
//! is allowed to create invalid faces (having self-interferences).
//! It is considered for them that such faces will be processed and
//! fixed by the high-level algorithms
Standard_EXPORT Standard_Boolean Build();
//! Transform the sweeping Shell in Solid.

View File

@@ -22,6 +22,9 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <ShapeUpgrade_RemoveLocations.hxx>
BRepFill_Section::BRepFill_Section() :islaw(0),
ispunctual(0),
@@ -41,12 +44,19 @@ BRepFill_Section::BRepFill_Section(const TopoDS_Shape& Profile,
contact(WithContact),
correction(WithCorrection)
{
if (Profile.ShapeType() == TopAbs_WIRE)
wire = TopoDS::Wire(Profile);
else if (Profile.ShapeType() == TopAbs_VERTEX)
myOriginalShape = Profile;
ShapeUpgrade_RemoveLocations RemLoc;
RemLoc.SetRemoveLevel(TopAbs_COMPOUND);
RemLoc.Remove(Profile);
TopoDS_Shape aProfile = RemLoc.GetResult();
if (aProfile.ShapeType() == TopAbs_WIRE)
wire = TopoDS::Wire(aProfile);
else if (aProfile.ShapeType() == TopAbs_VERTEX)
{
ispunctual = Standard_True;
TopoDS_Vertex aVertex = TopoDS::Vertex(Profile);
TopoDS_Vertex aVertex = TopoDS::Vertex(aProfile);
BRep_Builder BB;
TopoDS_Edge DegEdge;
@@ -67,3 +77,58 @@ void BRepFill_Section::Set(const Standard_Boolean IsLaw)
{
islaw = IsLaw;
}
TopoDS_Shape BRepFill_Section::ModifiedShape(const TopoDS_Shape& theShape) const
{
TopoDS_Shape aModifiedShape;
switch (theShape.ShapeType())
{
case TopAbs_WIRE:
if (theShape.IsSame(myOriginalShape))
aModifiedShape = wire;
break;
case TopAbs_EDGE:
{
TopoDS_Iterator itor(myOriginalShape);
TopoDS_Iterator itw(wire);
for (; itor.More(); itor.Next(),itw.Next())
{
const TopoDS_Shape& anOriginalEdge = itor.Value();
const TopoDS_Shape& anEdge = itw.Value();
if (anOriginalEdge.IsSame(theShape))
{
aModifiedShape = anEdge;
break;
}
}
}
break;
case TopAbs_VERTEX:
if (theShape.IsSame(myOriginalShape))
{
TopExp_Explorer Explo(wire, TopAbs_VERTEX);
aModifiedShape = Explo.Current();
}
else
{
TopExp_Explorer ExpOrig(myOriginalShape, TopAbs_VERTEX);
TopExp_Explorer ExpWire(wire, TopAbs_VERTEX);
for (; ExpOrig.More(); ExpOrig.Next(),ExpWire.Next())
{
const TopoDS_Shape& anOriginalVertex = ExpOrig.Current();
const TopoDS_Shape& aVertex = ExpWire.Current();
if (anOriginalVertex.IsSame(theShape))
{
aModifiedShape = aVertex;
break;
}
}
}
break;
default:
break;
}
return aModifiedShape;
}

View File

@@ -43,10 +43,14 @@ public:
Standard_EXPORT void Set (const Standard_Boolean IsLaw);
const TopoDS_Shape& OriginalShape() const;
const TopoDS_Wire& Wire() const;
const TopoDS_Vertex& Vertex() const;
Standard_EXPORT TopoDS_Shape ModifiedShape(const TopoDS_Shape& theShape) const;
Standard_Boolean IsLaw() const;
Standard_Boolean IsPunctual() const;
@@ -68,6 +72,7 @@ private:
TopoDS_Shape myOriginalShape;
TopoDS_Wire wire;
TopoDS_Vertex vertex;
Standard_Boolean islaw;

View File

@@ -14,6 +14,11 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline const TopoDS_Shape& BRepFill_Section::OriginalShape() const
{
return myOriginalShape;
}
inline const TopoDS_Wire& BRepFill_Section::Wire() const
{
return wire;

View File

@@ -366,6 +366,56 @@ static Standard_Boolean SameParameter(TopoDS_Edge& E,
return Standard_True;
}
static void CorrectSameParameter(TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2)
{
if (BRep_Tool::Degenerated(theEdge))
return;
Standard_Real fpar, lpar;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, fpar, lpar);
Standard_Boolean PCurveExists [2] = {Standard_False, Standard_False};
BRepAdaptor_Curve BAcurve [2];
if (!theFace1.IsNull())
{
PCurveExists[0] = Standard_True;
BAcurve[0].Initialize(theEdge, theFace1);
}
if (!theFace1.IsNull() &&
theFace1.IsSame(theFace2))
theEdge.Reverse();
if (!theFace2.IsNull())
{
PCurveExists[1] = Standard_True;
BAcurve[1].Initialize(theEdge, theFace2);
}
Standard_Real MaxSqDist = 0.;
const Standard_Integer NCONTROL = 23;
Standard_Real delta = (lpar - fpar)/NCONTROL;
for (Standard_Integer i = 0; i <= NCONTROL; i++)
{
Standard_Real aParam = fpar + i*delta;
gp_Pnt aPnt = aCurve->Value(aParam);
for (Standard_Integer j = 0; j < 2; j++)
if (PCurveExists[j])
{
gp_Pnt aPntFromFace = BAcurve[j].Value(aParam);
Standard_Real aSqDist = aPnt.SquareDistance(aPntFromFace);
if (aSqDist > MaxSqDist)
MaxSqDist = aSqDist;
}
}
Standard_Real aTol = sqrt(MaxSqDist);
BRep_Builder BB;
BB.UpdateEdge(theEdge, aTol);
}
//=======================================================================
//Objet : Orientate an edge of natural restriction
// : General
@@ -666,7 +716,7 @@ static TopoDS_Edge BuildEdge(Handle(Geom_Curve)& C3d,
// P2 = BT.Pnt(VL);
P2 = BRep_Tool::Pnt(VL);
// Tol2 = BT.Tolerance(VF);
Tol2 = BRep_Tool::Tolerance(VF);
Tol2 = BRep_Tool::Tolerance(VL);
Tol = Max(Tol1, Tol2);
if (VF.IsSame(VL) ||
@@ -809,24 +859,44 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
Prof1 = BRep_Tool::Curve(E1, f1, l1);
// Prof2 = BT.Curve(E2, f2, l2);
Prof2 = BRep_Tool::Curve(E2, f2, l2);
gp_Pnt P1, P2, P;
gp_Pnt2d p1, p2;
gp_Trsf Tf;
Tf.SetTransformation(Axe);
// Choose the angle of opening
P1 = Prof1->Value((f1+l1)/2);
P2 = Prof2->Value((f2+l2)/2);
P1.Transform(Tf);
P2.Transform(Tf);
p1.SetCoord(P1.Z(), P1.X());
p2.SetCoord(P2.Z(), P2.X());
gp_Vec2d v1(gp::Origin2d(), p1);
gp_Vec2d v2(gp::Origin2d(), p2);
if (v1.Magnitude() <= gp::Resolution() ||
v2.Magnitude() <= gp::Resolution())
// Indeed, both Prof1 and Prof2 are the same curves but in different positions
gp_Pnt P1, P2, P;
// Choose the angle of opening
gp_Trsf aTf;
aTf.SetTransformation(Axe);
// Choose the furthest point from the "center of revolution"
// to provide correct angle measurement.
const Standard_Real aPrm[] = {f1, 0.5*(f1 + l1), l1};
const gp_Pnt aP1[] = {Prof1->Value(aPrm[0]).Transformed(aTf),
Prof1->Value(aPrm[1]).Transformed(aTf),
Prof1->Value(aPrm[2]).Transformed(aTf)};
Standard_Integer aMaxIdx = -1;
Standard_Real aMaxDist = RealFirst();
for (Standard_Integer i = 0; i < 3; i++)
{
const Standard_Real aDist = aP1[i].X()*aP1[i].X() + aP1[i].Z()*aP1[i].Z();
if (aDist > aMaxDist)
{
aMaxDist = aDist;
aMaxIdx = i;
}
}
const gp_Pnt aP2 = Prof2->Value(aPrm[aMaxIdx]).Transformed(aTf);
const gp_Vec2d aV1(aP1[aMaxIdx].Z(), aP1[aMaxIdx].X());
const gp_Vec2d aV2(aP2.Z(), aP2.X());
if (aV1.SquareMagnitude() <= gp::Resolution() ||
aV2.SquareMagnitude() <= gp::Resolution())
{
return Standard_False;
Angle = v1.Angle(v2);
}
Angle = aV1.Angle(aV2);
gp_Ax1 axe(Axe.Location(), Axe.YDirection());
@@ -844,7 +914,7 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
// Control the direction of the rotation
Standard_Boolean ToReverseResult = Standard_False;
gp_Vec d1u;
d1u = Surf->DN(0, (f1+l1)/2, 1, 0);
d1u = Surf->DN(0, aPrm[aMaxIdx], 1, 0);
if (d1u.Angle(TangentOnPart1) > M_PI/2) { //Invert everything
ToReverseResult = Standard_True;
/*
@@ -1135,19 +1205,40 @@ static Standard_Boolean Filling(const TopoDS_Shape& EF,
B.MakeEdge(Aux2);
// Set the orientation
gp_Vec D1U, D1V, N1, N2;
C1->D0( (f1+l1)/2, P2d);
Surf->D1(P2d.X(), P2d.Y(), P, D1U, D1V);
N1 = D1U^D1V;
// C1 = BT.CurveOnSurface(E1, TopoDS::Face(F1), f2, l2);
C1 = BRep_Tool::CurveOnSurface(E1, TopoDS::Face(F1), f2, l2);
C1->D0( (f1+l1)/2, P2d);
Handle(BRepAdaptor_HSurface) AS = new BRepAdaptor_HSurface(TopoDS::Face(F1));
AS->D1(P2d.X(), P2d.Y(), P, D1U, D1V);
N2 = D1U^D1V;
// Provide correct normals computation
// (the normal will be computed not in
// singularity point definitely).
Angle = RealFirst();
for (Standard_Integer i = 0; i < 3; i++)
{
gp_Vec D1U, D1V, N1, N2;
C1->D0(aPrm[i], P2d);
Surf->D1(P2d.X(), P2d.Y(), P, D1U, D1V);
N1 = D1U^D1V;
if ( (F1.Orientation() == TopAbs_REVERSED) ^ (N1.Angle(N2)>M_PI/2) )
if (N1.SquareMagnitude() < Precision::SquareConfusion())
continue;
// C1 = BT.CurveOnSurface(E1, TopoDS::Face(F1), f2, l2);
C1 = BRep_Tool::CurveOnSurface(E1, TopoDS::Face(F1), f2, l2);
C1->D0(aPrm[i], P2d);
Handle(BRepAdaptor_HSurface) AS = new BRepAdaptor_HSurface(TopoDS::Face(F1));
AS->D1(P2d.X(), P2d.Y(), P, D1U, D1V);
N2 = D1U^D1V;
if (N2.SquareMagnitude() < Precision::SquareConfusion())
continue;
Angle = N1.Angle(N2);
break;
}
if (Angle == RealFirst())
return Standard_False;
if ( (F1.Orientation() == TopAbs_REVERSED) ^ (Angle>M_PI/2))
Result.Orientation(TopAbs_REVERSED);
else Result.Orientation(TopAbs_FORWARD);
@@ -1661,6 +1752,60 @@ static Standard_Boolean IsDegen(const Handle(Geom_Surface)& S,
return B;
}
static void ReverseEdgeInFirstOrLastWire(TopoDS_Shape& theWire,
const TopoDS_Shape& theEdge)
{
TopoDS_Shape EdgeToReverse;
TopoDS_Iterator itw(theWire);
for (; itw.More(); itw.Next())
{
const TopoDS_Shape& anEdge = itw.Value();
if (anEdge.IsSame(theEdge))
{
EdgeToReverse = anEdge;
break;
}
}
if (!EdgeToReverse.IsNull())
{
BRep_Builder BB;
theWire.Free(Standard_True);
BB.Remove(theWire, EdgeToReverse);
EdgeToReverse.Reverse();
BB.Add(theWire, EdgeToReverse);
}
}
static void ReverseModifiedEdges(TopoDS_Wire& theWire,
const TopTools_MapOfShape& theEmap)
{
if (theEmap.IsEmpty())
return;
TopoDS_Iterator itw(theWire);
BRep_Builder BB;
TopTools_ListOfShape Ledges;
for (; itw.More(); itw.Next())
Ledges.Append(itw.Value());
theWire.Free(Standard_True);
TopTools_ListIteratorOfListOfShape itl(Ledges);
for (; itl.More(); itl.Next())
BB.Remove(theWire, itl.Value());
for (itl.Initialize(Ledges); itl.More(); itl.Next())
{
TopoDS_Shape anEdge = itl.Value();
if (theEmap.Contains(anEdge))
anEdge.Reverse();
BB.Add(theWire, anEdge);
}
}
//=======================================================================
//function : Constructeur
//purpose :
@@ -1670,8 +1815,6 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
const Standard_Boolean WithKPart) :
isDone(Standard_False),
KPart(WithKPart)
{
mySec = Section;
myLoc = Location;
@@ -2064,6 +2207,10 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
Standard_Boolean exuv, singu, singv;
Handle(Geom_Surface) S;
//Correct <FirstShape> and <LastShape>: reverse modified edges
ReverseModifiedEdges(FirstShape, ReversedEdges);
ReverseModifiedEdges(LastShape, ReversedEdges);
// (2.0) return preexisting Edges and vertices
TopoDS_Edge E;
TColStd_Array1OfBoolean IsBuilt(1, NbLaw);
@@ -2293,7 +2440,6 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
// ---------- Creation of Vertex and edge ------------
ReversedEdges.Clear();
for (ipath=1, IPath=IFirst; ipath<=NbPath;
ipath++, IPath++) {
for (isec=1; isec <=NbLaw; isec++) {
@@ -2496,7 +2642,10 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
TopoDS::Edge(VEdge(isec, ipath)),
ReversedEdges);
if (ReversedEdges.Contains(VEdge(isec, ipath)))
{
ReverseEdgeInFirstOrLastWire(FirstShape, VEdge(isec, ipath));
StartEdges(isec).Reverse();
}
}
}
@@ -2536,6 +2685,8 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
RebuildTopOrBottomEdge(aNewLastEdge,
TopoDS::Edge(VEdge(isec, ipath+1)),
ReversedEdges);
if (ReversedEdges.Contains(VEdge(isec, ipath+1)))
ReverseEdgeInFirstOrLastWire(LastShape, VEdge(isec, ipath+1));
}
}
}
@@ -2877,6 +3028,30 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
}
}
//Ensure Same Parameter on U-edges
for (ii = myUEdges->LowerRow(); ii <= myUEdges->UpperRow(); ii++)
{
if (mySec->IsUClosed() && ii == myUEdges->UpperRow())
continue;
for (jj = myUEdges->LowerCol(); jj <= myUEdges->UpperCol(); jj++)
{
TopoDS_Edge anEdge = TopoDS::Edge(myUEdges->Value(ii, jj));
if (anEdge.IsNull())
continue;
TopoDS_Face Face1, Face2;
Standard_Integer i1 = ii-1, i2 = ii;
if (i1 == 0 && mySec->IsUClosed())
i1 = myFaces->UpperRow();
if (i2 > myFaces->UpperRow())
i2 = 0;
if (i1 != 0)
Face1 = TopoDS::Face(myFaces->Value(i1, jj));
if (i2 != 0)
Face2 = TopoDS::Face(myFaces->Value(i2, jj));
CorrectSameParameter(anEdge, Face1, Face2);
}
}
for (ii = 1; ii <= NbLaw; ii++)
for (jj = 1; jj <= NbPath; jj++)
{
@@ -3083,7 +3258,7 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
}
}
BRepFill_TrimShellCorner aTrim(aFaces, AxeOfBisPlane, aPlaneF);
BRepFill_TrimShellCorner aTrim(aFaces, Transition, AxeOfBisPlane);
aTrim.AddBounds(Bounds);
aTrim.AddUEdges(aUEdges);
aTrim.Perform();
@@ -3172,7 +3347,8 @@ TopoDS_Shape BRepFill_Sweep::Tape(const Standard_Integer Index) const
// Filling
B = Filling(It1.Value(), myFaces->Value(ii, I1),
It2.Value(), myFaces->Value(ii, I2),
myVEdgesModified, myTol3d, Axe, T1, Bord1, Bord2, FF);
myVEdgesModified, myTol3d, Axe, T1,
Bord1, Bord2, FF);
if (B) {
myAuxShape.Append(FF);

View File

@@ -80,7 +80,7 @@ public:
//! to be C0.
Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1);
//! Build the Sweeep Surface
//! Build the Sweep Surface
//! Transition define Transition strategy
//! Approx define Approximation Strategy
//! - GeomFill_Section : The composed Function Location X Section
@@ -118,13 +118,6 @@ public:
protected:
private:
Standard_EXPORT Standard_Boolean CorrectApproxParameters();
Standard_EXPORT Standard_Boolean BuildWire (const BRepFill_TransitionStyle Transition);
@@ -142,6 +135,13 @@ private:
Standard_EXPORT void RebuildTopOrBottomEdge (const TopoDS_Edge& aNewEdge, TopoDS_Edge& anEdge, TopTools_MapOfShape& ReversedEdges) const;
private:
Standard_Boolean isDone;
Standard_Boolean KPart;
Standard_Real myTol3d;
@@ -168,7 +168,6 @@ private:
TopoDS_Wire FirstShape;
TopoDS_Wire LastShape;
};

View File

@@ -25,6 +25,7 @@
#include <BRepFill_TrimShellCorner.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepLib_MakeWire.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRepTools_ReShape.hxx>
#include <gce_MakeLin.hxx>
#include <GCPnts_UniformAbscissa.hxx>
@@ -63,6 +64,23 @@
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <BRepExtrema_ExtCC.hxx>
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
TopoDS_Compound& theComp,
const gp_Ax1& theAxis);
static Standard_Boolean FindMiddleEdges(const TopoDS_Vertex& theVertex1,
const TopoDS_Vertex& theVertex2,
const gp_Ax1& theAxis,
TopoDS_Compound& theComp,
TopTools_ListOfShape& theElist);
static Standard_Boolean FindCommonVertex(const TopoDS_Edge& theFirstEdge,
const TopoDS_Edge& theLastEdge,
const TopoDS_Vertex& theFirstVertex,
const TopoDS_Vertex& theLastVertex,
TopoDS_Vertex& theCommonVertex);
static Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
const Standard_Integer theEIndex1,
@@ -71,24 +89,6 @@ static Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
Standard_Real& theParamOnE1,
Standard_Real& theParamOnE2);
static Standard_Boolean MakeFacesNonSec(const Standard_Integer theIndex,
const Handle(TopTools_HArray2OfShape)& theUEdges,
const Handle(TopTools_HArray2OfShape)& theBounds,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
TopTools_DataMapOfShapeListOfShape& theHistMap);
static Standard_Boolean MakeFacesSec(const Standard_Integer theIndex,
const Handle(TopTools_HArray2OfShape)& theUEdges,
const Handle(TopTools_HArray2OfShape)& theBounds,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
const Standard_Integer theSSInterfIndex,
const gp_Ax2& AxeOfBisPlane,
TopTools_DataMapOfShapeListOfShape& theHistMap);
static Standard_Boolean SplitUEdges(const Handle(TopTools_HArray2OfShape)& theUEdges,
const BOPDS_PDS& theDS,
TopTools_DataMapOfShapeListOfShape& theHistMap);
@@ -186,55 +186,27 @@ static Standard_Real ComputeAveragePlaneAndMaxDeviation(const TopoDS_Shape& aWir
gp_Pln& thePlane,
Standard_Boolean& IsSingular);
static Standard_Boolean ChooseSection(const TopoDS_Shape& Comp,
const gp_Ax2& bis,
TopoDS_Shape& resWire,
gp_Pln& resPlane,
Standard_Boolean& IsSingular);
static void UpdateSectionEdge(TopoDS_Edge& theEdge,
const TopoDS_Vertex& theConstVertex,
TopoDS_Vertex& theVertex,
const Standard_Real theParam);
// ===========================================================================================
// function: Constructor
// purpose:
// ===========================================================================================
BRepFill_TrimShellCorner::BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
const gp_Ax2& theAxeOfBisPlane,
const TopoDS_Face& theSecPlane) :
myAxeOfBisPlane(theAxeOfBisPlane),
myDone(Standard_False),
myHasSection(Standard_False)
const BRepFill_TransitionStyle theTransition,
const gp_Ax2& theAxeOfBisPlane) :
myTransition(theTransition),
myAxeOfBisPlane(theAxeOfBisPlane),
myDone(Standard_False),
myHasSection(Standard_False)
{
myFaces = new TopTools_HArray2OfShape(theFaces->LowerRow(), theFaces->UpperRow(),
theFaces->LowerCol(), theFaces->UpperCol());
myFaces->ChangeArray2() = theFaces->Array2();
mySecPln = theSecPlane;
}
// ===========================================================================================
// function: Constructor
// purpose:
// ===========================================================================================
BRepFill_TrimShellCorner::BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
const gp_Ax2& theAxeOfBisPlane,
const TopoDS_Wire& theSpine,
const TopoDS_Face& theSecPlane):
myAxeOfBisPlane(theAxeOfBisPlane),
myDone(Standard_False),
myHasSection(Standard_False)
{
myFaces = new TopTools_HArray2OfShape(theFaces->LowerRow(), theFaces->UpperRow(),
theFaces->LowerCol(), theFaces->UpperCol());
myFaces->ChangeArray2() = theFaces->Array2();
mySpine = theSpine;
mySecPln = theSecPlane;
}
// ===========================================================================================
// function: SetSpine
// purpose:
// ===========================================================================================
void BRepFill_TrimShellCorner::SetSpine(const TopoDS_Wire& theSpine)
{
mySpine = theSpine;
}
// ===========================================================================================
@@ -351,14 +323,13 @@ void BRepFill_TrimShellCorner::Perform()
}
if(!bhassec) {
if(!MakeFacesNonSec(ii, myUEdges, myBounds, theDS, anIndex1, anIndex2, myHistMap)) {
if(!MakeFacesNonSec(ii, theDS, anIndex1, anIndex2)) {
myHistMap.Clear();
return;
}
}
else {
if(!MakeFacesSec(ii, myUEdges, myBounds, theDS, anIndex1, anIndex2,
i, myAxeOfBisPlane, myHistMap)) {
if(!MakeFacesSec(ii, theDS, anIndex1, anIndex2, i)) {
myHistMap.Clear();
return;
}
@@ -403,23 +374,21 @@ void BRepFill_TrimShellCorner::Modified(const TopoDS_Shape& theShape,
}
// ----------------------------------------------------------------------------------------------------
// static function: MakeFacesNonSec
// purpose:
// function: MakeFacesNonSec
// purpose: Updates <myHistMap> by new faces in the case when old faces do not intersect
// ----------------------------------------------------------------------------------------------------
Standard_Boolean MakeFacesNonSec(const Standard_Integer theIndex,
const Handle(TopTools_HArray2OfShape)& theUEdges,
const Handle(TopTools_HArray2OfShape)& theBounds,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
TopTools_DataMapOfShapeListOfShape& theHistMap)
Standard_Boolean
BRepFill_TrimShellCorner::MakeFacesNonSec(const Standard_Integer theIndex,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2)
{
Standard_Boolean bHasNewEdge = Standard_False;
TopoDS_Edge aNewEdge;
BRep_Builder aBB;
const TopoDS_Shape& aE1 = theBounds->Value(theIndex, 1);
const TopoDS_Shape& aE2 = theBounds->Value(theIndex, 2);
const TopoDS_Shape& aE1 = myBounds->Value(theIndex, 1);
const TopoDS_Shape& aE2 = myBounds->Value(theIndex, 2);
// search common vertex between bounds. begin
TopoDS_Vertex aCommonVertex;
@@ -439,20 +408,20 @@ Standard_Boolean MakeFacesNonSec(const Standard_Integer theI
Standard_Integer ueit = 0, eindex = 0;
for(ueit = 1, eindex = theIndex; ueit <= 2; ueit++, eindex++) {
const TopoDS_Shape& aShape1 = theUEdges->Value(eindex, theUEdges->LowerCol());
const TopoDS_Shape& aShape2 = theUEdges->Value(eindex, theUEdges->UpperCol());
const TopoDS_Shape& aShape1 = myUEdges->Value(eindex, myUEdges->LowerCol());
const TopoDS_Shape& aShape2 = myUEdges->Value(eindex, myUEdges->UpperCol());
TopoDS_Edge aUE1 = TopoDS::Edge(aShape1);
TopoDS_Edge aUE2 = TopoDS::Edge(aShape2);
if(theHistMap.IsBound(aShape1)) {
const TopTools_ListOfShape& lst = theHistMap.Find(aShape1);
if (myHistMap.IsBound(aShape1)) {
const TopTools_ListOfShape& lst = myHistMap.Find(aShape1);
if(!lst.IsEmpty())
aUE1 = TopoDS::Edge(lst.First());
}
if(theHistMap.IsBound(aShape2)) {
const TopTools_ListOfShape& lst = theHistMap.Find(aShape2);
if (myHistMap.IsBound(aShape2)) {
const TopTools_ListOfShape& lst = myHistMap.Find(aShape2);
if(!lst.IsEmpty())
aUE2 = TopoDS::Edge(lst.First());
@@ -499,11 +468,11 @@ Standard_Boolean MakeFacesNonSec(const Standard_Integer theI
aBB.MakeCompound(aComp);
for(ueit = 1, eindex = theIndex; ueit <= 2; ueit++, eindex++) {
const TopoDS_Shape& aShape = theUEdges->Value(eindex, theUEdges->LowerCol() + fit - 1);
const TopoDS_Shape& aShape = myUEdges->Value(eindex, myUEdges->LowerCol() + fit - 1);
TopoDS_Shape aUE = aShape;
if(theHistMap.IsBound(aShape)) {
const TopTools_ListOfShape& lst = theHistMap.Find(aShape);
if(myHistMap.IsBound(aShape)) {
const TopTools_ListOfShape& lst = myHistMap.Find(aShape);
if(!lst.IsEmpty())
aUE = TopoDS::Edge(lst.First());
@@ -638,7 +607,7 @@ Standard_Boolean MakeFacesNonSec(const Standard_Integer theI
aNewFace.Orientation(aFaceOri);
TopTools_ListOfShape atmpList;
atmpList.Append(aNewFace);
theHistMap.Bind(aFace, atmpList);
myHistMap.Bind(aFace, atmpList);
anExpE.Init(aFace, TopAbs_EDGE);
@@ -648,7 +617,7 @@ Standard_Boolean MakeFacesNonSec(const Standard_Integer theI
if(aNewValue.IsNull() || aNewValue.IsSame(anExpE.Current()))
continue;
if(theHistMap.IsBound(anExpE.Current()))
if (myHistMap.IsBound(anExpE.Current()))
continue;
TopTools_ListOfShape aListOfNewEdge;
TopExp_Explorer anExpE2(aNewValue, TopAbs_EDGE);
@@ -656,7 +625,7 @@ Standard_Boolean MakeFacesNonSec(const Standard_Integer theI
for(; anExpE2.More(); anExpE2.Next()) {
aListOfNewEdge.Append(anExpE2.Current());
}
theHistMap.Bind(anExpE.Current(), aListOfNewEdge);
myHistMap.Bind(anExpE.Current(), aListOfNewEdge);
}
}
@@ -664,18 +633,15 @@ Standard_Boolean MakeFacesNonSec(const Standard_Integer theI
}
// ----------------------------------------------------------------------------------------------------
// static function: MakeFacesSec
// purpose:
// function: MakeFacesSec
// purpose: Updates <myHistMap> by new faces in the case when old faces intersect each other
// ----------------------------------------------------------------------------------------------------
Standard_Boolean MakeFacesSec(const Standard_Integer theIndex,
const Handle(TopTools_HArray2OfShape)& theUEdges,
const Handle(TopTools_HArray2OfShape)& theBounds,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
const Standard_Integer theSSInterfIndex,
const gp_Ax2& AxeOfBisPlane,
TopTools_DataMapOfShapeListOfShape& theHistMap)
Standard_Boolean
BRepFill_TrimShellCorner::MakeFacesSec(const Standard_Integer theIndex,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
const Standard_Integer theSSInterfIndex)
{
const BOPDS_VectorOfInterfFF& aFFs = theDS->InterfFF();
const BOPDS_InterfFF& aFFi = aFFs(theSSInterfIndex);
@@ -687,10 +653,30 @@ Standard_Boolean MakeFacesSec(const Standard_Integer theInde
if(!FilterSectionEdges(aBCurves, aSecPlane, theDS, aSecEdges))
return Standard_False;
//Extract vertices on the intersection of correspondent U-edges
const TopoDS_Shape& LeftE1 = myUEdges->Value(theIndex, 1);
const TopoDS_Shape& LeftE2 = myUEdges->Value(theIndex, 2);
const TopoDS_Shape& RightE1 = myUEdges->Value(theIndex+1, 1);
const TopoDS_Shape& RightE2 = myUEdges->Value(theIndex+1, 2);
Standard_Integer IndexOfLeftE1 = theDS->Index(LeftE1);
Standard_Integer IndexOfLeftE2 = theDS->Index(LeftE2);
Standard_Integer IndexOfRightE1 = theDS->Index(RightE1);
Standard_Integer IndexOfRightE2 = theDS->Index(RightE2);
TopoDS_Vertex FirstVertex, LastVertex;
Standard_Real ParamOnLeftE1, ParamOnLeftE2, ParamOnRightE1, ParamOnRightE2;
FindCommonVertex(theDS, IndexOfLeftE1, IndexOfLeftE2,
FirstVertex, ParamOnLeftE1, ParamOnLeftE2);
FindCommonVertex(theDS, IndexOfRightE1, IndexOfRightE2,
LastVertex, ParamOnRightE1, ParamOnRightE2);
TopoDS_Shape SecWire;
gp_Pln SecPlane;
Standard_Boolean IsSingular;
Standard_Boolean WireFound = ChooseSection( aSecEdges, AxeOfBisPlane, SecWire, SecPlane, IsSingular );
Standard_Boolean WireFound = ChooseSection(aSecEdges,
FirstVertex, LastVertex,
SecWire, SecPlane, IsSingular );
if(WireFound) {
//aSecEdges = SecWire;
@@ -715,19 +701,19 @@ Standard_Boolean MakeFacesSec(const Standard_Integer theInde
TopAbs_Orientation aFaceOri = aFace.Orientation();
TopoDS_Face aFaceF = aFace;
aFaceF.Orientation(TopAbs_FORWARD);
TopoDS_Edge aBoundEdge = TopoDS::Edge(theBounds->Value(theIndex, theBounds->LowerCol() +fit));
TopoDS_Edge aBoundEdge = TopoDS::Edge(myBounds->Value(theIndex, myBounds->LowerCol() +fit));
Standard_Integer aBoundEdgeIndex = theDS->Index(aBoundEdge);
TopoDS_Edge aUE1;
TopoDS_Edge aUE2;
if(!GetUEdges(theIndex, fit, theUEdges, aBoundEdge, aFaceF, aUE1, aUE2))
if(!GetUEdges(theIndex, fit, myUEdges, aBoundEdge, aFaceF, aUE1, aUE2))
return Standard_False;
TopoDS_Edge aUE1old = aUE1;
TopoDS_Edge aUE2old = aUE2;
if(theHistMap.IsBound(aUE1)) {
const TopTools_ListOfShape& lst = theHistMap.Find(aUE1);
if (myHistMap.IsBound(aUE1)) {
const TopTools_ListOfShape& lst = myHistMap.Find(aUE1);
if(!lst.IsEmpty()) {
const TopoDS_Shape& anEdge = lst.First().Oriented(aUE1.Orientation());
@@ -738,8 +724,8 @@ Standard_Boolean MakeFacesSec(const Standard_Integer theInde
}
}
if(theHistMap.IsBound(aUE2)) {
const TopTools_ListOfShape& lst = theHistMap.Find(aUE2);
if (myHistMap.IsBound(aUE2)) {
const TopTools_ListOfShape& lst = myHistMap.Find(aUE2);
if(!lst.IsEmpty()) {
const TopoDS_Shape& anEdge = lst.First().Oriented(aUE2.Orientation());
@@ -757,12 +743,12 @@ Standard_Boolean MakeFacesSec(const Standard_Integer theInde
Standard_Boolean isPave1OnUEdge = Standard_True;
if(FindFromUEdge(aUE1old, aUE2old, aUE1, aUE2, aFace, aSecEdges, fit, aBoundEdge, aBoundEdgeIndex,
theDS, theHistMap, aCompOfSecEdges, aListOfWireEdges, aPave1, isPave1OnUEdge)) {
theDS, myHistMap, aCompOfSecEdges, aListOfWireEdges, aPave1, isPave1OnUEdge)) {
TopTools_ListOfShape aSecondListOfEdges;
Standard_Boolean bisSectionFound = Standard_False;
if(!FindFromVEdge(aPave1, isPave1OnUEdge, aUE1old, aUE2old, aFace, aCompOfSecEdges, fit, aBoundEdge,
aBoundEdgeIndex, theDS, theHistMap, aSecondListOfEdges, bisSectionFound)) {
aBoundEdgeIndex, theDS, myHistMap, aSecondListOfEdges, bisSectionFound)) {
return Standard_False;
}
@@ -792,7 +778,7 @@ Standard_Boolean MakeFacesSec(const Standard_Integer theInde
aNewFace.Orientation(aFaceOri);
TopTools_ListOfShape atmpList;
atmpList.Append(aNewFace);
theHistMap.Bind(aFace, atmpList);
myHistMap.Bind(aFace, atmpList);
TopExp_Explorer anExpE(aFace, TopAbs_EDGE);
@@ -802,7 +788,7 @@ Standard_Boolean MakeFacesSec(const Standard_Integer theInde
if(aNewValue.IsNull() || aNewValue.IsSame(anExpE.Current()))
continue;
if(theHistMap.IsBound(anExpE.Current()))
if (myHistMap.IsBound(anExpE.Current()))
continue;
TopTools_ListOfShape aListOfNewEdge;
TopExp_Explorer anExpE2(aNewValue, TopAbs_EDGE);
@@ -810,12 +796,240 @@ Standard_Boolean MakeFacesSec(const Standard_Integer theInde
for(; anExpE2.More(); anExpE2.Next()) {
aListOfNewEdge.Append(anExpE2.Current());
}
theHistMap.Bind(anExpE.Current(), aListOfNewEdge);
myHistMap.Bind(anExpE.Current(), aListOfNewEdge);
}
}
return Standard_True;
}
//=======================================================================
//function : ChooseSection
//purpose :
//=======================================================================
Standard_Boolean BRepFill_TrimShellCorner::ChooseSection(const TopoDS_Shape& Comp,
const TopoDS_Vertex& theFirstVertex,
const TopoDS_Vertex& theLastVertex,
TopoDS_Shape& resWire,
gp_Pln& resPlane,
Standard_Boolean& IsSingular)
{
IsSingular = Standard_False;
Standard_Integer ind, i, j;
BRep_Builder BB;
if (myTransition == BRepFill_Right &&
!theFirstVertex.IsNull() &&
!theLastVertex.IsNull()) //the case where section wire goes from
//its known first vertex to its known last vertex
{
TopoDS_Wire NewWire;
BB.MakeWire(NewWire);
TopoDS_Compound OldComp;
BB.MakeCompound( OldComp );
TopoDS_Iterator iter( Comp );
for (; iter.More(); iter.Next())
BB.Add( OldComp, iter.Value() );
TopoDS_Edge FirstEdge = FindEdgeCloseToBisectorPlane(theFirstVertex,
OldComp,
myAxeOfBisPlane.Axis());
iter.Initialize(OldComp);
if (!iter.More())
{
iter.Initialize(Comp);
BB.Add( OldComp, iter.Value() );
}
TopoDS_Edge LastEdge = FindEdgeCloseToBisectorPlane(theLastVertex,
OldComp,
myAxeOfBisPlane.Axis());
BB.Add(NewWire, FirstEdge);
if (!FirstEdge.IsSame(LastEdge))
{
TopoDS_Vertex aCommonVertex;
Standard_Boolean CommonVertexExists = FindCommonVertex(FirstEdge, LastEdge,
theFirstVertex, theLastVertex,
aCommonVertex);
if (CommonVertexExists)
BB.Add(NewWire, LastEdge);
else
{
TopoDS_Vertex Vertex1, Vertex2, V1, V2;
TopExp::Vertices(FirstEdge, V1, V2);
Vertex1 = (theFirstVertex.IsSame(V1))? V2 : V1;
TopExp::Vertices(LastEdge, V1, V2);
Vertex2 = (theLastVertex.IsSame(V1))? V2 : V1;
TopTools_ListOfShape MiddleEdges;
if (FindMiddleEdges(Vertex1, Vertex2, myAxeOfBisPlane.Axis(), OldComp, MiddleEdges))
{
TopTools_ListIteratorOfListOfShape itl(MiddleEdges);
for (; itl.More(); itl.Next())
BB.Add(NewWire, itl.Value());
BB.Add(NewWire, LastEdge);
}
else
{
//trim <FirstEdge> and <LastEdge> in the points of extrema
//these points become new vertex with centre between them
BRepExtrema_ExtCC Extrema(FirstEdge, LastEdge);
if (Extrema.IsDone() && Extrema.NbExt() > 0)
{
Standard_Integer imin = 1;
for (i = 2; i <= Extrema.NbExt(); i++)
if (Extrema.SquareDistance(i) < Extrema.SquareDistance(imin))
imin = i;
Standard_Real aMinDist = sqrt(Extrema.SquareDistance(imin));
Standard_Real ParamOnFirstEdge = Extrema.ParameterOnE1(imin);
Standard_Real ParamOnLastEdge = Extrema.ParameterOnE2(imin);
gp_Pnt PointOnFirstEdge = Extrema.PointOnE1(imin);
gp_Pnt PointOnLastEdge = Extrema.PointOnE2(imin);
gp_Pnt MidPnt((PointOnFirstEdge.XYZ() + PointOnLastEdge.XYZ())/2);
aCommonVertex = BRepLib_MakeVertex(MidPnt);
BB.UpdateVertex(aCommonVertex, 1.001*aMinDist/2);
UpdateSectionEdge(FirstEdge, theFirstVertex, aCommonVertex, ParamOnFirstEdge);
UpdateSectionEdge(LastEdge, theLastVertex, aCommonVertex, ParamOnLastEdge);
BB.Add(NewWire, LastEdge);
}
}
}
}
resWire = NewWire;
resPlane = gp_Pln(myAxeOfBisPlane);
return Standard_True;
}
//General case: try to find continuous section closest to bisector plane
TopoDS_Compound OldComp;
BRep_Builder B;
B.MakeCompound( OldComp );
TopoDS_Iterator iter( Comp );
for (; iter.More(); iter.Next())
B.Add( OldComp, iter.Value() );
Standard_Boolean anError = Standard_False;
//TopoDS_Wire NewWire [2];
TopTools_SequenceOfShape Wseq;
for (;;)
{
TopExp_Explorer explo( OldComp, TopAbs_EDGE );
if (!explo.More())
break;
TopoDS_Edge FirstEdge = TopoDS::Edge( explo.Current() );
TopoDS_Wire NewWire = BRepLib_MakeWire( FirstEdge );
B.Remove( OldComp, FirstEdge );
if (NewWire.Closed())
{
Wseq.Append(NewWire);
continue;
}
for (;;)
{
TopoDS_Vertex Extremity [2];
TopExp::Vertices( NewWire, Extremity[0], Extremity[1] );
if (Extremity[0].IsNull() || Extremity[1].IsNull())
{
anError = Standard_True;
break;
}
TopTools_IndexedDataMapOfShapeListOfShape VEmap;
TopExp::MapShapesAndAncestors( OldComp, TopAbs_VERTEX, TopAbs_EDGE, VEmap );
TopTools_ListOfShape Vedges [2];
for (j = 0; j < 2; j++)
if (VEmap.Contains( Extremity[j] ))
Vedges[j] = VEmap.FindFromKey( Extremity[j] );
if (Vedges[0].IsEmpty() && Vedges[1].IsEmpty())
//no more edges in OldComp to continue NewWire
break;
Standard_Boolean Modified = Standard_False;
for (j = 0; j < 2; j++)
{
if (Vedges[j].Extent() == 1)
{
const TopoDS_Edge& anEdge = TopoDS::Edge( Vedges[j].First() );
NewWire = BRepLib_MakeWire( NewWire, anEdge );
B.Remove( OldComp, anEdge );
Modified = Standard_True;
}
}
if (!Modified) //only multiple connections
{
ind = (Vedges[0].IsEmpty())? 1 : 0;
TopTools_SequenceOfShape Edges;
TopTools_ListIteratorOfListOfShape itl( Vedges[ind] );
for (; itl.More(); itl.Next())
Edges.Append( itl.Value() );
Standard_Integer theind=0;
Standard_Real MinDeviation = RealLast();
for (j = 1; j <= Edges.Length(); j++)
{
TopoDS_Wire aWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(j)) );
gp_Pln aPlane;
Standard_Boolean issing;
Standard_Real Deviation = ComputeAveragePlaneAndMaxDeviation( aWire, aPlane, issing );
if (Deviation < MinDeviation)
{
MinDeviation = Deviation;
theind = j;
}
}
NewWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(theind)) );
B.Remove( OldComp, Edges(theind) );
}
if (NewWire.Closed())
break;
}
Wseq.Append(NewWire);
if (anError)
break;
}
Standard_Real MinAngle = RealLast();
TopExp_Explorer Explo( OldComp, TopAbs_EDGE );
if (!anError && !Explo.More()) //wires are built successfully and compound <OldComp> is empty
{
if (Wseq.Length() == 1) //only one wire => it becomes result
{
resWire = Wseq.First();
ComputeAveragePlaneAndMaxDeviation( resWire, resPlane, IsSingular );
return Standard_True;
}
else //we must choose the wire which average plane is closest to bisector plane
{ //(check angle between axes)
for (i = 1; i <= Wseq.Length(); i++)
{
TopoDS_Wire aWire = TopoDS::Wire( Wseq(i) );
gp_Pln aPln;
Standard_Boolean issing;
ComputeAveragePlaneAndMaxDeviation( aWire, aPln, issing );
if (issing)
continue;
Standard_Real Angle = aPln.Axis().Angle( myAxeOfBisPlane.Axis() );
if (Angle > M_PI/2)
Angle = M_PI - Angle;
if (Angle < MinAngle)
{
MinAngle = Angle;
resWire = aWire;
resPlane = aPln;
}
}
return Standard_True;
}
}
return Standard_False;
}
// ------------------------------------------------------------------------------------------
// static function: SplitUEdges
@@ -966,13 +1180,15 @@ Standard_Boolean FindCommonVertex(const BOPDS_PDS& theDS,
continue;
IntTools_CommonPrt aCP = aEE.CommonPart();
if(aCP.Type() == TopAbs_VERTEX) {
if(aCP.Type() == TopAbs_VERTEX)
{
theCommonVertex = *(TopoDS_Vertex*)&theDS->Shape(aEE.IndexNew());
if (theEIndex1 == aEE.Index1()) {
if (theEIndex1 == aEE.Index1())
IntTools_Tools::VertexParameters(aCP, theParamOnE1, theParamOnE2);
} else {
else
IntTools_Tools::VertexParameters(aCP, theParamOnE2, theParamOnE1);
}
//
bvertexfound = Standard_True;
break;
@@ -2004,147 +2220,182 @@ static Standard_Real ComputeAveragePlaneAndMaxDeviation(const TopoDS_Shape& aWir
return MaxDeviation;
}
//=======================================================================
//function : ChooseSection
//purpose :
//=======================================================================
static Standard_Boolean ChooseSection(const TopoDS_Shape& Comp,
const gp_Ax2& bis,
TopoDS_Shape& resWire,
gp_Pln& resPlane,
Standard_Boolean& IsSingular)
static void UpdateSectionEdge(TopoDS_Edge& theEdge,
const TopoDS_Vertex& theConstVertex,
TopoDS_Vertex& theVertex,
const Standard_Real theParam)
{
IsSingular = Standard_False;
Standard_Real TolDeviation = 0.01; //, TolConf = 1.e-4, TolAng = 1.e-5;
TopoDS_Edge F_Edge = theEdge;
F_Edge.Orientation(TopAbs_FORWARD);
// Standard_Integer N = 100;
Standard_Integer ind, i, j;
TopAbs_Orientation OrOfVertex;
TopoDS_Vertex V1, V2, AnotherVertex;
TopExp::Vertices(F_Edge, V1, V2);
if (theConstVertex.IsSame(V1))
{
//OrOfConst = TopAbs_FORWARD;
OrOfVertex = TopAbs_REVERSED;
AnotherVertex = V2;
}
else
{
//OrOfConst = TopAbs_REVERSED;
OrOfVertex = TopAbs_FORWARD;
AnotherVertex = V1;
}
//Simplest case
TopoDS_Compound OldComp;
BRep_Builder B;
B.MakeCompound( OldComp );
TopoDS_Iterator iter( Comp );
for (; iter.More(); iter.Next())
B.Add( OldComp, iter.Value() );
BRep_Builder BB;
Standard_Real fpar, lpar;
BRep_Tool::Range(F_Edge, fpar, lpar);
if (OrOfVertex == TopAbs_FORWARD)
fpar = theParam;
else
lpar = theParam;
BB.Range(F_Edge, fpar, lpar);
Standard_Boolean anError = Standard_False;
//TopoDS_Wire NewWire [2];
TopTools_SequenceOfShape Wseq;
for (;;)
{
TopExp_Explorer explo( OldComp, TopAbs_EDGE );
if (!explo.More())
break;
TopoDS_Edge FirstEdge = TopoDS::Edge( explo.Current() );
TopoDS_Wire NewWire = BRepLib_MakeWire( FirstEdge );
B.Remove( OldComp, FirstEdge );
if (NewWire.Closed())
{
Wseq.Append(NewWire);
continue;
}
for (;;)
{
TopoDS_Vertex Extremity [2];
TopExp::Vertices( NewWire, Extremity[0], Extremity[1] );
if (Extremity[0].IsNull() || Extremity[1].IsNull())
{
anError = Standard_True;
break;
}
TopTools_IndexedDataMapOfShapeListOfShape VEmap;
TopExp::MapShapesAndAncestors( OldComp, TopAbs_VERTEX, TopAbs_EDGE, VEmap );
TopTools_ListOfShape Vedges [2];
for (j = 0; j < 2; j++)
if (VEmap.Contains( Extremity[j] ))
Vedges[j] = VEmap.FindFromKey( Extremity[j] );
if (Vedges[0].IsEmpty() && Vedges[1].IsEmpty())
//no more edges in OldComp to continue NewWire
break;
Standard_Boolean Modified = Standard_False;
for (j = 0; j < 2; j++)
{
if (Vedges[j].Extent() == 1)
{
const TopoDS_Edge& anEdge = TopoDS::Edge( Vedges[j].First() );
NewWire = BRepLib_MakeWire( NewWire, anEdge );
B.Remove( OldComp, anEdge );
Modified = Standard_True;
}
}
if (!Modified) //only multiple connections
{
ind = (Vedges[0].IsEmpty())? 1 : 0;
TopTools_SequenceOfShape Edges;
TopTools_ListIteratorOfListOfShape itl( Vedges[ind] );
for (; itl.More(); itl.Next())
Edges.Append( itl.Value() );
Standard_Integer theind=0;
Standard_Real MinDeviation = RealLast();
for (j = 1; j <= Edges.Length(); j++)
{
TopoDS_Wire aWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(j)) );
gp_Pln aPlane;
Standard_Boolean issing;
Standard_Real Deviation = ComputeAveragePlaneAndMaxDeviation( aWire, aPlane, issing );
if (Deviation < MinDeviation)
{
MinDeviation = Deviation;
theind = j;
}
}
NewWire = BRepLib_MakeWire( NewWire, TopoDS::Edge(Edges(theind)) );
B.Remove( OldComp, Edges(theind) );
}
if (NewWire.Closed())
break;
}
Wseq.Append(NewWire);
if (anError)
break;
}
Standard_Real Deviation=0.;
Standard_Real MinAngle = RealLast();
TopExp_Explorer Explo( OldComp, TopAbs_EDGE );
if (!anError && !Explo.More())
{
if (Wseq.Length() == 1)
{
resWire = Wseq.First();
Deviation = ComputeAveragePlaneAndMaxDeviation( resWire, resPlane, IsSingular );
return Standard_True;
}
else
{
for (i = 1; i <= Wseq.Length(); i++)
{
TopoDS_Wire aWire = TopoDS::Wire( Wseq(i) );
gp_Pln aPln;
Standard_Boolean issing;
Standard_Real aDeviation =
ComputeAveragePlaneAndMaxDeviation( aWire, aPln, issing );
if (issing)
continue;
Standard_Real Angle = aPln.Axis().Angle( bis.Axis() );
if (Angle > M_PI/2)
Angle = M_PI - Angle;
if (Angle < MinAngle)
{
MinAngle = Angle;
resWire = aWire;
resPlane = aPln;
Deviation = aDeviation;
}
}
if (Deviation <= TolDeviation)
return Standard_True;
}
}
return Standard_False;
//end of simplest case
F_Edge.Free(Standard_True);
BB.Remove(F_Edge, AnotherVertex);
theVertex.Orientation(OrOfVertex);
BB.Add(F_Edge, theVertex);
}
//Finds the edge connected to <theVertex> in the compound <theComp>
//that is closest to bisector plane angularly.
//Removes found edge from <theComp>
//<theAxis> is the axis of bisector plane
static TopoDS_Edge FindEdgeCloseToBisectorPlane(const TopoDS_Vertex& theVertex,
TopoDS_Compound& theComp,
const gp_Ax1& theAxis)
{
TopTools_IndexedDataMapOfShapeListOfShape VEmap;
TopExp::MapShapesAndAncestors( theComp, TopAbs_VERTEX, TopAbs_EDGE, VEmap );
TopoDS_Edge MinEdge;
if (!VEmap.Contains(theVertex))
return MinEdge;
BRep_Builder BB;
const TopTools_ListOfShape& Edges = VEmap.FindFromKey(theVertex);
if (Edges.Extent() == 1)
MinEdge = TopoDS::Edge(Edges.First());
else
{
TopTools_ListIteratorOfListOfShape itl(Edges);
Standard_Real MinAngle = RealLast();
for (; itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
TopoDS_Wire aWire;
BB.MakeWire(aWire);
BB.Add(aWire, anEdge);
gp_Pln aPln;
Standard_Boolean issing;
ComputeAveragePlaneAndMaxDeviation( aWire, aPln, issing );
Standard_Real anAngle;
if (issing) //edge is a segment of line
{
//<anAngle> is angle between <anEdge> and its projection on bisector plane
BRepAdaptor_Curve BAcurve(anEdge);
gp_Pnt FirstPnt = BAcurve.Value(BAcurve.FirstParameter());
gp_Pnt LastPnt = BAcurve.Value(BAcurve.LastParameter());
gp_Vec EdgeVec(FirstPnt, LastPnt);
gp_Ax1 EdgeAxis(FirstPnt, EdgeVec);
anAngle = EdgeAxis.Direction().Angle(theAxis.Direction());
if (anAngle > M_PI/2)
anAngle = M_PI - anAngle;
anAngle = M_PI/2 - anAngle;
}
else
{
anAngle = aPln.Axis().Angle( theAxis );
if (anAngle > M_PI/2)
anAngle = M_PI - anAngle;
}
if (anAngle < MinAngle)
{
MinAngle = anAngle;
MinEdge = anEdge;
}
}
} //else (more than one edge)
BB.Remove(theComp, MinEdge);
return MinEdge;
}
static Standard_Boolean FindMiddleEdges(const TopoDS_Vertex& theVertex1,
const TopoDS_Vertex& theVertex2,
const gp_Ax1& theAxis,
TopoDS_Compound& theComp,
TopTools_ListOfShape& theElist)
{
TopTools_IndexedDataMapOfShapeListOfShape VEmap;
TopExp::MapShapesAndAncestors( theComp, TopAbs_VERTEX, TopAbs_EDGE, VEmap );
if (VEmap.IsEmpty())
return Standard_False;
if (!VEmap.Contains(theVertex1) ||
!VEmap.Contains(theVertex2))
return Standard_False;
TopoDS_Vertex CurVertex = theVertex1;
for (;;)
{
TopoDS_Edge CurEdge;
CurEdge = FindEdgeCloseToBisectorPlane(CurVertex, theComp, theAxis);
if (CurEdge.IsNull())
return Standard_False;
TopoDS_Vertex V1, V2;
TopExp::Vertices(CurEdge, V1, V2);
CurVertex = (V1.IsSame(CurVertex))? V2 : V1;
theElist.Append(CurEdge);
if (CurVertex.IsSame(theVertex2))
return Standard_True;
}
}
static Standard_Boolean FindCommonVertex(const TopoDS_Edge& theFirstEdge,
const TopoDS_Edge& theLastEdge,
const TopoDS_Vertex& theFirstVertex,
const TopoDS_Vertex& theLastVertex,
TopoDS_Vertex& theCommonVertex)
{
if (!theFirstVertex.IsSame(theLastVertex))
{
Standard_Boolean CommonVertexExists = TopExp::CommonVertex(theFirstEdge,
theLastEdge,
theCommonVertex);
return CommonVertexExists;
}
TopoDS_Vertex V1, V2, V3, V4;
TopExp::Vertices(theFirstEdge, V1, V2);
TopExp::Vertices(theLastEdge, V3, V4);
if (V1.IsSame(theFirstVertex))
{
if (V2.IsSame(V3) ||
V2.IsSame(V4))
{
theCommonVertex = V2;
return Standard_True;
}
}
else
{
if (V1.IsSame(V3) ||
V1.IsSame(V4))
{
theCommonVertex = V1;
return Standard_True;
}
}
return Standard_False;
}

View File

@@ -20,6 +20,7 @@
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <BRepFill_TransitionStyle.hxx>
#include <gp_Ax2.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
@@ -28,13 +29,14 @@
#include <Standard_Boolean.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BOPDS_PDS.hxx>
class gp_Ax2;
class TopoDS_Face;
class TopoDS_Wire;
class TopoDS_Shape;
//! Trims sets of faces in the corner to make proper parts of pipe
class BRepFill_TrimShellCorner
{
public:
@@ -42,11 +44,12 @@ public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces, const gp_Ax2& theAxeOfBisPlane, const TopoDS_Face& theSecPlane);
Standard_EXPORT BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces, const gp_Ax2& theAxeOfBisPlane, const TopoDS_Wire& theSpine, const TopoDS_Face& theSecPlane);
Standard_EXPORT void SetSpine (const TopoDS_Wire& theSpine);
//! Constructor: takes faces to intersect,
//! type of transition (it can be RightCorner or RoundCorner)
//! and axis of bisector plane
Standard_EXPORT BRepFill_TrimShellCorner(const Handle(TopTools_HArray2OfShape)& theFaces,
const BRepFill_TransitionStyle theTransition,
const gp_Ax2& theAxeOfBisPlane);
Standard_EXPORT void AddBounds (const Handle(TopTools_HArray2OfShape)& Bounds);
@@ -71,13 +74,29 @@ protected:
private:
Standard_Boolean MakeFacesSec(const Standard_Integer theIndex,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2,
const Standard_Integer theSSInterfIndex);
Standard_Boolean MakeFacesNonSec(const Standard_Integer theIndex,
const BOPDS_PDS& theDS,
const Standard_Integer theFaceIndex1,
const Standard_Integer theFaceIndex2);
Standard_Boolean ChooseSection(const TopoDS_Shape& Comp,
const TopoDS_Vertex& theFirstVertex,
const TopoDS_Vertex& theLastVertex,
TopoDS_Shape& resWire,
gp_Pln& resPlane,
Standard_Boolean& IsSingular);
BRepFill_TransitionStyle myTransition;
gp_Ax2 myAxeOfBisPlane;
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
TopoDS_Wire mySpine;
TopoDS_Face mySecPln;
Handle(TopTools_HArray2OfShape) myBounds;
Handle(TopTools_HArray2OfShape) myUEdges;
Handle(TopTools_HArray2OfShape) myFaces;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,106 @@
// Created on: 2018-03-14
// Created by: Nikolai BUKHALOV
// Copyright (c) 1999-2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepFill_Voluved_HeaderFile
#define _BRepFill_Voluved_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Wire.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
class BOPAlgo_MakerVolume;
//! Constructs an evolved volume from a spine (wire or face)
//! and a profile ( wire).
class BRepFill_Voluved
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT BRepFill_Voluved() :myErrorStatus(BRepFill_Voluved_Empty),
myFuzzyValue(0.0)
{
}
Standard_EXPORT void Perform(const TopoDS_Wire& theSpine, const TopoDS_Wire& theProfile, const Standard_Real theTolerance, const Standard_Boolean theSolidReq = Standard_True);
Standard_Boolean IsDone(unsigned int* theErrorCode = 0) const
{
if (theErrorCode)
*theErrorCode = myErrorStatus;
return (myErrorStatus == BRepFill_Voluved_OK);
}
//! returns the resulting shape.
const TopoDS_Shape& Shape() const
{
return myResult;
}
protected:
Standard_EXPORT void PerformSweep();
Standard_EXPORT void GetLids();
Standard_EXPORT void BuildSolid();
Standard_EXPORT void RemoveExcessSolids(const TopTools_ListOfShape& theLSplits,
TopoDS_Shape& theShape,
TopTools_ListOfShape& theArgsList,
BOPAlgo_MakerVolume& theMV);
Standard_EXPORT void ExtractOuterSolid(TopoDS_Shape& theShape,
TopTools_ListOfShape& theArgsList);
Standard_EXPORT void GetSpineAndProfile(const TopoDS_Wire& theSpine,
const TopoDS_Wire& theProfile);
private:
enum
{
BRepFill_Voluved_Empty = 0,
BRepFill_Voluved_NotPlanarSpine,
BRepFill_Voluved_SweepError,
BRepFill_Voluved_NoLids,
BRepFill_Voluved_NotSolid,
BRepFill_Voluved_NotVolume,
BRepFill_Voluved_OK = UINT_MAX
} myErrorStatus;
TopoDS_Wire mySpine;
TopoDS_Wire myProfile;
TopoDS_Shape myPipeShell;
TopoDS_Compound myTopBottom; // Lids can be split on several faces
TopoDS_Shape myResult;
Standard_Real myFuzzyValue;
};
#endif // _BRepFill_Voluved_HeaderFile

View File

@@ -83,3 +83,5 @@ BRepFill_TrimShellCorner.hxx
BRepFill_TrimSurfaceTool.cxx
BRepFill_TrimSurfaceTool.hxx
BRepFill_TypeOfContact.hxx
BRepFill_Voluved.cxx
BRepFill_Voluved.hxx

View File

@@ -22,6 +22,8 @@
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : BRepOffsetAPI_MakeEvolved
@@ -43,19 +45,29 @@ BRepOffsetAPI_MakeEvolved::BRepOffsetAPI_MakeEvolved(const TopoDS_Wire& Spin
const Standard_Boolean AxeProf,
const Standard_Boolean Solid,
const Standard_Boolean ProfOnSpine,
const Standard_Real Tol)
const Standard_Boolean theIsVolume,
const Standard_Real Tol)
{
gp_Ax3 Axis(gp_Pnt(0.,0.,0.),
gp_Dir(0.,0.,1.),
gp_Dir(1.,0.,0.));
if (theIsVolume)
{
myVolume.Perform(Spine, Profil, Tol);
}
else
{
gp_Ax3 Axis(gp_Pnt(0., 0., 0.),
gp_Dir(0., 0., 1.),
gp_Dir(1., 0., 0.));
if ( !AxeProf) {
Standard_Boolean POS;
BRepFill::Axe(Spine,Profil,Axis,POS,Tol);
if (ProfOnSpine && !POS) return;
if (!AxeProf)
{
Standard_Boolean POS;
BRepFill::Axe(Spine, Profil, Axis, POS, Max(Tol, Precision::Confusion()));
if (ProfOnSpine && !POS) return;
}
myEvolved.Perform(Spine, Profil, Axis, Join, Solid);
}
myEvolved.Perform(Spine,Profil,Axis,Join,Solid);
Build();
Done();
}
@@ -72,20 +84,31 @@ BRepOffsetAPI_MakeEvolved::BRepOffsetAPI_MakeEvolved(const TopoDS_Face& Spin
const Standard_Boolean AxeProf,
const Standard_Boolean Solid,
const Standard_Boolean ProfOnSpine,
const Standard_Real Tol)
const Standard_Boolean theIsVolume,
const Standard_Real Tol)
{
gp_Ax3 Axis(gp_Pnt(0.,0.,0.),
gp_Dir(0.,0.,1.),
gp_Dir(1.,0.,0.));
if (theIsVolume)
{
myVolume.Perform(TopoDS::Wire(TopoDS_Iterator(Spine).Value()), Profil, Tol);
}
else
{
gp_Ax3 Axis(gp_Pnt(0., 0., 0.),
gp_Dir(0., 0., 1.),
gp_Dir(1., 0., 0.));
if ( !AxeProf) {
Standard_Boolean POS;
BRepFill::Axe(Spine,Profil,Axis,POS,Tol);
if (ProfOnSpine && !POS) return;
if (!AxeProf)
{
Standard_Boolean POS;
BRepFill::Axe(Spine, Profil, Axis, POS, Max(Tol, Precision::Confusion()));
if (ProfOnSpine && !POS) return;
}
myEvolved.Perform(Spine, Profil, Axis, Join, Solid);
}
myEvolved.Perform(Spine,Profil,Axis,Join,Solid);
Build();
Done();
}
@@ -107,8 +130,16 @@ const BRepFill_Evolved& BRepOffsetAPI_MakeEvolved::Evolved() const
void BRepOffsetAPI_MakeEvolved::Build()
{
myShape = myEvolved.Shape();
if (myEvolved.IsDone()) Done();
if (myEvolved.IsDone())
{
myShape = myEvolved.Shape();
}
else if (myVolume.IsDone())
{
myShape = myVolume.Shape();
}
Done();
}

View File

@@ -22,6 +22,7 @@
#include <Standard_Handle.hxx>
#include <BRepFill_Evolved.hxx>
#include <BRepFill_Voluved.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
#include <GeomAbs_JoinType.hxx>
#include <Standard_Boolean.hxx>
@@ -66,7 +67,7 @@ public:
Standard_EXPORT BRepOffsetAPI_MakeEvolved();
Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Wire& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean AxeProf = Standard_True, const Standard_Boolean Solid = Standard_False, const Standard_Boolean ProfOnSpine = Standard_False, const Standard_Real Tol = 0.0000001);
Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Wire& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join/* = GeomAbs_Arc*/, const Standard_Boolean AxeProf/* = Standard_True*/, const Standard_Boolean Solid/* = Standard_False*/, const Standard_Boolean ProfOnSpine/* = Standard_False*/, const Standard_Boolean theIsVolume, const Standard_Real Tol/* = Precision::Confusion()*/);
//! These constructors construct an evolved shape by sweeping the profile
//! Profile along the spine Spine.
@@ -88,7 +89,7 @@ public:
//! axis passing along the vertex and the normal to the
//! plane of the spine. At present, this is the only
//! construction type implemented.
Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Face& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean AxeProf = Standard_True, const Standard_Boolean Solid = Standard_False, const Standard_Boolean ProfOnSpine = Standard_False, const Standard_Real Tol = 0.0000001);
Standard_EXPORT BRepOffsetAPI_MakeEvolved(const TopoDS_Face& Spine, const TopoDS_Wire& Profil, const GeomAbs_JoinType Join/* = GeomAbs_Arc*/, const Standard_Boolean AxeProf/* = Standard_True*/, const Standard_Boolean Solid/* = Standard_False*/, const Standard_Boolean ProfOnSpine/* = Standard_False*/, const Standard_Boolean theIsVolume, const Standard_Real Tol/* = Precision::Confusion()*/);
Standard_EXPORT const BRepFill_Evolved& Evolved() const;
@@ -118,9 +119,8 @@ protected:
private:
BRepFill_Evolved myEvolved;
BRepFill_Voluved myVolume;
};

View File

@@ -33,8 +33,6 @@
//purpose :
//=======================================================================
BRepOffsetAPI_MakePipeShell::BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine)
{
myPipe = new (BRepFill_PipeShell) (Spine);
SetTolerance();

View File

@@ -211,7 +211,7 @@ public:
//! discontinuities are treated like round
//! corner. The corner is treated as rotation
//! of the profile around an axis which
//! passes through the point of the spine?s
//! passes through the point of the spine's
//! fracture. This axis is based on cross
//! product of directions tangent to the
//! adjacent segments of the spine at their common point.
@@ -276,7 +276,6 @@ private:
Handle(BRepFill_PipeShell) myPipe;
};

View File

@@ -237,33 +237,84 @@ Standard_Integer evolved(Draw_Interpretor& di, Standard_Integer n, const char**
if ( n < 4 ) return 1;
Standard_Boolean IsAFace = Standard_False;
Standard_Boolean Solid = (!strcmp(a[0],"evolvedsolid"));
Standard_Boolean Solid = Standard_False;
Standard_Boolean isVolume = Standard_False;
Standard_Boolean hasToComputeAxes = Standard_False;
Standard_Real aTolerance = 0.0;
TopoDS_Shape Base;
TopoDS_Wire Prof;
for (Standard_Integer i = 2; i < n; i++)
{
if (a[i][0] != '-')
{
di << "Error: wrong option!\n";
return 1;
}
if (!Solid && !strcmp(a[i], "-solid"))
{
Solid = Standard_True;
continue;
}
TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_WIRE,Standard_False);
if ( Base.IsNull()) {
Base = DBRep::Get(a[2],TopAbs_FACE,Standard_False);
IsAFace = Standard_True;
switch (a[i][1])
{
case 's':
{
Base = DBRep::Get(a[++i], TopAbs_WIRE, Standard_False);
if (Base.IsNull())
{
Base = DBRep::Get(a[i], TopAbs_FACE, Standard_False);
IsAFace = Standard_True;
}
}
break;
case 'p':
{
Prof = TopoDS::Wire(DBRep::Get(a[++i], TopAbs_WIRE, Standard_False));
}
break;
case 'v':
{
isVolume = Standard_True;
}
break;
case 'a':
{
hasToComputeAxes = Standard_True;
}
break;
case 't':
{
aTolerance = Draw::Atof(a[++i]);
}
break;
default:
di << "Error: Unknown option!\n";
break;
}
}
if ( Base.IsNull()) return 1;
TopoDS_Shape InpuTShape(DBRep::Get(a[3],TopAbs_WIRE,Standard_False));
TopoDS_Wire Prof = TopoDS::Wire(InpuTShape);
// TopoDS_Wire Prof =
// TopoDS::Wire(DBRep::Get(a[3],TopAbs_WIRE,Standard_False));
if ( Prof.IsNull()) return 1;
if (Base.IsNull() || Prof.IsNull())
{
di << "Error: Null-shapes are not allowed\n";
return 1;
}
if (IsAFace) {
TopoDS_Shape Volevo
= BRepOffsetAPI_MakeEvolved(TopoDS::Face(Base),Prof,GeomAbs_Arc,n == 4,Solid);
DBRep::Set(a[1],Volevo);
}
else {
TopoDS_Shape Volevo
= BRepOffsetAPI_MakeEvolved(TopoDS::Wire(Base),Prof,GeomAbs_Arc,n == 4,Solid);
DBRep::Set(a[1],Volevo);
}
TopoDS_Shape Volevo = IsAFace ? BRepOffsetAPI_MakeEvolved(TopoDS::Face(Base),
Prof, GeomAbs_Arc, !hasToComputeAxes,
Solid, Standard_False, isVolume, aTolerance) :
BRepOffsetAPI_MakeEvolved(TopoDS::Wire(Base),
Prof, GeomAbs_Arc, !hasToComputeAxes,
Solid, Standard_False, isVolume, aTolerance);
DBRep::Set(a[1],Volevo);
return 0;
}
@@ -785,7 +836,11 @@ static Standard_Integer buildsweep(Draw_Interpretor& di,
Sweep->SetTransitionMode(Transition);
}
// Reading solid ?
if ((n>cur) && (!strcmp(a[cur],"-S")) ) mksolid = Standard_True;
if ((n > cur) && (!strcmp(a[cur], "-S")))
{
mksolid = Standard_True;
++cur;
}
// Calcul le resultat
Sweep->Build();
@@ -979,10 +1034,6 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
"evolved , no args to get help",
__FILE__,evolved,g);
theCommands.Add("evolvedsolid",
"evolved , no args to get help",
__FILE__,evolved,g);
theCommands.Add("pruled",
"pruled result Edge1/Wire1 Edge2/Wire2",
__FILE__,pruled,g);

View File

@@ -687,7 +687,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
}
//
Standard_Boolean Arrive, DejaReparti;
const Standard_Integer RejectIndexMAX = 250000;
const Standard_Integer RejectIndexMAX = 25000;
Standard_Integer IncKey, RejectIndex;
gp_Pnt pf,pl;
//
@@ -736,6 +736,12 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
Arrive = Standard_False;
while(!Arrive) //010
{
if (line->NbPoints() >= RejectIndexMAX)
{
Arrive = Standard_True;
break;
}
aPrevStatus = aStatus;
LevelOfIterWithoutAppend++;
@@ -745,7 +751,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
if(DejaReparti) {
break;
}
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
LevelOfIterWithoutAppend = 0;
}
//
@@ -872,7 +878,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
Param(2)=SvParam[1];
Param(3)=SvParam[2];
Param(4)=SvParam[3];
RepartirOuDiviser(DejaReparti, ChoixIso, Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
}
else //009
{
@@ -903,7 +909,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
Arrive=Standard_True;
}
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
LevelOfEmptyInmyIntersectionOn2S++;
//
if(LevelOfEmptyInmyIntersectionOn2S>10)
@@ -1036,7 +1042,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
case IntWalk_ArretSurPointPrecedent:
{
Arrive = Standard_False;
RepartirOuDiviser(DejaReparti, ChoixIso, Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
break;
}
case IntWalk_PasTropGrand:
@@ -1046,7 +1052,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
Param(3)=SvParam[2];
Param(4)=SvParam[3];
if(LevelOfIterWithoutAppend > 5)
if ((LevelOfIterWithoutAppend > 5) && (aPrevStatus != IntWalk_StepTooSmall))
{
for (Standard_Integer i = 0; i < 4; i++)
{
@@ -1240,7 +1246,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
if (aStatus == IntWalk_ArretSurPoint)
{
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
}
else
{
@@ -1321,13 +1327,13 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
//
LevelOfIterWithoutAppend=0;
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
}
else
{
//fail framing divides the step
Arrive = Standard_False;
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
NoTestDeflection = Standard_True;
ChoixIso = SauvChoixIso;
}
@@ -1582,7 +1588,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
}
}
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
if(Arrive &&
myIntersectionOn2S.IsDone() && !myIntersectionOn2S.IsEmpty() &&
@@ -1603,7 +1609,7 @@ void IntWalk_PWalking::Perform(const TColStd_Array1OfReal& ParDep,
//echec framing on border; division of step
Arrive = Standard_False;
NoTestDeflection = Standard_True;
RepartirOuDiviser(DejaReparti,ChoixIso,Arrive);
RepartirOuDiviser(aStatus, DejaReparti, ChoixIso, Arrive);
}
}//$$$ end framing on border (!close)
}//004 fin TestArret return Arrive = True
@@ -2769,16 +2775,17 @@ SeekAdditionalPoints( const Handle(Adaptor3d_HSurface)& theASurf1,
return isPrecise;
}
void IntWalk_PWalking::
RepartirOuDiviser(Standard_Boolean& DejaReparti,
IntImp_ConstIsoparametric& ChoixIso,
Standard_Boolean& Arrive)
// at the neighborhood of a point, there is a fail of marching
// it is required to divide the steps to try to continue
// if the step is too small if we are on border
// restart in another direction if it was not done, otherwise stop
//=======================================================================
//function : RepartirOuDiviser
//purpose : at the neighborhood of a point, there is a fail of marching
// it is required to divide the steps to try to continue
// if the step is too small if we are on border
// restart in another direction if it was not done, otherwise stop
//=======================================================================
void IntWalk_PWalking::RepartirOuDiviser(const IntWalk_StatusDeflection& theCurrentStatus,
Standard_Boolean& DejaReparti,
IntImp_ConstIsoparametric& ChoixIso,
Standard_Boolean& Arrive)
{
// Standard_Integer i;
if (Arrive) { //restart in the other direction
@@ -2821,11 +2828,12 @@ RepartirOuDiviser(Standard_Boolean& DejaReparti,
}
}
else {
if ( pasuv[0]*0.5 < ResoU1
&& pasuv[1]*0.5 < ResoV1
&& pasuv[2]*0.5 < ResoU2
&& pasuv[3]*0.5 < ResoV2
) {
if ((theCurrentStatus == IntWalk_StepTooSmall) ||
(pasuv[0] * 0.5 < ResoU1
&& pasuv[1] * 0.5 < ResoV1
&& pasuv[2] * 0.5 < ResoU2
&& pasuv[3] * 0.5 < ResoV2))
{
if (!previoustg) {
tglast = Standard_True; // IS IT ENOUGH ????
}

View File

@@ -130,7 +130,10 @@ public:
Standard_EXPORT Standard_Boolean TestArret (const Standard_Boolean DejaReparti, TColStd_Array1OfReal& Param, IntImp_ConstIsoparametric& ChoixIso);
Standard_EXPORT void RepartirOuDiviser (Standard_Boolean& DejaReparti, IntImp_ConstIsoparametric& ChoixIso, Standard_Boolean& Arrive);
Standard_EXPORT void RepartirOuDiviser(const IntWalk_StatusDeflection& theCurrentStatus,
Standard_Boolean& DejaReparti,
IntImp_ConstIsoparametric& ChoixIso,
Standard_Boolean& Arrive);
void AddAPoint (Handle(IntSurf_LineOn2S)& line, const IntSurf_PntOn2S& POn2S);

View File

@@ -117,7 +117,7 @@ LocOpe_DPrism::LocOpe_DPrism(const TopoDS_Face& Spine,
myProfile = BRepLib_MakeWire(myProfile1,myProfile2,myProfile3);
myDPrism.Perform(mySpine,myProfile,gp::XOY());
myDPrism.Perform(mySpine,myProfile,gp::XOY(), GeomAbs_Arc, Standard_False);
if (myDPrism.IsDone()) {
@@ -370,7 +370,7 @@ LocOpe_DPrism::LocOpe_DPrism(const TopoDS_Face& Spine,
myProfile1 = BRepLib_MakeEdge(Vert4, Vert1);
myProfile = BRepLib_MakeWire(myProfile1,myProfile2,myProfile3);
myDPrism.Perform(mySpine,myProfile,gp::XOY());
myDPrism.Perform(mySpine,myProfile,gp::XOY(), GeomAbs_Arc, Standard_False);
if (myDPrism.IsDone()) {

View File

@@ -142,7 +142,8 @@ public:
PAppend(pNew, theIter);
}
//! Append another list at the end
//! Append another list at the end.
//! After this operation, theOther list will be cleared.
void Append (NCollection_List& theOther)
{
if (this == &theOther || theOther.Extent()<1)

View File

@@ -2531,6 +2531,136 @@ static Standard_Integer OCC28131 (Draw_Interpretor&, Standard_Integer theNbArgs,
return 0;
}
#include <BRepOffsetAPI_MakeEvolved.hxx>
#include <ShapeFix_Wireframe.hxx>
static Standard_Integer myCall(Draw_Interpretor&, Standard_Integer theNbArgs, const char** theArgVec)
{
TopoDS_Wire extrudeWire = TopoDS::Wire(DBRep::Get(theArgVec[2]));
TopoDS_Wire toolWire = TopoDS::Wire(DBRep::Get(theArgVec[3]));
// ################################ Check and Fix Wire Gaps #########################################
if (1)
{
ShapeFix_Wireframe fix_tool(extrudeWire);
fix_tool.ModeDropSmallEdges() = Standard_True;
fix_tool.SetPrecision(Precision::Confusion()); //yes!
fix_tool.FixSmallEdges();
fix_tool.FixWireGaps();
extrudeWire = TopoDS::Wire(fix_tool.Shape());
}
// ################################ Extrude tool #########################################
BRepOffsetAPI_MakeEvolved mkEvolved = BRepOffsetAPI_MakeEvolved(extrudeWire, toolWire, GeomAbs_Arc, Standard_False, Standard_True, Standard_False, Standard_True, 0);
DBRep::Set(theArgVec[1], mkEvolved.Shape());
return 0;
}
//=======================================================================
//function : FindGaps
//purpose :
//=======================================================================
static Standard_Integer FindGaps(Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgV)
{
if (theNArg < 3)
{
theDI << "Use: " << theArgV[0] << " result wire\n";
return 1;
}
const TopoDS_Wire aWir = TopoDS::Wire(DBRep::Get(theArgV[2]));
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
TopExp::MapShapesAndAncestors(aWir, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
Standard_Real aMaxDist = RealFirst();
for (Standard_Integer i = 1; i <= aMapVE.Extent(); i++)
{
const TopoDS_Vertex &aV = TopoDS::Vertex(aMapVE.FindKey(i));
TopTools_ListOfShape aLE = aMapVE.FindFromIndex(i);
const TopoDS_Edge anE1 = TopoDS::Edge(aLE.First());
const TopoDS_Edge anE2 = TopoDS::Edge(aLE.Last());
const BRepAdaptor_Curve anAC1(anE1), anAC2(anE2);
const Standard_Real aPrm1 = BRep_Tool::Parameter(aV, anE1);
const Standard_Real aPrm2 = BRep_Tool::Parameter(aV, anE2);
gp_Pnt aP1, aP2;
anAC1.D0(aPrm1, aP1);
anAC2.D0(aPrm2, aP2);
char aBuff[100];
Sprintf(aBuff, "%sv%d", theArgV[1], i);
DBRep::Set(aBuff, aV);
const Standard_Real aDist = aP1.Distance(aP2);
aMaxDist = Max(aMaxDist, aDist);
theDI << aBuff << ": Dist = " << aDist << "\n";
}
theDI << "Max. gap is " << aMaxDist << "\n";
return 0;
}
//=======================================================================
//function : VEProcess
//purpose :
//=======================================================================
static Standard_Integer VEProcess(Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgV)
{
if (theNArg < 3)
{
theDI << "Use: " << theArgV[0] << " result wire\n";
return 1;
}
const TopoDS_Wire aWir = TopoDS::Wire(DBRep::Get(theArgV[2]));
TopTools_IndexedDataMapOfShapeListOfShape aMapVE;
TopExp::MapShapesAndAncestors(aWir, TopAbs_VERTEX, TopAbs_EDGE, aMapVE);
for (Standard_Integer i = 1; i <= aMapVE.Extent(); i++)
{
const TopoDS_Vertex &aV = TopoDS::Vertex(aMapVE.FindKey(i));
TopTools_ListOfShape aLE = aMapVE.FindFromIndex(i);
const TopoDS_Edge anE1 = TopoDS::Edge(aLE.First());
const TopoDS_Edge anE2 = TopoDS::Edge(aLE.Last());
const BRepAdaptor_Curve anAC1(anE1), anAC2(anE2);
const Standard_Real aPrm1 = BRep_Tool::Parameter(aV, anE1);
const Standard_Real aPrm2 = BRep_Tool::Parameter(aV, anE2);
gp_Pnt aP;
gp_Vec aT1, aT2;
anAC1.D1(aPrm1, aP, aT1);
anAC2.D1(aPrm2, aP, aT2);
Standard_Real anAngle = aT1.Angle(aT2);
if (anAngle > M_PI_2)
anAngle = M_PI - anAngle;
char aBuff[100];
Sprintf(aBuff, "%sv%d", theArgV[1], i);
DBRep::Set(aBuff, aV);
theDI << aBuff << " (" << BRep_Tool::Tolerance(aV) << "): A = " << anAngle << "\n";
}
return 0;
}
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
@@ -2560,5 +2690,10 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
__FILE__, OCC28887, group);
theCommands.Add("OCC28131", "OCC28131 name: creates face problematic for offset", __FILE__, OCC28131, group);
theCommands.Add("myCall", "myCall result spine profile", __FILE__, myCall, group);
theCommands.Add("findgaps", "findgaps result wire", __FILE__, FindGaps, group);
theCommands.Add("veproc", "veproc result wire", __FILE__, VEProcess, group);
return;
}

View File

@@ -165,15 +165,19 @@ void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F,
Standard_Real aMult = RealLast();
for(Standard_Integer anIdx = 1; anIdx <= myLeft.Upper(); anIdx++)
{
const Standard_Real anAbsStep = Abs(TheStep(anIdx));
if (anAbsStep < gp::Resolution())
continue;
if (suivant->Value(anIdx) < myLeft(anIdx))
{
Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / Abs(TheStep(anIdx));
Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / anAbsStep;
aMult = Min (aValue, aMult);
}
if (suivant->Value(anIdx) > myRight(anIdx))
{
Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / Abs(TheStep(anIdx));
Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / anAbsStep;
aMult = Min (aValue, aMult);
}
}

View File

@@ -8,6 +8,8 @@ puts ""
# (case 11)
######################################################
puts "TODO 29663 ALL: Faulty shapes in variables faulty_1 to faulty_4"
restore [locate_data_file OCC1477-1.brep] s1
restore [locate_data_file OCC1477-2.brep] s2

View File

@@ -8,7 +8,7 @@ checkshape b
restore [locate_data_file pro19424b.brep] p
checkshape p
if [catch {evolved result b p o } catch_result] {
if [catch {evolved result -s b -p p -a } catch_result] {
puts "Faulty PRO19424 : function EVOLVED works wrongly"
} else {
puts "PRO19424 OK: function EVOLVED works properly"

View File

@@ -8,4 +8,4 @@ puts ""
restore [locate_data_file OCC26470-ClosedWire.brep] a
restore [locate_data_file OCC26470-wprof1.brep] b
evolved res a b o
evolved res -s a -p b -a

View File

@@ -8,5 +8,5 @@ puts ""
restore [locate_data_file OCC26470-ClosedWire.brep] a
restore [locate_data_file OCC26470-wprof2.brep] b
evolved res a b o
evolved res -s a -p b -a
checkshape res

View File

@@ -13,7 +13,8 @@ explode Box E
blend Fillet Box 1 Box_1 1 Box_2 1 Box_3 1 Box_4 1 Box_5 1 Box_6 1 Box_7 1 Box_8 1 Box_9 1 Box_10 1 Box_11 1 Box_12
if { [regexp "There were errors during the operation, so the list may be incomplete" [bopcheck Fillet]] == 1 } {
set bug_info [string trim [bopcheck Fillet]]
if {$bug_info != "This shape seems to be OK."} {
puts "Error : result of blend fails the bopcheck"
}

View File

@@ -0,0 +1,34 @@
puts "======="
puts "0029073"
puts "======="
puts ""
##################################################
# Regression: General Cut produces invalid shape
##################################################
brestore [locate_data_file bug29073_M6.brep] b1
brestore [locate_data_file bug29073_Shell.brep] b2
bclearobjects
bcleartools
baddobjects b1
baddtools b2
bfillds
# check the result of SECTION
bbop rsec 4
checknbshapes rsec -edge 1 -vertex 2
# check the result of GF
bbuild rgf
checkshape rgf
checkprops rgf -s 163.708 -v 115.912
checknbshapes rgf -wire 25 -face 24 -shell 3 -solid 1
# check the CUT
bbop result 3
checkshape result
checkprops result -s 0.000713987
checknbshapes result -wire 1 -face 1
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "============"
puts "OCC29204"
puts "============"
puts ""
##################################################################################
# BRepOffsetAPI_MakePipeShell produces invalid result and raises exception in Draw
##################################################################################
restore [locate_data_file bug29204_sweep_spine.brep] sp
restore [locate_data_file bug29204_sweep_profile.brep] pr
mksweep sp
addsweep pr
buildsweep result -C -S
checkshape result
checknbshapes result -solid 1 -shell 1 -face 28 -wire 28 -edge 64 -vertex 36 -shape 158
set tolres [checkmaxtol result]
if { ${tolres} > 0.001} {
puts "Error: bad tolerance of result"
}
checkprops result -v 1.16577e+007

View File

@@ -0,0 +1,28 @@
puts "========"
puts "OCC29663"
puts "========"
puts ""
#################################################
# Exception in BRepFill_PipeShell algorithm
#################################################
restore [locate_data_file bug29523_cut_extrudewire08.brep] sw
restore [locate_data_file bug29523_cut_toolwire08.brep] tw
mksweep sw
addsweep tw
if { [catch {buildsweep rr -R} catch_result] } {
puts "Faulty OCC29663"
}
fixshape result rr
checkshape result
checkprops result -s 2.14316e+011
checkmaxtol result -ref 0.070055357229360987
checknbshapes result -shell 1 -face 201 -wire 201
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -10,7 +10,8 @@ puts ""
restore [locate_data_file bug25693_path3035.brep] result
if { [regexp "There were errors during the operation, so the list may be incomplete" [bopcheck result]] == 1 } {
set bug_info [string trim [bopcheck result]]
if {$bug_info != "This shape seems to be OK."} {
puts "Error : Wire of BSplines fails bopcheck"
}

View File

@@ -12,11 +12,13 @@ restore [locate_data_file bug25693_path3039.brep] path3039
prism Extrude_path3039 path3039 0 0 50
if { [regexp "There were errors during the operation, so the list may be incomplete" [bopcheck path3039]] == 1 } {
set log1 [string trim [bopcheck path3039]]
if {$log1 != "This shape seems to be OK."} {
puts "Error : bad shape"
}
if { [regexp "There were errors during the operation, so the list may be incomplete" [bopcheck Extrude_path3039]] == 1 } {
set log2 [string trim [bopcheck Extrude_path3039]]
if {$log2 != "This shape seems to be OK."} {
puts "Error : Wire of BSplines fails bopcheck"
}

13
tests/evolved/begin Normal file
View File

@@ -0,0 +1,13 @@
# To prevent loops limit to 10 minutes
cpulimit 60
if { [array get Draw_Groups "TOPOLOGY Feature commands"] == "" } {
pload TOPTEST
}
if { [info exists imagedir] == 0 } {
set imagedir .
}
if { [info exists test_image ] == 0 } {
set test_image photo
}

2
tests/evolved/end Normal file
View File

@@ -0,0 +1,2 @@
# to end a test script
puts "TEST COMPLETED"

View File

@@ -0,0 +1 @@
set subgroup evolved

View File

@@ -0,0 +1,11 @@
puts "========"
puts "OCC26470"
puts "========"
puts ""
##################################################
# BRepFill_Evolved: exception and invalid result
##################################################
restore [locate_data_file OCC26470-ClosedWire.brep] a
restore [locate_data_file OCC26470-wprof1.brep] b
evolved res -s a -p b -a

View File

@@ -0,0 +1,12 @@
puts "========"
puts "OCC26470"
puts "========"
puts ""
##################################################
# BRepFill_Evolved: exception and invalid result
##################################################
restore [locate_data_file OCC26470-ClosedWire.brep] a
restore [locate_data_file OCC26470-wprof2.brep] b
evolved res -s a -p b -a
checkshape res

View File

@@ -0,0 +1,20 @@
puts "=========="
puts "PRO19424"
puts "=========="
restore [locate_data_file pro19424a.brep] b
checkshape b
restore [locate_data_file pro19424b.brep] p
checkshape p
if [catch {evolved result -s b -p p -a } catch_result] {
puts "Faulty PRO19424 : function EVOLVED works wrongly"
} else {
puts "PRO19424 OK: function EVOLVED works properly"
}
checkprops result -s 246.506
checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png

2
tests/evolved/grids.list Normal file
View File

@@ -0,0 +1,2 @@
001 evolved
002 voluved

View File

@@ -0,0 +1 @@
FAILED /\bFaulty\b/ bad shape

View File

@@ -0,0 +1,24 @@
puts "=========="
puts "OCC29523"
puts "=========="
profile p F -1 10 TT -1 -1 C 1 90 TT 10 -1 W
polyline t -1 -1 0 0 -1.5 5
evolved result -s p -p t -a -solid -v
checkprops result -s 268.774 -v 245.265
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 1.5e-7
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,24 @@
puts "=========="
puts "OCC29523"
puts "=========="
polyline p 0 0 0 0 10 0 20 10 0 20 0 0 13 0 0 13 5 0 6 5 0 6 0 0 0 0 0
polyline t -2 2 0 0 2 5 0 2 10 1 2 10 1 2 0 -2 2 0
evolved result -s p -p t -a -solid -v
checkprops result -s 1649.58 -v 1023.79
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 1.5e-7
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,24 @@
puts "=========="
puts "OCC29523"
puts "=========="
polyline p 0 0 0 0 10 0 20 10 0 20 0 0 13 0 0 13 5 0 6 5 0 6 0 0 0 0 0
polyline t -1 2 0 0 1 5 0 1 10 0.5 0.5 10 0.5 0.5 0
evolved result -s p -p t -a -solid -v
checkprops result -s 1803.56 -v 532.942
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 5.0e-6
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,25 @@
puts "=========="
puts "OCC29523"
puts "=========="
profile p X 10 Y 2 X -10 W
polyline t -1 1 0 1 1 10
evolved result -s p -p t -a -solid -v
checkprops result -s 287.517 -v 211.903
checkshape result
checknbshapes result -solid 1 -shell 1
# See issue #0029657
#if {[regexp "Faulties" [bopargcheck result]]} {
# puts "Error: bopargcheck has found some faulties in res2"
#}
checkmaxtol result -ref 1.5e-007
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,24 @@
puts "=========="
puts "OCC29523"
puts "=========="
profile p X 10 Y 2 X -10 W
polyline t -1 1 0 1.2 1 10
evolved result -s p -p t -a -solid -v
checkprops result -s 266.546 -v 192.639
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 1.5e-7
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,25 @@
puts "=========="
puts "OCC29523"
puts "=========="
# Different results in command "evolved" with and without "-v"
profile p X 10 Y 2 X -10 W
profile t O 0 1 0 P 0 1 0 0 0 1 X 5 T -1 2 WW
evolved result -s p -p t -a -solid -v
checkprops result -s 137.58 -v 80.9221
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 0.00011504480776721356
smallview
don result p t
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,28 @@
puts "=========="
puts "OCC29523"
puts "=========="
# Result contains intersected faces
profile p X 15 C 1 90 Y 5 X -7 Y -2 C -1 90 X -8 W
profile t O 0 1 0 P 0 1 0 0 0 1 X 5 T -1 2 WW
evolved result -s p -p t -a -solid -v
checkprops result -s 308.284 -v 195.169
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 1.5e-7
regexp {Tolerance MAX=([-0-9.+eE]+)} [tolerance result] full toler
checkreal MAXTOL $toler 1.5e-7 0.0 0.1
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,25 @@
puts "=========="
puts "OCC29523"
puts "=========="
# Different results with and without "-v"; internal/intersecting faces created
profile p X 10 Y 2 X -10 W
profile t O 0 1 0 P 0 1 0 0 0 1 X 2 RR -45 C 1 90 T -1 2 WW
evolved result -s p -p t -a -solid -v
checkprops result -s 129.967 -v 70.6801
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 3.25e-007
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,25 @@
puts "=========="
puts "OCC29523"
puts "=========="
# Solids are correctly built but r_1 should be eliminated as junk
profile p X 10 Y 2 X -10 W
profile t O 0 1 0 P 0 1 0 0 0 1 RR 30 C -10 60 WW
evolved result -s p -p t -a -solid -v
checkprops result -s 308.284 -v 195.169
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 1.5e-7
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "=========="
puts "OCC29523"
puts "=========="
restore [locate_data_file bug29523_cut_extrudewire00.brep] sw
restore [locate_data_file bug29523_cut_toolwire00.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 1.94263e+010 -v 6.2718e+013
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 0.00013577499521488808
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "=========="
puts "OCC29523"
puts "=========="
restore [locate_data_file bug29523_cut_extrudewire01.brep] sw
restore [locate_data_file bug29523_cut_toolwire01.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 2.18924e+011 -v 2.47705e+014
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 1.0e-7
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "=========="
puts "OCC29523"
puts "=========="
restore [locate_data_file bug29523_cut_extrudewire02.brep] sw
restore [locate_data_file bug29523_cut_toolwire02.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 2.18616e+011 -v 2.46411e+014
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 1.6e-5
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "=========="
puts "OCC29523"
puts "=========="
restore [locate_data_file bug29523_cut_extrudewire03.brep] sw
restore [locate_data_file bug29523_cut_toolwire03.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 3.02832e+010 -v 4.97434e+013
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 7.0e-7
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "=========="
puts "OCC29523"
puts "=========="
restore [locate_data_file bug29523_cut_extrudewire04.brep] sw
restore [locate_data_file bug29523_cut_toolwire04.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 1.94263e+010 -v 6.2718e+013
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 0.00013577500067185611
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "=========="
puts "OCC29523"
puts "=========="
restore [locate_data_file bug29523_cut_extrudewire05.brep] sw
restore [locate_data_file bug29523_cut_toolwire05.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 2.84249e+010 -v 8.95554e+013
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 4.4607852024588505e-007
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,26 @@
puts "=========="
puts "OCC29523"
puts "=========="
restore [locate_data_file bug29523_cut_extrudewire06.brep] sw
restore [locate_data_file bug29523_cut_toolwire06.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 1.99565e+011 -v 6.75431e+014
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 4.7e-6
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,28 @@
puts "=========="
puts "OCC29523"
puts "=========="
cpulimit 100
restore [locate_data_file bug29523_cut_extrudewire07.brep] sw
restore [locate_data_file bug29523_cut_toolwire07.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 1.99565e+011 -v 6.75431e+014
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 4.7e-6
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,28 @@
puts "=========="
puts "OCC29523"
puts "=========="
cpulimit 100
restore [locate_data_file bug29523_cut_extrudewire08.brep] sw
restore [locate_data_file bug29523_cut_toolwire08.brep] tw
evolved result -s sw -p tw -solid -a -v
checkprops result -s 1.99565e+011 -v 6.75431e+014
checkshape result
checknbshapes result -solid 1 -shell 1
if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2"
}
checkmaxtol result -ref 4.7e-6
smallview
don result sw tw
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1 @@
set subgroup voluved

View File

@@ -0,0 +1,11 @@
puts "========"
puts "OCC26470"
puts "========"
puts ""
##################################################
# BRepFill_Evolved: exception and invalid result
##################################################
restore [locate_data_file OCC26470-ClosedWire.brep] a
restore [locate_data_file OCC26470-wprof1.brep] b
evolved res -s a -p b -a -v

View File

@@ -0,0 +1,12 @@
puts "========"
puts "OCC26470"
puts "========"
puts ""
##################################################
# BRepFill_Evolved: exception and invalid result
##################################################
restore [locate_data_file OCC26470-ClosedWire.brep] a
restore [locate_data_file OCC26470-wprof2.brep] b
evolved res -s a -p b -a -v
checkshape res

View File

@@ -0,0 +1,20 @@
puts "=========="
puts "PRO19424"
puts "=========="
restore [locate_data_file pro19424a.brep] b
checkshape b
restore [locate_data_file pro19424b.brep] p
checkshape p
if [catch {evolved result -s b -p p -a -v } catch_result] {
puts "Faulty PRO19424 : function EVOLVED works wrongly"
} else {
puts "PRO19424 OK: function EVOLVED works properly"
}
checkprops result -s 246.506
checkshape result
checkview -display result -2d -path ${imagedir}/${test_image}.png