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

0029523: Problem with BRepOffsetAPI_MakeEvolved

The capabilities of the class BRepOffsetAPI_MakeEvolved have been extended with involving alternate algorithm of resolving the loops in the piped shape. The new option theIsVolume is added for that in the constructor.

New class BRepFill_AdvancedEvolved has been created in order to provide new OCCT-algorithm combining BRepFill_PipeShell and BOPAlgo_MakerVolume.

A change in BOPAlgo_PaveFiller.cxx has been made in order to solve a specific problem of Boolean operation.

The interface of DRAW-command "evolved" has been updated to add the new option. DRAW-command "evolvedsolid" has been deleted. Now it is replaced with DRAW-command "evolved" with the option "-solid".

Testgrid "evolved" has been created.
This commit is contained in:
nbv
2018-04-11 12:23:29 +03:00
committed by bugmaster
parent 1ac1059961
commit 858435884d
50 changed files with 3512 additions and 163 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,141 @@
// 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_AdvancedEvolved_HeaderFile
#define _BRepFill_AdvancedEvolved_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>
#include <Standard_CString.hxx>
class BOPAlgo_MakerVolume;
class TopoDS_Face;
//! Constructs an evolved volume from a spine (wire or face)
//! and a profile ( wire).
class BRepFill_AdvancedEvolved
{
public:
DEFINE_STANDARD_ALLOC;
//! Constructor
Standard_EXPORT BRepFill_AdvancedEvolved() :myErrorStatus(BRepFill_AdvancedEvolved_Empty),
myFuzzyValue(0.0),
myIsParallel(Standard_True),
myDebugShapesPath("C:\\Temp")
{
}
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_AdvancedEvolved_OK);
}
//! returns the resulting shape.
const TopoDS_Shape& Shape() const
{
return myResult;
}
//! Sets directory where the debug shapes will be saved
void SetTemporaryDirectory(const Standard_CString& thePath)
{
myDebugShapesPath = thePath;
}
//! Sets/Unsets computation in parallel mode
void SetParallelMode(const Standard_Boolean theVal)
{
myIsParallel = theVal;
}
protected:
Standard_EXPORT void PerformSweep();
Standard_EXPORT void GetLids();
Standard_EXPORT void BuildSolid();
Standard_EXPORT void RemoveExcessSolids(const TopTools_ListOfShape& theLSplits,
const 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);
Standard_EXPORT void UnifyShape();
Standard_EXPORT Standard_Boolean PerformBoolean(const TopTools_ListOfShape& theArgsList,
TopoDS_Shape& theResult) const;
Standard_EXPORT Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF,
const Standard_Real theFuzzyToler,
TopTools_ListOfShape& theListOfFaces,
TopTools_ListOfShape& theListOfSplits) const;
Standard_EXPORT Standard_Boolean IsLid(const TopoDS_Face& theF,
const TopTools_IndexedMapOfShape& theMapOfLids) const;
private:
enum
{
BRepFill_AdvancedEvolved_Empty = 0,
BRepFill_AdvancedEvolved_NotPlanarSpine,
BRepFill_AdvancedEvolved_SweepError,
BRepFill_AdvancedEvolved_NoLids,
BRepFill_AdvancedEvolved_NotSolid,
BRepFill_AdvancedEvolved_NotVolume,
BRepFill_AdvancedEvolved_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;
Standard_Boolean myIsParallel;
Standard_CString myDebugShapesPath;
};
#endif // _BRepFill_AdvancedEvolved_HeaderFile

View File

@@ -690,7 +690,7 @@ void BRepFill_PipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
//function : Build
//purpose : Construct the Shell and the history
//=======================================================================
Standard_Boolean BRepFill_PipeShell::Build()
Standard_Boolean BRepFill_PipeShell::Build()
{
Standard_Boolean Ok;
Standard_Real FirstS, LastS;
@@ -744,8 +744,9 @@ void BRepFill_PipeShell::SetForceApproxC1(const Standard_Boolean ForceApproxC1)
MkSw.SetTolerance(myTol3d, myBoundTol, 1.e-5, myTolAngular);
MkSw.SetAngularControl(angmin, angmax);
MkSw.SetForceApproxC1(myForceApproxC1);
MkSw.SetBounds(TopoDS::Wire(myFirst),
TopoDS::Wire(myLast));
MkSw.SetBounds(TopoDS::Wire(myFirst),
TopoDS::Wire(myLast));
GeomAbs_Shape theContinuity = GeomAbs_C2;
if (myTrihedron == GeomFill_IsDiscreteTrihedron)
theContinuity = GeomAbs_C0;

View File

@@ -19,6 +19,7 @@
#include <Approx_CurveOnSurface.hxx>
#include <Approx_SameParameter.hxx>
#include <Bnd_Box.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_CurveRepresentation.hxx>
#include <BRep_GCurve.hxx>
@@ -702,7 +703,7 @@ static TopoDS_Edge BuildEdge(Handle(Geom_Curve)& C3d,
const Standard_Real l,
const Standard_Real Tol3d)
{
gp_Pnt P1, P2, P;
gp_Pnt P;
Standard_Real Tol1, Tol2, Tol, d;
// Class BRep_Tool without fields and without Constructor :
// BRep_Tool BT;
@@ -710,11 +711,11 @@ static TopoDS_Edge BuildEdge(Handle(Geom_Curve)& C3d,
TopoDS_Edge E;
// P1 = BT.Pnt(VF);
P1 = BRep_Tool::Pnt(VF);
const gp_Pnt P1 = BRep_Tool::Pnt(VF);
// Tol1 = BT.Tolerance(VF);
Tol1 = BRep_Tool::Tolerance(VF);
// P2 = BT.Pnt(VL);
P2 = BRep_Tool::Pnt(VL);
const gp_Pnt P2 = BRep_Tool::Pnt(VL);
// Tol2 = BT.Tolerance(VF);
Tol2 = BRep_Tool::Tolerance(VL);
Tol = Max(Tol1, Tol2);
@@ -750,8 +751,6 @@ static TopoDS_Edge BuildEdge(Handle(Geom_Curve)& C3d,
if (d > Tol1)
B.UpdateVertex(VF, d);
// P1 = BT.Pnt(VL);
P1 = BRep_Tool::Pnt(VL);
C3d->D0(l, P);
d = P2.Distance(P);
if (d > Tol2)
@@ -777,6 +776,19 @@ static TopoDS_Edge BuildEdge(Handle(Geom_Curve)& C3d,
TopLoc_Location Loc;
B.UpdateEdge(E, C2d, S, Loc, Tol3d);
const Handle(IntTools_Context) aNullCtx;
if (BOPTools_AlgoTools::IsMicroEdge(E, aNullCtx))
{
TopoDS_Vertex aV = VF;
B.UpdateVertex(aV, P1.Distance(P2));
B.MakeEdge(E);
B.UpdateEdge(E, C2d, S, TopLoc_Location(), Tol);
B.Add(E, TopoDS::Vertex(aV.Oriented(TopAbs_FORWARD)));
B.Add(E, TopoDS::Vertex(aV.Oriented(TopAbs_REVERSED)));
B.Range(E, f, l);
B.Degenerated(E, Standard_True);
}
return E;
}
@@ -914,7 +926,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;
/*
@@ -1815,8 +1827,6 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
const Standard_Boolean WithKPart) :
isDone(Standard_False),
KPart(WithKPart)
{
mySec = Section;
myLoc = Location;
@@ -3380,7 +3390,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

@@ -2,6 +2,8 @@ BRepFill.cxx
BRepFill.hxx
BRepFill_ACRLaw.cxx
BRepFill_ACRLaw.hxx
BRepFill_AdvancedEvolved.cxx
BRepFill_AdvancedEvolved.hxx
BRepFill_ApproxSeewing.cxx
BRepFill_ApproxSeewing.hxx
BRepFill_CompatibleWires.cxx