1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

Compare commits

...

36 Commits

Author SHA1 Message Date
jgv
70af2be481 0032719: Modelling Algorithms - UnifySameDomain result has incorrect triangulation
Correct method ShapeUpgrade_UnifySameDomain::UnionPCurves: reparametrize unified pcurves to fit the new range of 3D-curve.
2022-03-14 15:33:43 +03:00
aml
cdb006be8e 0032810: Coding - missing Standard_EXPORT in Standard_ErrorHandler 2022-03-02 14:52:24 +03:00
jgv
cda9e99e4c 0032715: Modelling Algorithms - UnifySameDomain does incomplete union 2022-02-18 16:21:58 +03:00
jfa
4b89c81f89 Increment service pack version to 2 2021-11-16 14:23:19 +03:00
jgv
82c3a325e9 0032502: Modeling Algorithms - BOP wrong result on sphere and cylinder
Modifications in the method IntPatch_ALineToWLine::MakeWLine:
correct setting parameters to vertices on IntPatch_WLine curve.
2021-11-15 08:23:29 +03:00
jgv
b08cd044f9 0032623: [Regression] Modelling Algorithms - UnifySameDomain invalid result only in release mode
Correct local function ReconstructMissedSeam: use copy of existing pcurve for seam edge reconstruction to prevent possible corruption of another edges.
2021-10-19 12:52:31 +03:00
jgv
f9481b4f21 0032619: [Regression] Modelling Algorithms - UnifySameDomain ignores shared face
Correct method ShapeUpgrade_UnifySameDomain::UnifyFaces: exclude free boundary edges from unification.
2021-10-15 11:43:34 +03:00
jgv
1e74e3eacd 0032581: Modelling Algorithms - UnifySameDomain produces invalid result
1. Correct local function TransformPCurves of ShapeUpgrade_UnifySameDomain: take into account the case of seam edge.
2. Correct local function ReconstructMissedSeam of ShapeUpgrade_UnifySameDomain: use previously stored seam edge in some cases.
2021-09-30 17:50:54 +03:00
dpasukhi
f2aa215e29 0032556: Data Exchange - A toroidal part of solid is corrupted while writing or reading STEP file
Fix STEP writing Wire for periodic surface
2021-09-21 14:27:02 +03:00
jgv
827bcc6ac2 0032561: Modelling Algorithms - UnifySameDomain does nothing while it is expected to union two pairs of faces
Correct method ShapeUpgrade_UnifySameDomain::UnifyFaces: when creating the Edge-Face map of initial shape, count each face only once.
2021-09-20 12:18:10 +03:00
oan
56f67cdaab 0032424: [Regression] Mesh - Slow triangulation of a simple shape.
Check links produced by splitting of an initial link by the middle point for MinSize requirement.

Conflicts:
	tests/bugs/mesh/bug30008_1
	tests/bugs/moddata_2/bug428
	tests/hlr/poly_hlr/C14
2021-08-30 11:39:36 +03:00
jgv
5db1a7a3db 0031890: Modeling Algorithms - Invalid result of common fuse BOP. Intersection has failed.
Modify the method BOPTools_AlgoTools3D::DoSplitSEAMOnFace: correct processing closed non-periodic surfaces.
2021-08-30 11:33:18 +03:00
jgv
ec70dc84e6 0032196: Modeling Algorithms - Invalid section curve
Modify the method IntWalk_IWalking::ComputeCloseLine: add condition for check of update of variable containing current solution
2021-08-30 11:32:59 +03:00
jgv
7ba9b75f32 0032332: Modeling Algorithms - Incorrect result of ShapeUpgrade_UnifySameDomain
Method UnionPCurves of ShapeUpgrade_UnifySameDomain is modified: check of the range of new pcurves is added: if the range differs from the 3D-curve's one, the pcurves are being recomputed by projection.
2021-08-30 11:32:16 +03:00
jfa
318ef16733 Set servicepack version to 1 2021-08-25 17:23:05 +03:00
jgv
be524d5e81 0032470: Modeling Algorithms - BOP wrong result on sphere and box
Correct adjusting pcurves on periodic surfaces: take the middle point as a reference point.
2021-08-25 16:21:29 +03:00
bugmaster
fecb042498 Update version up to 7.5.3 2021-08-04 10:41:47 +03:00
jgv
c194e1bc39 0032291: Modeling Algorithms - General Fuse produces wrong number of solids
Modify method IntWalk_IWalking::ComputeCloseLine: add new flag "isOnDegeneratedBorder" to reach the border successfully.
2021-08-04 10:14:00 +03:00
emv
96815dec17 0032307: Modeling Algorithms - Empty result of offset operation in mode "Complete" Joint type "Intersection"
Make sure the vertices created by pairwise intersection of edges connected in the same vertex are unified correctly.
2021-07-29 14:17:24 +03:00
emv
03e79361dc 0032088: Modeling Algorithms - Empty result of offset operation in mode "Complete" join type "Intersection"
Mark inverted edges located inside loops of invalid edges as invalid as well.
2021-07-29 12:55:24 +03:00
akaftasev
3a8f6b11e8 0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access
Added to Draw command 'setsweep ' posibility to change degmax and segmax parameter manually by '-SM' and '-DM' options
Added test
Added new condition to prevent crash
2021-07-29 12:48:56 +03:00
akaftasev
45ec28cf68 0029645: Hang on making pipe shell using BRepOffsetAPI_MakePipeShell
Added new boolean parameter to GeomLib::FuseIntervals() to select method of defining an element with close values
2021-07-29 12:48:22 +03:00
aavtamon
7aaaf5eb13 0028572: Modeling Algorithms - Wrong result of the mkface command
- Added note to BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S,
										const TopoDS_Wire& W,
										const Standard_Boolean Inside = Standard_True)
in BRepBuilderAPI_MakeFace.hxx;
- Modified subsubsection occt_modalg_3_5_2 in dox/user_guides/modeling_algos/modeling_algos.md
2021-07-29 12:46:44 +03:00
bugmaster
0dc2c377fc Update version up to 7.5.2 2021-04-20 10:07:58 +03:00
ifv
1078e94941 0032225: Modeling Data - Wrong result of extrema curve-surface
Extrema_GenExtCS.cxx: subdivision on intervals for periodic c curves is added

Extrema_FuncExtCS.hxx: access to fields mySqDist, myPoint1, myPoint2 is added

bug32225: new test case is added
2021-04-20 09:49:15 +03:00
emv
6b26c6d26d 0032199: Modeling Algorithms - BOP Cut produces invalid shape
Use section tolerance for checking the valid range.
2021-04-16 16:13:06 +03:00
jgv
dd56857183 0031984: Modeling Algorithms - Sweep crashes if Bi-normal is given
Small modification in BRepFill_Sweep: to avoid exception, return status NotDone if construction of pipe surface fails.
2021-04-16 15:54:26 +03:00
jgv
2c8eacb996 0032213: Modeling Algorithms - Invalid result of UnifySameDomain
Modify unification of faces: add splitting new wire into several ones.
2021-04-16 15:52:26 +03:00
gka
3b05b748de 0032264: Data Exchange - STEP exporter generates bad geometry [REGRESSION since 7.4.0]
Location of edge is applied to geom curve before analysis of vertices projections
2021-04-16 15:49:03 +03:00
jgv
91e51cb0f2 0032140: Modeling Algorithms - unify same domain calls crossed for opposite vectors
1. Correct unification of circular edges: avoid trying to make an axis with null magnitude.
2. New method UnionPCurves: unify existing pcurves of chain instead of projecting the curve of unified edge onto surfaces
2021-04-16 15:24:04 +03:00
emv
bb00fe2713 0032136: Modeling Algorithms - Boolean fuse fails and corrupts the argument-shape
Avoid increasing tolerance of the vertex before the check on valid range is passed.
2021-04-16 15:21:08 +03:00
bugmaster
94c00556ea Update version up to 7.5.1 2021-02-02 11:51:56 +03:00
emv
bf67bbf8fe 0031912: Modeling Algorithms - Boolean Cut can't build resulting shape
Problem is fixed by #0032058. Integrating test case only.
2021-02-02 11:49:33 +03:00
ifv
edf111202c 0032058: Modeling Data - Extrema curve-surface gives wrong result for planar surface of revolunion and circle
Extrema_GenExtCS.cxx : added solution refinement, if solution seems to be "bad" according to special criteria.
Extrema_FuncExtCS.cxx : "cosmetic" modifications
BOPAlgo_PaveFiller_3.cxx : adding control of shape index to prevent exception in ShapeInfo
bugs/moddata_3/bug32058 : new test
2021-02-02 11:30:40 +03:00
jgv
bbdcdcdd80 0031845: Modeling Algorithms - BRepOffsetAPI_MakeThickSolid fails
Multiple changes in BRepOffset_MakeOffset algorithm:
- correct fusing vertices;
- correct building intersection edges;
- correct intersecting new edges in 2D;
- correct building wire on a new face;
- correct building history.
2021-01-29 13:47:21 +03:00
bugmaster
2ecd3a06a6 Update version up to 7.5.1.dev 2020-11-11 20:08:01 +03:00
138 changed files with 3514 additions and 651 deletions

View File

@ -1356,9 +1356,7 @@ MF.Add(W);
TopoDS_Face F = MF; TopoDS_Face F = MF;
~~~~~ ~~~~~
More than one wire can be added to a face, provided that they do not cross each other and they define only one area on the surface. (Note that this is not checked). The edges on a Face must have a parametric curve description. More than one wire can be added to a face, provided that they do not cross each other and they define only one area on the surface. (Note that this is not checked).
If there is no parametric curve for an edge of the wire on the Face it is computed by projection.
For one wire, a simple syntax is provided to construct the face from the surface and the wire. The above lines could be written: For one wire, a simple syntax is provided to construct the face from the surface and the wire. The above lines could be written:
@ -1366,6 +1364,8 @@ For one wire, a simple syntax is provided to construct the face from the surfac
TopoDS_Face F = BRepBuilderAPI_MakeFace(C,W); TopoDS_Face F = BRepBuilderAPI_MakeFace(C,W);
~~~~~ ~~~~~
The edges on a face must have a parametric curve description. If there is no parametric curve for an edge of the wire on the face it is computed by projection, moreover, the calculation is possible only for the planar face.
A planar face can be created from only a wire, provided this wire defines a plane. For example, to create a planar face from a set of points you can use *BRepBuilderAPI_MakePolygon* and *BRepBuilderAPI_MakeFace*. A planar face can be created from only a wire, provided this wire defines a plane. For example, to create a planar face from a set of points you can use *BRepBuilderAPI_MakePolygon* and *BRepBuilderAPI_MakeFace*.
~~~~~ ~~~~~

View File

@ -655,6 +655,12 @@ void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB)
// Vertices // Vertices
Standard_Integer nV1, nV2; Standard_Integer nV1, nV2;
thePB->Indices(nV1, nV2); thePB->Indices(nV1, nV2);
if (nV1 < 0 || nV2 < 0)
{
return;
}
const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1))); const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2))); const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
// Get the edge // Get the edge

View File

@ -648,8 +648,8 @@ void BOPAlgo_PaveFiller::MakeBlocks()
// check if the pave block has a valid range // check if the pave block has a valid range
Standard_Real aFirst, aLast; Standard_Real aFirst, aLast;
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aTolR3D, if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aTolR3D,
aT1, BRep_Tool::Pnt(aV1), BRep_Tool::Tolerance(aV1), aT1, BRep_Tool::Pnt(aV1), Max (aTolR3D, BRep_Tool::Tolerance(aV1)),
aT2, BRep_Tool::Pnt(aV2), BRep_Tool::Tolerance(aV2), aT2, BRep_Tool::Pnt(aV2), Max (aTolR3D, BRep_Tool::Tolerance(aV2)),
aFirst, aLast)) aFirst, aLast))
{ {
// If the pave block does not have valid range, i.e. it is completely // If the pave block does not have valid range, i.e. it is completely
@ -3035,9 +3035,21 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
return; return;
} }
if (aDistVP > aTolV) // Check if there will be valid range on the curve
Standard_Real aFirst, aLast;
Standard_Real aNewTolV = Max(aTolV, aDistVP + BOPTools_AlgoTools::DTolerance());
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aIC.Tolerance(),
aT[0], aP[0], aNewTolV,
aT[1], aP[1], aNewTolV,
aFirst, aLast))
{ {
Standard_Integer nVn = UpdateVertex(nV, aDistVP + BOPTools_AlgoTools::DTolerance()); // No valid range
return;
}
if (aNewTolV > aTolV)
{
Standard_Integer nVn = UpdateVertex(nV, aNewTolV);
if (nVn != nV) if (nVn != nV)
{ {
aPave.SetIndex(nVn); aPave.SetIndex(nVn);
@ -3046,17 +3058,6 @@ void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
aTolV = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV))); aTolV = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV)));
} }
// Check if there will be valid range on the curve
Standard_Real aFirst, aLast;
if (!BRepLib::FindValidRange(GeomAdaptor_Curve(aIC.Curve()), aIC.Tolerance(),
aT[0], aP[0], aTolV,
aT[1], aP[1], aTolV,
aFirst, aLast))
{
// No valid range
return;
}
// Add closing pave to the curve // Add closing pave to the curve
BOPDS_Pave aNewPave; BOPDS_Pave aNewPave;
aNewPave.SetIndex(nV); aNewPave.SetIndex(nV);

View File

@ -77,7 +77,8 @@ Standard_Boolean BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSp
const TopoDS_Face& aF) const TopoDS_Face& aF)
{ {
Standard_Boolean bIsUPeriodic, bIsVPeriodic, bIsLeft; Standard_Boolean bIsUPeriodic, bIsVPeriodic, bIsLeft;
Standard_Real aTol, a, b, anUPeriod, anVPeriod, aT, anU, dU, anU1; Standard_Real anUPeriod = 0., anVPeriod = 0.;
Standard_Real aTol, a, b, aT, anU, dU, anU1;
Standard_Real aScPr, anV, dV, anV1; Standard_Real aScPr, anV, dV, anV1;
Standard_Real aUmin, aUmax, aVmin, aVmax; Standard_Real aUmin, aUmax, aVmin, aVmax;
gp_Pnt2d aP2D; gp_Pnt2d aP2D;
@ -98,58 +99,64 @@ Standard_Boolean BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSp
// //
aS->Bounds(aUmin, aUmax, aVmin, aVmax); aS->Bounds(aUmin, aUmax, aVmin, aVmax);
// //
bIsUPeriodic=aS->IsUPeriodic();
bIsVPeriodic=aS->IsVPeriodic(); bIsUPeriodic = aS->IsUClosed();
// bIsVPeriodic = aS->IsVClosed();
anUPeriod = bIsUPeriodic ? aS->UPeriod() : 0.;
anVPeriod = bIsVPeriodic ? aS->VPeriod() : 0.; if (bIsUPeriodic)
anUPeriod = aUmax - aUmin;
if (bIsVPeriodic)
anVPeriod = aVmax - aVmin;
// //
if (!bIsUPeriodic && !bIsVPeriodic) { if (!bIsUPeriodic && !bIsVPeriodic) {
Standard_Boolean bIsUClosed, bIsVClosed;
Handle(Geom_BSplineSurface) aBS;
Handle(Geom_BezierSurface) aBZ;
Handle(Geom_RectangularTrimmedSurface) aRTS; Handle(Geom_RectangularTrimmedSurface) aRTS;
aRTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
// //
bIsUClosed=Standard_False; if (aRTS.IsNull())
bIsVClosed=Standard_False; return Standard_False;
aBS=Handle(Geom_BSplineSurface)::DownCast(aS);
aBZ=Handle(Geom_BezierSurface) ::DownCast(aS); else {
aRTS=Handle(Geom_RectangularTrimmedSurface)::DownCast(aS);
//
if (!aBS.IsNull()) {
bIsUClosed=aBS->IsUClosed();
bIsVClosed=aBS->IsVClosed();
}
else if (!aBZ.IsNull()) {
bIsUClosed=aBZ->IsUClosed();
bIsVClosed=aBZ->IsVClosed();
}
else if (!aRTS.IsNull()) {
Handle(Geom_Surface) aSB; Handle(Geom_Surface) aSB;
// //
aSB=aRTS->BasisSurface(); aSB = aRTS->BasisSurface();
bIsUPeriodic=aSB->IsUPeriodic(); bIsUPeriodic = aSB->IsUPeriodic();
bIsVPeriodic=aSB->IsVPeriodic(); bIsVPeriodic = aSB->IsVPeriodic();
// //
if (!(bIsUPeriodic || bIsVPeriodic)) {
return Standard_False; if (bIsUPeriodic || bIsVPeriodic)
} {
anUPeriod = bIsUPeriodic ? aSB->UPeriod() : 0.; anUPeriod = bIsUPeriodic ? aSB->UPeriod() : 0.;
anVPeriod = bIsVPeriodic ? aSB->VPeriod() : 0.; anVPeriod = bIsVPeriodic ? aSB->VPeriod() : 0.;
} }
// else
if (aRTS.IsNull()) { {
if (!bIsUClosed && !bIsVClosed) { Standard_Boolean bIsUClosed = aSB->IsUClosed();
Standard_Boolean bIsVClosed = aSB->IsVClosed();
Standard_Real aGlobalUmin, aGlobalUmax, aGlobalVmin, aGlobalVmax;
aSB->Bounds(aGlobalUmin, aGlobalUmax, aGlobalVmin, aGlobalVmax);
if (bIsUClosed &&
Abs(aUmin - aGlobalUmin) < aTol &&
Abs(aUmax - aGlobalUmax) < aTol)
{
bIsUPeriodic = Standard_True;
anUPeriod = aUmax - aUmin;
}
if (bIsVClosed &&
Abs(aVmin - aGlobalVmin) < aTol &&
Abs(aVmax - aGlobalVmax) < aTol)
{
bIsVPeriodic = Standard_True;
anVPeriod = aVmax - aVmin;
}
}
if (!(bIsUPeriodic || bIsVPeriodic)) {
return Standard_False; return Standard_False;
} }
// } //if !RTS.IsNull
if (bIsUClosed) {
anUPeriod=aUmax-aUmin;
}
if (bIsVClosed) {
anVPeriod=aVmax-aVmin;
}
}
} }
// //
//--------------------------------------------------- //---------------------------------------------------

View File

@ -23,8 +23,10 @@
#include <BRepAlgo_Loop.hxx> #include <BRepAlgo_Loop.hxx>
#include <Geom2d_Curve.hxx> #include <Geom2d_Curve.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <GeomLib.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <gp_Ax2.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
@ -160,6 +162,15 @@ void BRepAlgo_Loop::AddConstEdges(const TopTools_ListOfShape& LE)
} }
} }
//=======================================================================
//function : SetImageVV
//purpose :
//=======================================================================
void BRepAlgo_Loop::SetImageVV (const BRepAlgo_Image& theImageVV)
{
myImageVV = theImageVV;
}
//======================================================================= //=======================================================================
//function : UpdateClosedEdge //function : UpdateClosedEdge
@ -606,6 +617,8 @@ void BRepAlgo_Loop::Perform()
TopoDS_Wire NW; TopoDS_Wire NW;
Standard_Boolean End; Standard_Boolean End;
UpdateVEmap (MVE);
TopTools_MapOfShape UsedEdges; TopTools_MapOfShape UsedEdges;
while (MVE.Extent() > 0) { while (MVE.Extent() > 0) {
@ -924,6 +937,7 @@ void BRepAlgo_Loop::GetVerticesForSubstitute( TopTools_DataMapOfShapeShape& Ver
{ {
VerVerMap = myVerticesForSubstitute; VerVerMap = myVerticesForSubstitute;
} }
//======================================================================= //=======================================================================
//function : VerticesForSubstitute //function : VerticesForSubstitute
//purpose : //purpose :
@ -933,3 +947,123 @@ void BRepAlgo_Loop::VerticesForSubstitute( TopTools_DataMapOfShapeShape& VerVer
{ {
myVerticesForSubstitute = VerVerMap; myVerticesForSubstitute = VerVerMap;
} }
//=======================================================================
//function : UpdateVEmap
//purpose :
//=======================================================================
void BRepAlgo_Loop::UpdateVEmap (TopTools_IndexedDataMapOfShapeListOfShape& theVEmap)
{
TopTools_IndexedDataMapOfShapeListOfShape VerLver;
for (Standard_Integer ii = 1; ii <= theVEmap.Extent(); ii++)
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (theVEmap.FindKey(ii));
const TopTools_ListOfShape& aElist = theVEmap(ii);
if (aElist.Extent() == 1 && myImageVV.IsImage(aVertex))
{
const TopoDS_Vertex& aProVertex = TopoDS::Vertex (myImageVV.ImageFrom(aVertex));
if (VerLver.Contains(aProVertex))
{
TopTools_ListOfShape& aVlist = VerLver.ChangeFromKey(aProVertex);
aVlist.Append (aVertex.Oriented(TopAbs_FORWARD));
}
else
{
TopTools_ListOfShape aVlist;
aVlist.Append (aVertex.Oriented(TopAbs_FORWARD));
VerLver.Add (aProVertex, aVlist);
}
}
}
if (VerLver.IsEmpty())
return;
BRep_Builder aBB;
for (Standard_Integer ii = 1; ii <= VerLver.Extent(); ii++)
{
const TopTools_ListOfShape& aVlist = VerLver(ii);
if (aVlist.Extent() == 1)
continue;
Standard_Real aMaxTol = 0.;
TColgp_Array1OfPnt Points (1, aVlist.Extent());
TopTools_ListIteratorOfListOfShape itl (aVlist);
Standard_Integer jj = 0;
for (; itl.More(); itl.Next())
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
aMaxTol = Max (aMaxTol, aTol);
gp_Pnt aPnt = BRep_Tool::Pnt(aVertex);
Points(++jj) = aPnt;
}
gp_Ax2 anAxis;
Standard_Boolean IsSingular;
GeomLib::AxeOfInertia (Points, anAxis, IsSingular);
gp_Pnt aCentre = anAxis.Location();
Standard_Real aMaxDist = 0.;
for (jj = 1; jj <= Points.Upper(); jj++)
{
Standard_Real aSqDist = aCentre.SquareDistance (Points(jj));
aMaxDist = Max (aMaxDist, aSqDist);
}
aMaxDist = Sqrt(aMaxDist);
aMaxTol = Max (aMaxTol, aMaxDist);
//Find constant vertex
TopoDS_Vertex aConstVertex;
for (itl.Initialize(aVlist); itl.More(); itl.Next())
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
const TopTools_ListOfShape& aElist = theVEmap.FindFromKey(aVertex);
const TopoDS_Shape& anEdge = aElist.First();
TopTools_ListIteratorOfListOfShape itcedges (myConstEdges);
for (; itcedges.More(); itcedges.Next())
if (anEdge.IsSame (itcedges.Value()))
{
aConstVertex = aVertex;
break;
}
if (!aConstVertex.IsNull())
break;
}
if (aConstVertex.IsNull())
aConstVertex = TopoDS::Vertex(aVlist.First());
aBB.UpdateVertex (aConstVertex, aCentre, aMaxTol);
for (itl.Initialize(aVlist); itl.More(); itl.Next())
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (itl.Value());
if (aVertex.IsSame(aConstVertex))
continue;
const TopTools_ListOfShape& aElist = theVEmap.FindFromKey (aVertex);
TopoDS_Edge anEdge = TopoDS::Edge (aElist.First());
anEdge.Orientation(TopAbs_FORWARD);
TopoDS_Vertex aV1, aV2;
TopExp::Vertices (anEdge, aV1, aV2);
TopoDS_Vertex aVertexToRemove = (aV1.IsSame(aVertex))? aV1 : aV2;
anEdge.Free(Standard_True);
aBB.Remove (anEdge, aVertexToRemove);
aBB.Add (anEdge, aConstVertex.Oriented (aVertexToRemove.Orientation()));
}
}
TopTools_IndexedMapOfShape Emap;
for (Standard_Integer ii = 1; ii <= theVEmap.Extent(); ii++)
{
const TopTools_ListOfShape& aElist = theVEmap(ii);
TopTools_ListIteratorOfListOfShape itl (aElist);
for (; itl.More(); itl.Next())
Emap.Add (itl.Value());
}
theVEmap.Clear();
for (Standard_Integer ii = 1; ii <= Emap.Extent(); ii++)
TopExp::MapShapesAndAncestors (Emap(ii), TopAbs_VERTEX, TopAbs_EDGE, theVEmap);
}

View File

@ -25,6 +25,8 @@
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx> #include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <BRepAlgo_Image.hxx>
class TopoDS_Face; class TopoDS_Face;
class TopoDS_Edge; class TopoDS_Edge;
@ -53,9 +55,15 @@ public:
//! Add <LE> as a set of const edges. //! Add <LE> as a set of const edges.
Standard_EXPORT void AddConstEdges (const TopTools_ListOfShape& LE); Standard_EXPORT void AddConstEdges (const TopTools_ListOfShape& LE);
//! Sets the Image Vertex - Vertex
Standard_EXPORT void SetImageVV (const BRepAlgo_Image& theImageVV);
//! Make loops. //! Make loops.
Standard_EXPORT void Perform(); Standard_EXPORT void Perform();
//! Update VE map according to Image Vertex - Vertex
Standard_EXPORT void UpdateVEmap (TopTools_IndexedDataMapOfShapeListOfShape& theVEmap);
//! Cut the edge <E> in several edges <NE> on the //! Cut the edge <E> in several edges <NE> on the
//! vertices<VonE>. //! vertices<VonE>.
Standard_EXPORT void CutEdge (const TopoDS_Edge& E, const TopTools_ListOfShape& VonE, TopTools_ListOfShape& NE) const; Standard_EXPORT void CutEdge (const TopoDS_Edge& E, const TopTools_ListOfShape& VonE, TopTools_ListOfShape& NE) const;
@ -102,6 +110,7 @@ private:
TopTools_ListOfShape myNewFaces; TopTools_ListOfShape myNewFaces;
TopTools_DataMapOfShapeListOfShape myCutEdges; TopTools_DataMapOfShapeListOfShape myCutEdges;
TopTools_DataMapOfShapeShape myVerticesForSubstitute; TopTools_DataMapOfShapeShape myVerticesForSubstitute;
BRepAlgo_Image myImageVV;
}; };

View File

@ -135,6 +135,9 @@ public:
Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); Standard_EXPORT BRepBuilderAPI_MakeFace(const gp_Torus& C, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
//! Make a face from a Surface and a wire. //! Make a face from a Surface and a wire.
//! If the surface S is not plane,
//! it must contain pcurves for all edges in W,
//! otherwise the wrong shape will be created.
Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True); Standard_EXPORT BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, const TopoDS_Wire& W, const Standard_Boolean Inside = Standard_True);
//! Adds the wire <W> in the face <F> //! Adds the wire <W> in the face <F>

View File

@ -1450,6 +1450,10 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
for (Standard_Integer i = 1; i <= aVEdges->UpperRow(); i++) for (Standard_Integer i = 1; i <= aVEdges->UpperRow(); i++)
{ {
const TopoDS_Shape& aVshape = aVEdges->Value(i, inde); const TopoDS_Shape& aVshape = aVEdges->Value(i, inde);
if (aVshape.IsNull())
{
continue;
}
if (aVshape.ShapeType() == TopAbs_EDGE || if (aVshape.ShapeType() == TopAbs_EDGE ||
aVshape.ShapeType() == TopAbs_FACE) aVshape.ShapeType() == TopAbs_FACE)
ListVshapes->Append(aVshape); ListVshapes->Append(aVshape);

View File

@ -2969,11 +2969,23 @@ void BRepFill_Sweep::Build(TopTools_MapOfShape& ReversedEdges,
// Construction of the shell // Construction of the shell
TopoDS_Shell shell; TopoDS_Shell shell;
B.MakeShell(shell); B.MakeShell(shell);
Standard_Integer aNbFaces = 0;
for (ipath=1; ipath<=NbPath; ipath++) for (ipath=1; ipath<=NbPath; ipath++)
for (isec=1; isec <=NbLaw; isec++) { for (isec=1; isec <=NbLaw; isec++)
{
const TopoDS_Shape& face = myFaces->Value(isec, ipath); const TopoDS_Shape& face = myFaces->Value(isec, ipath);
if (!face.IsNull() && if (!face.IsNull() &&
(face.ShapeType() == TopAbs_FACE) ) B.Add(shell, face); (face.ShapeType() == TopAbs_FACE) )
{
B.Add(shell, face);
aNbFaces++;
}
}
if (aNbFaces == 0)
{
isDone = Standard_False;
return;
} }
TopTools_ListIteratorOfListOfShape It(myAuxShape); TopTools_ListIteratorOfListOfShape It(myAuxShape);

View File

@ -1982,6 +1982,12 @@ public:
return aDeriv.Transformed(mySurfaceTrsf); return aDeriv.Transformed(mySurfaceTrsf);
} }
gp_Dir Normal()
{
gp_Dir aNormal = mySurfaceProps.Normal();
return aNormal.Transformed(mySurfaceTrsf);
}
// Calculate principal curvatures, which consist of minimal and maximal normal curvatures and // Calculate principal curvatures, which consist of minimal and maximal normal curvatures and
// the directions on the tangent plane (principal direction) where the extremums are reached // the directions on the tangent plane (principal direction) where the extremums are reached
void Curvature(gp_Dir& thePrincipalDir1, Standard_Real& theCurvature1, void Curvature(gp_Dir& thePrincipalDir1, Standard_Real& theCurvature1,
@ -2014,32 +2020,63 @@ private:
//purpose : check the angle at the border between two squares. //purpose : check the angle at the border between two squares.
// Two shares should have a shared front edge. // Two shares should have a shared front edge.
//======================================================================= //=======================================================================
static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed, GeomAbs_Shape BRepLib::ContinuityOfFaces(const TopoDS_Edge& theEdge,
const TopoDS_Face& F1, const TopoDS_Face& theFace1,
const TopoDS_Face& F2, const TopoDS_Face& theFace2,
const Standard_Real theAngleTol) const Standard_Real theAngleTol)
{ {
Standard_Boolean isSeam = F1.IsEqual(F2); Standard_Boolean isSeam = theFace1.IsEqual(theFace2);
TopoDS_Edge E = Ed; TopoDS_Edge anEdgeInFace1, anEdgeInFace2;
Handle(Geom2d_Curve) aCurve1, aCurve2;
// Check if pcurves exist on both faces of edge Standard_Real aFirst, aLast;
Standard_Real aFirst,aLast;
E.Orientation(TopAbs_FORWARD); if (!theFace1.IsSame (theFace2) &&
Handle(Geom2d_Curve) aCurve1 = BRep_Tool::CurveOnSurface(E, F1, aFirst, aLast); BRep_Tool::IsClosed (theEdge, theFace1) &&
if(aCurve1.IsNull()) BRep_Tool::IsClosed (theEdge, theFace2))
{
//Find the edge in the face 1: this edge will have correct orientation
TopoDS_Face aFace1 = theFace1;
aFace1.Orientation (TopAbs_FORWARD);
TopExp_Explorer anExplo (aFace1, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
if (anEdge.IsSame (theEdge))
{
anEdgeInFace1 = anEdge;
break;
}
}
if (anEdgeInFace1.IsNull())
return GeomAbs_C0; return GeomAbs_C0;
if (isSeam) aCurve1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace1, aFirst, aLast);
E.Orientation(TopAbs_REVERSED); TopoDS_Face aFace2 = theFace2;
Handle(Geom2d_Curve) aCurve2 = BRep_Tool::CurveOnSurface(E, F2, aFirst, aLast); aFace2.Orientation (TopAbs_FORWARD);
if(aCurve2.IsNull()) anEdgeInFace2 = anEdgeInFace1;
anEdgeInFace2.Reverse();
aCurve2 = BRep_Tool::CurveOnSurface (anEdgeInFace2, aFace2, aFirst, aLast);
}
else
{
// Obtaining of pcurves of edge on two faces.
anEdgeInFace1 = anEdgeInFace2 = theEdge;
aCurve1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, theFace1, aFirst, aLast);
//For the case of seam edge
if (theFace1.IsSame(theFace2))
anEdgeInFace2.Reverse();
aCurve2 = BRep_Tool::CurveOnSurface (anEdgeInFace2, theFace2, aFirst, aLast);
}
if (aCurve1.IsNull() || aCurve2.IsNull())
return GeomAbs_C0; return GeomAbs_C0;
TopLoc_Location aLoc1, aLoc2; TopLoc_Location aLoc1, aLoc2;
Handle(Geom_Surface) aSurface1 = BRep_Tool::Surface(F1, aLoc1); Handle(Geom_Surface) aSurface1 = BRep_Tool::Surface (theFace1, aLoc1);
const gp_Trsf& aSurf1Trsf = aLoc1.Transformation(); const gp_Trsf& aSurf1Trsf = aLoc1.Transformation();
Handle(Geom_Surface) aSurface2 = BRep_Tool::Surface(F2, aLoc2); Handle(Geom_Surface) aSurface2 = BRep_Tool::Surface (theFace2, aLoc2);
const gp_Trsf& aSurf2Trsf = aLoc2.Transformation(); const gp_Trsf& aSurf2Trsf = aLoc2.Transformation();
if (aSurface1->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) if (aSurface1->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface)))
@ -2056,11 +2093,11 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
return GeomAbs_CN; return GeomAbs_CN;
} }
SurfaceProperties aSP1(aSurface1, aSurf1Trsf, aCurve1, F1.Orientation() == TopAbs_REVERSED); SurfaceProperties aSP1(aSurface1, aSurf1Trsf, aCurve1, theFace1.Orientation() == TopAbs_REVERSED);
SurfaceProperties aSP2(aSurface2, aSurf2Trsf, aCurve2, F2.Orientation() == TopAbs_REVERSED); SurfaceProperties aSP2(aSurface2, aSurf2Trsf, aCurve2, theFace2.Orientation() == TopAbs_REVERSED);
Standard_Real f, l, eps; Standard_Real f, l, eps;
BRep_Tool::Range(E,f,l); BRep_Tool::Range (theEdge,f,l);
Extrema_LocateExtPC ext; Extrema_LocateExtPC ext;
Handle(BRepAdaptor_HCurve) aHC2; Handle(BRepAdaptor_HCurve) aHC2;
@ -2071,7 +2108,6 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
const Standard_Real anAngleTol2 = theAngleTol * theAngleTol; const Standard_Real anAngleTol2 = theAngleTol * theAngleTol;
gp_Vec aDer1, aDer2; gp_Vec aDer1, aDer2;
gp_Vec aNorm1;
Standard_Real aSqLen1, aSqLen2; Standard_Real aSqLen1, aSqLen2;
gp_Dir aCrvDir1[2], aCrvDir2[2]; gp_Dir aCrvDir1[2], aCrvDir2[2];
Standard_Real aCrvLen1[2], aCrvLen2[2]; Standard_Real aCrvLen1[2], aCrvLen2[2];
@ -2099,13 +2135,26 @@ static GeomAbs_Shape tgtfaces(const TopoDS_Edge& Ed,
aDer2 = aSP2.Derivative(); aDer2 = aSP2.Derivative();
aSqLen2 = aDer2.SquareMagnitude(); aSqLen2 = aDer2.SquareMagnitude();
Standard_Boolean isSmoothSuspect = (aDer1.CrossSquareMagnitude(aDer2) <= anAngleTol2 * aSqLen1 * aSqLen2); Standard_Boolean isSmoothSuspect = (aDer1.CrossSquareMagnitude(aDer2) <= anAngleTol2 * aSqLen1 * aSqLen2);
if (isSmoothSuspect)
{
gp_Dir aNormal1 = aSP1.Normal();
if (theFace1.Orientation() == TopAbs_REVERSED)
aNormal1.Reverse();
gp_Dir aNormal2 = aSP2.Normal();
if (theFace2.Orientation() == TopAbs_REVERSED)
aNormal2.Reverse();
if (aNormal1 * aNormal2 < 0.)
return GeomAbs_C0;
}
if (!isSmoothSuspect) if (!isSmoothSuspect)
{ {
// Refine by projection // Refine by projection
if (aHC2.IsNull()) if (aHC2.IsNull())
{ {
// adaptor for pcurve on the second surface // adaptor for pcurve on the second surface
aHC2 = new BRepAdaptor_HCurve(BRepAdaptor_Curve(E, F2)); aHC2 = new BRepAdaptor_HCurve(BRepAdaptor_Curve(anEdgeInFace2, theFace2));
ext.Initialize(aHC2->Curve(), f, l, Precision::PConfusion()); ext.Initialize(aHC2->Curve(), f, l, Precision::PConfusion());
} }
ext.Perform(aSP1.Value(), u); ext.Perform(aSP1.Value(), u);
@ -2301,9 +2350,8 @@ void BRepLib::EncodeRegularity(TopoDS_Edge& E,
BRep_Builder B; BRep_Builder B;
if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){ if(BRep_Tool::Continuity(E,F1,F2)<=GeomAbs_C0){
try { try {
GeomAbs_Shape aCont = tgtfaces(E, F1, F2, TolAng); GeomAbs_Shape aCont = ContinuityOfFaces(E, F1, F2, TolAng);
B.Continuity(E,F1,F2,aCont); B.Continuity(E,F1,F2,aCont);
} }
catch(Standard_Failure const&) catch(Standard_Failure const&)
{ {

View File

@ -216,6 +216,13 @@ public:
//! False if the solid is unOrientable (open or incoherent) //! False if the solid is unOrientable (open or incoherent)
Standard_EXPORT static Standard_Boolean OrientClosedSolid (TopoDS_Solid& solid); Standard_EXPORT static Standard_Boolean OrientClosedSolid (TopoDS_Solid& solid);
//! Returns the order of continuity between two faces
//! connected by an edge
Standard_EXPORT static GeomAbs_Shape ContinuityOfFaces(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2,
const Standard_Real theAngleTol);
//! Encodes the Regularity of edges on a Shape. //! Encodes the Regularity of edges on a Shape.
//! Warning: <TolAng> is an angular tolerance, expressed in Rad. //! Warning: <TolAng> is an angular tolerance, expressed in Rad.
//! Warning: If the edges's regularity are coded before, nothing //! Warning: If the edges's regularity are coded before, nothing

View File

@ -34,6 +34,7 @@ public:
//! Constructor. //! Constructor.
BRepMesh_DelaunayDeflectionControlMeshAlgo() BRepMesh_DelaunayDeflectionControlMeshAlgo()
: myMaxSqDeflection(-1.), : myMaxSqDeflection(-1.),
mySqMinSize(-1.),
myIsAllDegenerated(Standard_False), myIsAllDegenerated(Standard_False),
myCircles(NULL) myCircles(NULL)
{ {
@ -77,6 +78,7 @@ protected:
Handle(NCollection_IncAllocator) aTmpAlloc = Handle(NCollection_IncAllocator) aTmpAlloc =
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE); new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
mySqMinSize = this->getParameters().MinSize * this->getParameters().MinSize;
myCouplesMap = new IMeshData::MapOfOrientedEdges(3 * this->getStructure()->ElementsOfDomain().Extent(), aTmpAlloc); myCouplesMap = new IMeshData::MapOfOrientedEdges(3 * this->getStructure()->ElementsOfDomain().Extent(), aTmpAlloc);
myControlNodes = new IMeshData::ListOfPnt2d(aTmpAlloc); myControlNodes = new IMeshData::ListOfPnt2d(aTmpAlloc);
myCircles = &theMesher.Circles(); myCircles = &theMesher.Circles();
@ -339,7 +341,11 @@ private:
if (!usePoint (aMidPnt2d, LineDeviation (theNodesInfo[i].Point, if (!usePoint (aMidPnt2d, LineDeviation (theNodesInfo[i].Point,
theNodesInfo[j].Point))) theNodesInfo[j].Point)))
{ {
if (!checkLinkEndsForAngularDeviation(theNodesInfo[i], if (!rejectSplitLinksForMinSize (theNodesInfo[i],
theNodesInfo[j],
aMidPnt2d))
{
if (!checkLinkEndsForAngularDeviation (theNodesInfo[i],
theNodesInfo[j], theNodesInfo[j],
aMidPnt2d)) aMidPnt2d))
{ {
@ -349,6 +355,18 @@ private:
} }
} }
} }
}
//! Checks that two links produced as the result of a split of
//! the given link by the middle point fit MinSize requirement.
Standard_Boolean rejectSplitLinksForMinSize (const TriangleNodeInfo& theNodeInfo1,
const TriangleNodeInfo& theNodeInfo2,
const gp_XY& theMidPoint)
{
const gp_Pnt aPnt = getPoint3d (theMidPoint);
return ((theNodeInfo1.Point - aPnt.XYZ()).SquareModulus() < mySqMinSize ||
(theNodeInfo2.Point - aPnt.XYZ()).SquareModulus() < mySqMinSize);
}
//! Checks the given point (located between the given nodes) //! Checks the given point (located between the given nodes)
//! for specified angular deviation. //! for specified angular deviation.
@ -365,8 +383,10 @@ private:
{ {
Standard_Real anAngle = aNorm1.Angle(aNorm2); Standard_Real anAngle = aNorm1.Angle(aNorm2);
if (anAngle > this->getParameters().AngleInterior) if (anAngle > this->getParameters().AngleInterior)
{
return Standard_False; return Standard_False;
} }
}
#if 0 #if 0
else if (GeomLib::NormEstim(aSurf, theMidPoint, Precision::Confusion(), aNorm1) != 0) else if (GeomLib::NormEstim(aSurf, theMidPoint, Precision::Confusion(), aNorm1) != 0)
{ {
@ -381,6 +401,14 @@ private:
return Standard_True; return Standard_True;
} }
//! Returns 3d point corresponding to the given one in 2d space.
gp_Pnt getPoint3d (const gp_XY& thePnt2d)
{
gp_Pnt aPnt;
this->getDFace()->GetSurface()->D0(thePnt2d.X(), thePnt2d.Y(), aPnt);
return aPnt;
}
//! Computes deflection of the given point and caches it for //! Computes deflection of the given point and caches it for
//! insertion in case if it overflows deflection. //! insertion in case if it overflows deflection.
//! @return True if point has been cached for insertion. //! @return True if point has been cached for insertion.
@ -389,8 +417,7 @@ private:
const gp_XY& thePnt2d, const gp_XY& thePnt2d,
const DeflectionFunctor& theDeflectionFunctor) const DeflectionFunctor& theDeflectionFunctor)
{ {
gp_Pnt aPnt; const gp_Pnt aPnt = getPoint3d (thePnt2d);
this->getDFace()->GetSurface()->D0(thePnt2d.X(), thePnt2d.Y(), aPnt);
if (!checkDeflectionOfPointAndUpdateCache(thePnt2d, aPnt, theDeflectionFunctor.SquareDeviation(aPnt))) if (!checkDeflectionOfPointAndUpdateCache(thePnt2d, aPnt, theDeflectionFunctor.SquareDeviation(aPnt)))
{ {
myControlNodes->Append(thePnt2d); myControlNodes->Append(thePnt2d);
@ -422,14 +449,14 @@ private:
return rejectByMinSize(thePnt2d, thePnt3d); return rejectByMinSize(thePnt2d, thePnt3d);
} }
//! Checks the given node for //! Checks distance between the given node and nodes of triangles
//! shot by it for MinSize criteria.
//! This check is expected to roughly estimate and prevent
//! generation of triangles with sides smaller than MinSize.
Standard_Boolean rejectByMinSize( Standard_Boolean rejectByMinSize(
const gp_XY& thePnt2d, const gp_XY& thePnt2d,
const gp_Pnt& thePnt3d) const gp_Pnt& thePnt3d)
{ {
const Standard_Real aSqMinSize =
this->getParameters().MinSize * this->getParameters().MinSize;
IMeshData::MapOfInteger aUsedNodes; IMeshData::MapOfInteger aUsedNodes;
IMeshData::ListOfInteger& aCirclesList = IMeshData::ListOfInteger& aCirclesList =
const_cast<BRepMesh_CircleTool&>(*myCircles).Select( const_cast<BRepMesh_CircleTool&>(*myCircles).Select(
@ -451,7 +478,7 @@ private:
const BRepMesh_Vertex& aVertex = this->getStructure()->GetNode(aNodes[i]); const BRepMesh_Vertex& aVertex = this->getStructure()->GetNode(aNodes[i]);
const gp_Pnt& aPoint = this->getNodesMap()->Value(aVertex.Location3d()); const gp_Pnt& aPoint = this->getNodesMap()->Value(aVertex.Location3d());
if (thePnt3d.SquareDistance(aPoint) < aSqMinSize) if (thePnt3d.SquareDistance(aPoint) < mySqMinSize)
{ {
return Standard_True; return Standard_True;
} }
@ -464,6 +491,7 @@ private:
private: private:
Standard_Real myMaxSqDeflection; Standard_Real myMaxSqDeflection;
Standard_Real mySqMinSize;
Standard_Boolean myIsAllDegenerated; Standard_Boolean myIsAllDegenerated;
Handle(IMeshData::MapOfOrientedEdges) myCouplesMap; Handle(IMeshData::MapOfOrientedEdges) myCouplesMap;
Handle(IMeshData::ListOfPnt2d) myControlNodes; Handle(IMeshData::ListOfPnt2d) myControlNodes;

View File

@ -32,6 +32,7 @@
#include <BRepAdaptor_Curve2d.hxx> #include <BRepAdaptor_Curve2d.hxx>
#include <BRepAdaptor_Surface.hxx> #include <BRepAdaptor_Surface.hxx>
#include <BRepAlgo_AsDes.hxx> #include <BRepAlgo_AsDes.hxx>
#include <BRepAlgo_Image.hxx>
#include <BRepLib.hxx> #include <BRepLib.hxx>
#include <BRepLib_MakeVertex.hxx> #include <BRepLib_MakeVertex.hxx>
#include <BRepOffset_Analyse.hxx> #include <BRepOffset_Analyse.hxx>
@ -63,6 +64,7 @@
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <IntRes2d_IntersectionPoint.hxx> #include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_IntersectionSegment.hxx> #include <IntRes2d_IntersectionSegment.hxx>
#include <IntTools_Tools.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TColGeom2d_SequenceOfCurve.hxx> #include <TColGeom2d_SequenceOfCurve.hxx>
#include <TColgp_Array1OfPnt2d.hxx> #include <TColgp_Array1OfPnt2d.hxx>
@ -78,6 +80,7 @@
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx> #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <stdio.h> #include <stdio.h>
#ifdef DRAW #ifdef DRAW
@ -113,27 +116,153 @@ static TopoDS_Vertex CommonVertex(TopoDS_Edge& E1,
return V; return V;
} }
static Standard_Boolean IsOrientationChanged(TopTools_IndexedMapOfShape& theMap, static Standard_Integer DefineClosedness(const TopoDS_Face& theFace)
const TopoDS_Edge& theEdge)
{ {
Standard_Boolean IsOrChanged = Standard_False; TopExp_Explorer anExplo (theFace, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
if (!theMap.Contains(theEdge)) {
theMap.Add(theEdge); const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
if (BRepTools::IsReallyClosed(anEdge, theFace))
{
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theFace, fpar, lpar);
gp_Vec2d aTangent = aPCurve->DN(fpar, 1);
Standard_Real aCrossProd1 = aTangent ^ gp::DX2d();
Standard_Real aCrossProd2 = aTangent ^ gp::DY2d();
if (Abs(aCrossProd2) < Abs(aCrossProd1)) //pcurve is parallel to OY
return 1;
else else
{ return 2;
Standard_Integer anInd = theMap.FindIndex(theEdge);
const TopoDS_Shape& anEdge = theMap(anInd);
if (theEdge.Orientation() != anEdge.Orientation())
{
theMap.Substitute( anInd, theEdge );
IsOrChanged = Standard_True;
} }
} }
return IsOrChanged; return 0;
} }
static void GetEdgesOrientedInFace(const TopoDS_Shape& theShape,
const TopoDS_Face& theFace,
const Handle(BRepAlgo_AsDes)& theAsDes,
TopTools_SequenceOfShape& theSeqEdges)
{
const TopTools_ListOfShape& aEdges = theAsDes->Descendant (theFace);
TopExp_Explorer anExplo (theShape, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
const TopoDS_Shape& anEdge = anExplo.Current();
TopTools_ListIteratorOfListOfShape itl (aEdges);
for (; itl.More(); itl.Next())
{
const TopoDS_Shape& anEdgeInFace = itl.Value();
if (anEdgeInFace.IsSame(anEdge))
{
theSeqEdges.Append (anEdgeInFace);
break;
}
}
}
if (theSeqEdges.Length() == 1)
return;
TopTools_IndexedDataMapOfShapeListOfShape aVEmap;
for (Standard_Integer ii = 1; ii <= theSeqEdges.Length(); ii++)
TopExp::MapShapesAndAncestors (theSeqEdges(ii), TopAbs_VERTEX, TopAbs_EDGE, aVEmap);
TopoDS_Vertex aFirstVertex;
TopoDS_Edge aFirstEdge;
for (Standard_Integer ii = 1; ii <= aVEmap.Extent(); ii++)
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (aVEmap.FindKey(ii));
const TopTools_ListOfShape& aElist = aVEmap(ii);
if (aElist.Extent() == 1)
{
const TopoDS_Edge& anEdge = TopoDS::Edge(aElist.First());
TopoDS_Vertex aV1, aV2;
TopExp::Vertices(anEdge, aV1, aV2, Standard_True); //with orientation
if (aV1.IsSame(aVertex))
{
aFirstVertex = aVertex;
aFirstEdge = anEdge;
break;
}
}
}
if (aFirstEdge.IsNull()) //closed set of edges
{
//Standard_Real aPeriod = 0.;
Standard_Integer IndCoord = DefineClosedness (theFace);
/*
BRepAdaptor_Surface aBAsurf (theFace, Standard_False);
if (IndCoord == 1)
aPeriod = aBAsurf.LastUParameter() - aBAsurf.FirstUParameter();
else if (IndCoord == 2)
aPeriod = aBAsurf.LastVParameter() - aBAsurf.FirstVParameter();
*/
if (IndCoord != 0)
{
Standard_Real aMaxDelta = 0.;
for (Standard_Integer ii = 1; ii <= aVEmap.Extent(); ii++)
{
const TopoDS_Vertex& aVertex = TopoDS::Vertex (aVEmap.FindKey(ii));
const TopTools_ListOfShape& aElist = aVEmap(ii);
const TopoDS_Edge& anEdge1 = TopoDS::Edge(aElist.First());
const TopoDS_Edge& anEdge2 = TopoDS::Edge(aElist.Last());
Standard_Real aParam1 = BRep_Tool::Parameter(aVertex, anEdge1);
Standard_Real aParam2 = BRep_Tool::Parameter(aVertex, anEdge2);
BRepAdaptor_Curve2d aBAcurve1 (anEdge1, theFace);
BRepAdaptor_Curve2d aBAcurve2 (anEdge2, theFace);
gp_Pnt2d aPnt1 = aBAcurve1.Value(aParam1);
gp_Pnt2d aPnt2 = aBAcurve2.Value(aParam2);
Standard_Real aDelta = Abs(aPnt1.Coord(IndCoord) - aPnt2.Coord(IndCoord));
if (aDelta > aMaxDelta)
{
aMaxDelta = aDelta;
aFirstVertex = aVertex;
}
}
const TopTools_ListOfShape& aElist = aVEmap.FindFromKey(aFirstVertex);
TopTools_ListIteratorOfListOfShape itl (aElist);
for (; itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge(itl.Value());
TopoDS_Vertex aV1, aV2;
TopExp::Vertices(anEdge, aV1, aV2, Standard_True); //with orientation
if (aV1.IsSame(aFirstVertex))
{
aFirstEdge = anEdge;
break;
}
}
}
}
Standard_Integer aNbEdges = theSeqEdges.Length();
theSeqEdges.Clear();
theSeqEdges.Append (aFirstEdge);
TopoDS_Edge anEdge = aFirstEdge;
for (;;)
{
TopoDS_Vertex aLastVertex = TopExp::LastVertex (anEdge, Standard_True); //with orientation
if (aLastVertex.IsSame(aFirstVertex))
break;
const TopTools_ListOfShape& aElist = aVEmap.FindFromKey(aLastVertex);
if (aElist.Extent() == 1)
break;
if (aElist.First().IsSame(anEdge))
anEdge = TopoDS::Edge(aElist.Last());
else
anEdge = TopoDS::Edge(aElist.First());
theSeqEdges.Append (anEdge);
if (theSeqEdges.Length() == aNbEdges)
break;
}
}
//======================================================================= //=======================================================================
//function : Store //function : Store
@ -150,6 +279,14 @@ static void Store(const TopoDS_Edge& theEdge,
Handle(BRepAlgo_AsDes) theAsDes2d, Handle(BRepAlgo_AsDes) theAsDes2d,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV) TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
{ {
// Update vertices
TopTools_ListIteratorOfListOfShape aIt(theLV);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value());
BRep_Builder().UpdateVertex(aV, theTol);
}
// Get vertices already added to the edge and check the distances to the new ones
const TopTools_ListOfShape& aLVEx = theAsDes2d->Descendant(theEdge); const TopTools_ListOfShape& aLVEx = theAsDes2d->Descendant(theEdge);
if (!IsToUpdate && aLVEx.IsEmpty()) { if (!IsToUpdate && aLVEx.IsEmpty()) {
if (theLV.Extent()) theAsDes2d->Add(theEdge, theLV); if (theLV.Extent()) theAsDes2d->Add(theEdge, theLV);
@ -157,21 +294,23 @@ static void Store(const TopoDS_Edge& theEdge,
} }
// //
GeomAPI_ProjectPointOnCurve aProjPC; GeomAPI_ProjectPointOnCurve aProjPC;
Standard_Real aTolE = 0.0;
if (IsToUpdate) { if (IsToUpdate) {
Standard_Real aT1, aT2; Standard_Real aT1, aT2;
const Handle(Geom_Curve)& aC = BRep_Tool::Curve(theEdge, aT1, aT2); const Handle(Geom_Curve)& aC = BRep_Tool::Curve(theEdge, aT1, aT2);
aProjPC.Init(aC, aT1, aT2); aProjPC.Init(aC, aT1, aT2);
aTolE = BRep_Tool::Tolerance(theEdge);
} }
// //
TopTools_MapOfShape aMV; TopTools_MapOfShape aMV;
TopTools_ListIteratorOfListOfShape aIt(theLV); for (aIt.Init(theLV); aIt.More(); aIt.Next()) {
for (; aIt.More(); aIt.Next()) {
const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value()); const TopoDS_Vertex& aV = TopoDS::Vertex(aIt.Value());
if (!aMV.Add(aV)) { if (!aMV.Add(aV)) {
continue; continue;
} }
// //
const gp_Pnt& aP = BRep_Tool::Pnt(aV); const gp_Pnt& aP = BRep_Tool::Pnt(aV);
const Standard_Real aTol = BRep_Tool::Tolerance(aV);
// //
TopTools_ListOfShape aLVC; TopTools_ListOfShape aLVC;
TopTools_ListIteratorOfListOfShape aItEx(aLVEx); TopTools_ListIteratorOfListOfShape aItEx(aLVEx);
@ -181,7 +320,8 @@ static void Store(const TopoDS_Edge& theEdge,
break; break;
} }
const gp_Pnt& aPEx = BRep_Tool::Pnt(aVEx); const gp_Pnt& aPEx = BRep_Tool::Pnt(aVEx);
if (aP.IsEqual(aPEx, theTol)) { const Standard_Real aTolVEx = BRep_Tool::Tolerance(aVEx);
if (aP.IsEqual(aPEx, aTol + aTolVEx)) {
aLVC.Append(aVEx); aLVC.Append(aVEx);
} }
} }
@ -197,16 +337,13 @@ static void Store(const TopoDS_Edge& theEdge,
continue; continue;
} }
// //
if (aProjPC.LowerDistance() > theTol) { if (aProjPC.LowerDistance() > aTol + aTolE) {
continue; continue;
} }
// //
Standard_Real aT = aProjPC.LowerDistanceParameter(); Standard_Real aT = aProjPC.LowerDistanceParameter();
TopoDS_Shape aLocalShape = aV.Oriented(TopAbs_INTERNAL); TopoDS_Shape aLocalShape = aV.Oriented(TopAbs_INTERNAL);
BRep_Builder().UpdateVertex(TopoDS::Vertex(aLocalShape), aT, theEdge, theTol); BRep_Builder().UpdateVertex(TopoDS::Vertex(aLocalShape), aT, theEdge, aTol);
}
else {
BRep_Builder().UpdateVertex(aV, theTol);
} }
// //
if (aLVC.Extent()) { if (aLVC.Extent()) {
@ -505,7 +642,7 @@ static void EdgeInter(const TopoDS_Face& F,
// Vertex storage in DS. // Vertex storage in DS.
//--------------------------------- //---------------------------------
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2); Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
TolStore = Max(TolStore, 10.*Tol); TolStore = Max (TolStore, Tol);
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV); Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
} }
} }
@ -518,10 +655,13 @@ static void RefEdgeInter(const TopoDS_Face& F,
const BRepAdaptor_Surface& BAsurf, const BRepAdaptor_Surface& BAsurf,
const TopoDS_Edge& E1, const TopoDS_Edge& E1,
const TopoDS_Edge& E2, const TopoDS_Edge& E2,
const TopAbs_Orientation theOr1,
const TopAbs_Orientation theOr2,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
Standard_Real Tol, Standard_Real Tol,
Standard_Boolean WithOri, Standard_Boolean WithOri,
gp_Pnt& Pref, const TopoDS_Vertex& theVref,
BRepAlgo_Image& theImageVV,
TopTools_IndexedDataMapOfShapeListOfShape& aDMVV, TopTools_IndexedDataMapOfShapeListOfShape& aDMVV,
Standard_Boolean& theCoincide) Standard_Boolean& theCoincide)
{ {
@ -541,7 +681,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
return; return;
Standard_Real f[3],l[3]; Standard_Real f[3],l[3];
Standard_Real TolDub = 1.e-7; Standard_Real TolDub = 1.e-7, TolLL = 0.0;
Standard_Integer i; Standard_Integer i;
//BRep_Tool::Range(E1, f[1], l[1]); //BRep_Tool::Range(E1, f[1], l[1]);
@ -558,9 +698,6 @@ static void RefEdgeInter(const TopoDS_Face& F,
BRepLib::BuildCurve3d(E1); BRepLib::BuildCurve3d(E1);
BRepLib::BuildCurve3d(E2); BRepLib::BuildCurve3d(E2);
Standard_Real TolSum = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
TolSum = Max( TolSum, 1.e-5 );
TColgp_SequenceOfPnt ResPoints; TColgp_SequenceOfPnt ResPoints;
TColStd_SequenceOfReal ResParamsOnE1, ResParamsOnE2; TColStd_SequenceOfReal ResParamsOnE1, ResParamsOnE2;
gp_Pnt DegPoint; gp_Pnt DegPoint;
@ -590,11 +727,19 @@ static void RefEdgeInter(const TopoDS_Face& F,
(GAC2.GetType() == GeomAbs_Line)) (GAC2.GetType() == GeomAbs_Line))
{ {
// Just quickly check if lines coincide // Just quickly check if lines coincide
if (GAC1.Line().Direction().IsParallel (GAC2.Line().Direction(), 1.e-8)) Standard_Real anAngle = Abs(GAC1.Line().Direction().Angle(GAC2.Line().Direction()));
if (anAngle <= 1.e-8 || M_PI - anAngle <= 1.e-8)
{ {
theCoincide = Standard_True; theCoincide = Standard_True;
return; return;
} }
else
{
// Take into account the intersection range of line-line intersection
// (the smaller angle between curves, the bigger range)
TolLL = IntTools_Tools::ComputeIntRange(TolDub, TolDub, anAngle);
TolLL = Min (TolLL, 1.e-5);
}
} }
Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub ); Geom2dInt_GInter Inter2d( GAC1, GAC2, TolDub, TolDub );
@ -694,6 +839,12 @@ static void RefEdgeInter(const TopoDS_Face& F,
if (CrossProd > 0.) if (CrossProd > 0.)
OO2 = TopAbs_FORWARD; OO2 = TopAbs_FORWARD;
} }
if (theOr1 != TopAbs_EXTERNAL)
OO1 = theOr1;
if (theOr2 != TopAbs_EXTERNAL)
OO2 = theOr2;
LV1.Append( aNewVertex.Oriented(OO1) ); LV1.Append( aNewVertex.Oriented(OO1) );
LV2.Append( aNewVertex.Oriented(OO2) ); LV2.Append( aNewVertex.Oriented(OO2) );
} }
@ -755,7 +906,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
while (j < i) { while (j < i) {
P1 = BRep_Tool::Pnt(TopoDS::Vertex(it1LV1.Value())); P1 = BRep_Tool::Pnt(TopoDS::Vertex(it1LV1.Value()));
P2 = BRep_Tool::Pnt(TopoDS::Vertex(it2LV1.Value())); P2 = BRep_Tool::Pnt(TopoDS::Vertex(it2LV1.Value()));
if (P1.IsEqual(P2,10*Tol)) { if (P1.IsEqual(P2, Tol)) {
LV1.Remove(it1LV1); LV1.Remove(it1LV1);
LV2.Remove(it1LV2); LV2.Remove(it1LV2);
if (AffichPurge) std::cout <<"Doubles removed in EdgeInter."<<std::endl; if (AffichPurge) std::cout <<"Doubles removed in EdgeInter."<<std::endl;
@ -775,6 +926,7 @@ static void RefEdgeInter(const TopoDS_Face& F,
////----------------------------------------------------- ////-----------------------------------------------------
if(LV1.Extent() > 1) { if(LV1.Extent() > 1) {
//std::cout << "IFV - RefEdgeInter: remove vertex" << std::endl; //std::cout << "IFV - RefEdgeInter: remove vertex" << std::endl;
gp_Pnt Pref = BRep_Tool::Pnt(theVref);
Standard_Real dmin = RealLast(); Standard_Real dmin = RealLast();
TopoDS_Vertex Vmin; TopoDS_Vertex Vmin;
for (it1LV1.Initialize(LV1); it1LV1.More(); it1LV1.Next()) { for (it1LV1.Initialize(LV1); it1LV1.More(); it1LV1.Next()) {
@ -795,9 +947,22 @@ static void RefEdgeInter(const TopoDS_Face& F,
} }
} }
TopTools_ListIteratorOfListOfShape itl (LV1);
for (; itl.More(); itl.Next())
{
TopoDS_Shape aNewVertex = itl.Value();
aNewVertex.Orientation(TopAbs_FORWARD);
if (theImageVV.HasImage (theVref))
theImageVV.Add (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
else
theImageVV.Bind (theVref.Oriented(TopAbs_FORWARD), aNewVertex);
}
////----------------------------------------------------- ////-----------------------------------------------------
Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2); Standard_Real TolStore = BRep_Tool::Tolerance(E1) + BRep_Tool::Tolerance(E2);
TolStore = Max(TolStore, 10.*Tol); TolStore = Max (TolStore, Tol);
// Compare to Line-Line tolerance
TolStore = Max (TolStore, TolLL);
Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV); Store (E1,E2,LV1,LV2,TolStore,AsDes, aDMVV);
} }
} }
@ -1406,6 +1571,7 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F, const TopoDS_Face& F,
const TopTools_IndexedMapOfShape& NewEdges, const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol, const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV) TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
{ {
#ifdef DRAW #ifdef DRAW
@ -1441,12 +1607,41 @@ void BRepOffset_Inter2d::Compute (const Handle(BRepAlgo_AsDes)& AsDes,
while (j < i && it2LE.More()) { while (j < i && it2LE.More()) {
const TopoDS_Edge& E2 = TopoDS::Edge(it2LE.Value()); const TopoDS_Edge& E2 = TopoDS::Edge(it2LE.Value());
Standard_Boolean ToIntersect = Standard_True;
if (theEdgeIntEdges.IsBound(E1))
{
const TopTools_ListOfShape& aElist = theEdgeIntEdges(E1);
TopTools_ListIteratorOfListOfShape itedges (aElist);
for (; itedges.More(); itedges.Next())
if (E2.IsSame (itedges.Value()))
ToIntersect = Standard_False;
if (ToIntersect)
{
for (itedges.Initialize(aElist); itedges.More(); itedges.Next())
{
const TopoDS_Shape& anEdge = itedges.Value();
if (theEdgeIntEdges.IsBound(anEdge))
{
const TopTools_ListOfShape& aElist2 = theEdgeIntEdges(anEdge);
TopTools_ListIteratorOfListOfShape itedges2 (aElist2);
for (; itedges2.More(); itedges2.Next())
if (E2.IsSame (itedges2.Value()))
ToIntersect = Standard_False;
}
}
}
}
//-------------------------------------------------------------- //--------------------------------------------------------------
// Intersections of New edges obtained by intersection // Intersections of New edges obtained by intersection
// between them and with edges of restrictions // between them and with edges of restrictions
//------------------------------------------------------ //------------------------------------------------------
if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) && if (ToIntersect &&
(!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) { (NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
TopoDS_Shape aLocalShape = F.Oriented(TopAbs_FORWARD); TopoDS_Shape aLocalShape = F.Oriented(TopAbs_FORWARD);
EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True, theDMVV); EdgeInter(TopoDS::Face(aLocalShape),BAsurf,E1,E2,AsDes,Tol,Standard_True, theDMVV);
// EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True); // EdgeInter(TopoDS::Face(F.Oriented(TopAbs_FORWARD)),E1,E2,AsDes,Tol,Standard_True);
@ -1467,11 +1662,14 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
BRepOffset_Offset& OFI, BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build, const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& theAsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset, const Standard_Real Offset,
const Standard_Real Tol, const Standard_Real Tol,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
TopTools_IndexedMapOfShape& FacesWithVerts, TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV) TopTools_IndexedDataMapOfShapeListOfShape& theDMVV)
{ {
@ -1529,8 +1727,7 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
continue; // Protection from case when explorer does not contain edges. continue; // Protection from case when explorer does not contain edges.
CurE = FirstE = wexp.Current(); CurE = FirstE = wexp.Current();
TopTools_IndexedMapOfShape Edges; TopTools_IndexedMapOfShape Edges;
Standard_Boolean ToReverse1, ToReverse2;
ToReverse1 = IsOrientationChanged(Edges, CurE);
while (!end) { while (!end) {
wexp.Next(); wexp.Next();
if (wexp.More()) { if (wexp.More()) {
@ -1541,10 +1738,7 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
} }
if (CurE.IsSame(NextE)) continue; if (CurE.IsSame(NextE)) continue;
ToReverse2 = IsOrientationChanged(Edges, NextE);
TopoDS_Vertex Vref = CommonVertex(CurE, NextE); TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
CurE = Analyse.EdgeReplacement (FI, CurE); CurE = Analyse.EdgeReplacement (FI, CurE);
NextE = Analyse.EdgeReplacement (FI, NextE); NextE = Analyse.EdgeReplacement (FI, NextE);
@ -1559,21 +1753,38 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
TopTools_ListOfShape LV1,LV2; TopTools_ListOfShape LV1,LV2;
Standard_Boolean DoInter = 1; Standard_Boolean DoInter = 1;
TopoDS_Shape NE1,NE2; TopoDS_Shape NE1,NE2;
TopTools_SequenceOfShape NE1seq, NE2seq;
TopAbs_Orientation anOr1 = TopAbs_EXTERNAL, anOr2 = TopAbs_EXTERNAL;
Standard_Integer aChoice = 0;
if (Build.IsBound(CurE) && Build.IsBound(NextE)) { if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
aChoice = 1;
NE1 = Build(CurE ); NE1 = Build(CurE );
NE2 = Build(NextE); NE2 = Build(NextE);
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
GetEdgesOrientedInFace (NE2, FIO, theAsDes, NE2seq);
anOr1 = TopAbs_REVERSED;
anOr2 = TopAbs_FORWARD;
} }
else if (Build.IsBound(CurE) && MES.IsBound(NEO)) { else if (Build.IsBound(CurE) && MES.IsBound(NEO)) {
aChoice = 2;
NE1 = Build(CurE); NE1 = Build(CurE);
NE2 = MES (NEO); NE2 = MES (NEO);
NE2.Orientation (NextE.Orientation());
GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
NE2seq.Append (NE2);
anOr1 = TopAbs_REVERSED;
anOr2 = TopAbs_FORWARD;
} }
else if (Build.IsBound(NextE) && MES.IsBound(CEO)) { else if (Build.IsBound(NextE) && MES.IsBound(CEO)) {
aChoice = 3;
NE1 = Build(NextE); NE1 = Build(NextE);
NE2 = MES(CEO); NE2 = MES(CEO);
Standard_Boolean Tmp = ToReverse1; NE2.Orientation (CurE.Orientation());
ToReverse1 = ToReverse2; GetEdgesOrientedInFace (NE1, FIO, theAsDes, NE1seq);
ToReverse2 = Tmp; NE2seq.Append (NE2);
anOr1 = TopAbs_FORWARD;
anOr2 = TopAbs_REVERSED;
} }
else { else {
DoInter = 0; DoInter = 0;
@ -1583,23 +1794,43 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
// NE1,NE2 can be a compound of Edges. // NE1,NE2 can be a compound of Edges.
//------------------------------------ //------------------------------------
Standard_Boolean bCoincide; Standard_Boolean bCoincide;
TopExp_Explorer Exp1, Exp2; TopoDS_Edge aE1, aE2;
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) { if (aChoice == 1 || aChoice == 2)
TopoDS_Edge aE1 = TopoDS::Edge(Exp1.Current()); {
for (Exp2.Init(NE2, TopAbs_EDGE); Exp2.More(); Exp2.Next()) { aE1 = TopoDS::Edge (NE1seq.Last());
TopoDS_Edge aE2 = TopoDS::Edge(Exp2.Current()); aE2 = TopoDS::Edge (NE2seq.First());
//Correct orientation of edges
if (ToReverse1)
aE1.Reverse();
if (ToReverse2)
aE2.Reverse();
//////////////////////////////
RefEdgeInter(FIO, BAsurf, aE1, aE2, AsDes2d,
Tol, Standard_True, Pref, theDMVV, bCoincide);
} }
else // aChoice == 3
{
aE1 = TopoDS::Edge (NE1seq.First());
aE2 = TopoDS::Edge (NE2seq.Last());
} }
if (aE1.Orientation() == TopAbs_REVERSED)
anOr1 = TopAbs::Reverse(anOr1);
if (aE2.Orientation() == TopAbs_REVERSED)
anOr2 = TopAbs::Reverse(anOr2);
RefEdgeInter(FIO, BAsurf, aE1, aE2, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, theImageVV, theDMVV, bCoincide);
if (theEdgeIntEdges.IsBound(aE1))
theEdgeIntEdges(aE1).Append(aE2);
else
{
TopTools_ListOfShape aElist;
aElist.Append(aE2);
theEdgeIntEdges.Bind (aE1, aElist);
}
if (theEdgeIntEdges.IsBound(aE2))
theEdgeIntEdges(aE2).Append(aE1);
else
{
TopTools_ListOfShape aElist;
aElist.Append(aE1);
theEdgeIntEdges.Bind (aE2, aElist);
}
// //
// check if some of the offset edges have been // check if some of the offset edges have been
// generated out of the common vertex // generated out of the common vertex
@ -1622,7 +1853,6 @@ Standard_Boolean BRepOffset_Inter2d::ConnexIntByInt
} }
} }
CurE = wexp.Current(); CurE = wexp.Current();
ToReverse1 = ToReverse2;
} }
} }
return Standard_True; return Standard_True;
@ -1682,7 +1912,6 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
if (CurE.IsSame(NextE)) continue; if (CurE.IsSame(NextE)) continue;
// //
TopoDS_Vertex Vref = CommonVertex(CurE, NextE); TopoDS_Vertex Vref = CommonVertex(CurE, NextE);
gp_Pnt Pref = BRep_Tool::Pnt(Vref);
if (!Build.IsBound(Vref)) { if (!Build.IsBound(Vref)) {
CurE = NextE; CurE = NextE;
continue; continue;
@ -1697,6 +1926,7 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
TopoDS_Edge NEO = TopoDS::Edge(aLocalShape); TopoDS_Edge NEO = TopoDS::Edge(aLocalShape);
// //
TopoDS_Shape NE1,NE2; TopoDS_Shape NE1,NE2;
TopAbs_Orientation anOr1 = TopAbs_EXTERNAL, anOr2 = TopAbs_EXTERNAL;
if (Build.IsBound(CurE) && Build.IsBound(NextE)) { if (Build.IsBound(CurE) && Build.IsBound(NextE)) {
NE1 = Build(CurE ); NE1 = Build(CurE );
@ -1729,8 +1959,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with first edge // intersection with first edge
for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) { for (Exp1.Init(NE1, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current()); const TopoDS_Edge& aE1 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE1, aE3, AsDes2d, BRepAlgo_Image anEmptyImage;
Tol, Standard_True, Pref, theDMVV, bCoincide); RefEdgeInter(FIO, BAsurf, aE1, aE3, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
if (bCoincide) { if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E1 // in case of coincidence trim the edge E3 the same way as E1
Store(aE3, AsDes2d->Descendant(aE1), Tol, Standard_True, AsDes2d, theDMVV); Store(aE3, AsDes2d->Descendant(aE1), Tol, Standard_True, AsDes2d, theDMVV);
@ -1740,8 +1971,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
// intersection with second edge // intersection with second edge
for (Exp1.Init(NE2, TopAbs_EDGE); Exp1.More(); Exp1.Next()) { for (Exp1.Init(NE2, TopAbs_EDGE); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE2 = TopoDS::Edge(Exp1.Current()); const TopoDS_Edge& aE2 = TopoDS::Edge(Exp1.Current());
RefEdgeInter(FIO, BAsurf, aE2, aE3, AsDes2d, BRepAlgo_Image anEmptyImage;
Tol, Standard_True, Pref, theDMVV, bCoincide); RefEdgeInter(FIO, BAsurf, aE2, aE3, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
if (bCoincide) { if (bCoincide) {
// in case of coincidence trim the edge E3 the same way as E2 // in case of coincidence trim the edge E3 the same way as E2
Store(aE3, AsDes2d->Descendant(aE2), Tol, Standard_True, AsDes2d, theDMVV); Store(aE3, AsDes2d->Descendant(aE2), Tol, Standard_True, AsDes2d, theDMVV);
@ -1759,8 +1991,9 @@ void BRepOffset_Inter2d::ConnexIntByIntInVert
for (Exp1.Next(); Exp1.More(); Exp1.Next()) { for (Exp1.Next(); Exp1.More(); Exp1.Next()) {
const TopoDS_Edge& aE3Next = TopoDS::Edge(Exp1.Current()); const TopoDS_Edge& aE3Next = TopoDS::Edge(Exp1.Current());
if (aME.Contains(aE3Next)) { if (aME.Contains(aE3Next)) {
RefEdgeInter(FIO, BAsurf, aE3Next, aE3, AsDes2d, BRepAlgo_Image anEmptyImage;
Tol, Standard_True, Pref, theDMVV, bCoincide); RefEdgeInter(FIO, BAsurf, aE3Next, aE3, anOr1, anOr2, AsDes2d,
Tol, Standard_True, Vref, anEmptyImage, theDMVV, bCoincide);
} }
} }
} }
@ -1795,7 +2028,8 @@ static void MakeChain(const TopoDS_Shape& theV,
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV, Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Handle(BRepAlgo_AsDes)& theAsDes) const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImageVV)
{ {
BRep_Builder aBB; BRep_Builder aBB;
TopTools_MapOfShape aMVDone; TopTools_MapOfShape aMVDone;
@ -1837,6 +2071,11 @@ Standard_Boolean BRepOffset_Inter2d::FuseVertices (const TopTools_IndexedDataMap
} }
// and replace the vertex // and replace the vertex
theAsDes->Replace(aVOld, aVNew); theAsDes->Replace(aVOld, aVNew);
if (theImageVV.IsImage(aVOld))
{
const TopoDS_Vertex& aProVertex = TopoDS::Vertex (theImageVV.ImageFrom(aVOld));
theImageVV.Add (aProVertex, aVNew.Oriented(TopAbs_FORWARD));
}
} }
} }
return Standard_True; return Standard_True;

View File

@ -24,14 +24,17 @@
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
class BRepAlgo_AsDes; class BRepAlgo_AsDes;
class TopoDS_Face; class BRepAlgo_Image;
class BRepOffset_Analyse; class BRepOffset_Analyse;
class BRepOffset_Offset; class BRepOffset_Offset;
class TopoDS_Edge;
class TopoDS_Face;
//! Computes the intersections betwwen edges on a face //! Computes the intersections between edges on a face
//! stores result is SD as AsDes from BRepOffset. //! stores result is SD as AsDes from BRepOffset.
class BRepOffset_Inter2d class BRepOffset_Inter2d
{ {
@ -50,6 +53,7 @@ public:
const TopoDS_Face& F, const TopoDS_Face& F,
const TopTools_IndexedMapOfShape& NewEdges, const TopTools_IndexedMapOfShape& NewEdges,
const Standard_Real Tol, const Standard_Real Tol,
const TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV); TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
//! Computes the intersection between the offset edges of the <FI>. //! Computes the intersection between the offset edges of the <FI>.
@ -61,11 +65,14 @@ public:
BRepOffset_Offset& OFI, BRepOffset_Offset& OFI,
TopTools_DataMapOfShapeShape& MES, TopTools_DataMapOfShapeShape& MES,
const TopTools_DataMapOfShapeShape& Build, const TopTools_DataMapOfShapeShape& Build,
const Handle(BRepAlgo_AsDes)& theAsDes,
const Handle(BRepAlgo_AsDes)& AsDes2d, const Handle(BRepAlgo_AsDes)& AsDes2d,
const Standard_Real Offset, const Standard_Real Offset,
const Standard_Real Tol, const Standard_Real Tol,
const BRepOffset_Analyse& Analyse, const BRepOffset_Analyse& Analyse,
TopTools_IndexedMapOfShape& FacesWithVerts, TopTools_IndexedMapOfShape& FacesWithVerts,
BRepAlgo_Image& theImageVV,
TopTools_DataMapOfShapeListOfShape& theEdgeIntEdges,
TopTools_IndexedDataMapOfShapeListOfShape& theDMVV); TopTools_IndexedDataMapOfShapeListOfShape& theDMVV);
//! Computes the intersection between the offset edges generated //! Computes the intersection between the offset edges generated
@ -88,7 +95,9 @@ public:
//! and updates AsDes by replacing the old vertices //! and updates AsDes by replacing the old vertices
//! with the new ones. //! with the new ones.
Standard_EXPORT static Standard_Boolean FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV, Standard_EXPORT static Standard_Boolean FuseVertices (const TopTools_IndexedDataMapOfShapeListOfShape& theDMVV,
const Handle(BRepAlgo_AsDes)& theAsDes); const Handle(BRepAlgo_AsDes)& theAsDes,
BRepAlgo_Image& theImageVV);
//! extents the edge //! extents the edge
Standard_EXPORT static Standard_Boolean ExtentEdge (const TopoDS_Edge& E, Standard_EXPORT static Standard_Boolean ExtentEdge (const TopoDS_Edge& E,
TopoDS_Edge& NE, TopoDS_Edge& NE,

View File

@ -169,6 +169,7 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
{ {
TopTools_ListOfShape LInt1, LInt2; TopTools_ListOfShape LInt1, LInt2;
TopoDS_Edge NullEdge; TopoDS_Edge NullEdge;
TopoDS_Face NullFace;
if (F1.IsSame(F2)) return; if (F1.IsSame(F2)) return;
if (IsDone(F1,F2)) return; if (IsDone(F1,F2)) return;
@ -221,11 +222,11 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1), if (BRepOffset_Tool::FindCommonShapes(TopoDS::Face(InitF1),
TopoDS::Face(InitF2),LE,LV)) { TopoDS::Face(InitF2),LE,LV)) {
if (!LE.IsEmpty()) { if (!LE.IsEmpty()) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
} }
} }
else { else {
BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D(F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
} }
} }
} }
@ -236,7 +237,7 @@ void BRepOffset_Inter3d::FaceInter(const TopoDS_Face& F1,
BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide); BRepOffset_Tool::PipeInter(F1,F2,LInt1,LInt2,mySide);
} }
else { else {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
} }
} }
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
@ -259,6 +260,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1,LInt2;
TopoDS_Face F1,F2; TopoDS_Face F1,F2;
TopoDS_Edge NullEdge; TopoDS_Edge NullEdge;
TopoDS_Face NullFace;
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// etape 1 : Intersection of faces // corresponding to the initial faces // etape 1 : Intersection of faces // corresponding to the initial faces
@ -273,10 +275,13 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
//----------------------------------------------------------- //-----------------------------------------------------------
const TopTools_ListOfShape& Anc = Analyse.Ancestors(E); const TopTools_ListOfShape& Anc = Analyse.Ancestors(E);
if (Anc.Extent() == 2) { if (Anc.Extent() == 2) {
F1 = TopoDS::Face(InitOffsetFace.Image(Anc.First()).First());
F2 = TopoDS::Face(InitOffsetFace.Image(Anc.Last ()).First()); const TopoDS_Face& InitF1 = TopoDS::Face(Anc.First());
const TopoDS_Face& InitF2 = TopoDS::Face(Anc.Last());
F1 = TopoDS::Face(InitOffsetFace.Image(InitF1).First());
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) { if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,Standard_True); BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,E,InitF1,InitF2);
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
} }
} }
@ -361,7 +366,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
if (!TangentFaces) { if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First()); F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) { if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
} }
} }
@ -371,7 +376,7 @@ void BRepOffset_Inter3d::ConnexIntByArc(const TopTools_ListOfShape& /*SetOfFaces
if (!TangentFaces) { if (!TangentFaces) {
F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First()); F2 = TopoDS::Face(InitOffsetFace.Image(InitF2).First());
if (!IsDone(F1,F2)) { if (!IsDone(F1,F2)) {
BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (F1,F2,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
Store (F1,F2,LInt1,LInt2); Store (F1,F2,LInt1,LInt2);
} }
} }
@ -635,7 +640,7 @@ void BRepOffset_Inter3d::ConnexIntByInt
// //
if (!IsDone(NF1,NF2)) { if (!IsDone(NF1,NF2)) {
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1,LInt2;
BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,bEdge); BRepOffset_Tool::Inter3D (NF1,NF2,LInt1,LInt2,CurSide,E,F1,F2);
SetDone(NF1,NF2); SetDone(NF1,NF2);
if (!LInt1.IsEmpty()) { if (!LInt1.IsEmpty()) {
Store (NF1,NF2,LInt1,LInt2); Store (NF1,NF2,LInt1,LInt2);
@ -1034,7 +1039,7 @@ void BRepOffset_Inter3d::ContextIntByInt
TopTools_ListOfShape LInt1,LInt2; TopTools_ListOfShape LInt1,LInt2;
TopTools_ListOfShape LOE; TopTools_ListOfShape LOE;
LOE.Append(OE); LOE.Append(OE);
BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,bEdge); BRepOffset_Tool::Inter3D (WCF,NF,LInt1,LInt2,Side,E,CF,F);
SetDone(NF,CF); SetDone(NF,CF);
if (!LInt1.IsEmpty()) { if (!LInt1.IsEmpty()) {
Store (CF,NF,LInt1,LInt2); Store (CF,NF,LInt1,LInt2);
@ -1086,6 +1091,7 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
TopoDS_Edge OE; TopoDS_Edge OE;
BRep_Builder B; BRep_Builder B;
TopoDS_Edge NullEdge; TopoDS_Edge NullEdge;
TopoDS_Face NullFace;
Standard_Integer j; Standard_Integer j;
for (j = 1; j <= ContextFaces.Extent(); j++) { for (j = 1; j <= ContextFaces.Extent(); j++) {
@ -1255,7 +1261,7 @@ void BRepOffset_Inter3d::ContextIntByArc(const TopTools_IndexedMapOfShape& Conte
// If no trace try intersection. // If no trace try intersection.
//------------------------------------------------------- //-------------------------------------------------------
if (LInt1.IsEmpty()) { if (LInt1.IsEmpty()) {
BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge); BRepOffset_Tool::Inter3D (CF,OF1,LInt1,LInt2,mySide,NullEdge,NullFace,NullFace);
} }
Store (CF,OF1,LInt1,LInt2); Store (CF,OF1,LInt1,LInt2);
} }

View File

@ -51,12 +51,14 @@ BRepOffset_MakeLoops::BRepOffset_MakeLoops()
void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF, void BRepOffset_MakeLoops::Build(const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image) BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV)
{ {
TopTools_ListIteratorOfListOfShape it(LF); TopTools_ListIteratorOfListOfShape it(LF);
TopTools_ListIteratorOfListOfShape itl,itLCE; TopTools_ListIteratorOfListOfShape itl,itLCE;
BRepAlgo_Loop Loops; BRepAlgo_Loop Loops;
Loops.VerticesForSubstitute( myVerVerMap ); Loops.VerticesForSubstitute( myVerVerMap );
Loops.SetImageVV (theImageVV);
for (; it.More(); it.Next()) { for (; it.More(); it.Next()) {
const TopoDS_Face& F = TopoDS::Face(it.Value()); const TopoDS_Face& F = TopoDS::Face(it.Value());

View File

@ -39,11 +39,20 @@ public:
Standard_EXPORT BRepOffset_MakeLoops(); Standard_EXPORT BRepOffset_MakeLoops();
Standard_EXPORT void Build (const TopTools_ListOfShape& LF, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image); Standard_EXPORT void Build (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
BRepAlgo_Image& theImageVV);
Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext, const BRepOffset_Analyse& Analyse, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image, const Standard_Boolean InSide); Standard_EXPORT void BuildOnContext (const TopTools_ListOfShape& LContext,
const BRepOffset_Analyse& Analyse,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image,
const Standard_Boolean InSide);
Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF, const Handle(BRepAlgo_AsDes)& AsDes, BRepAlgo_Image& Image); Standard_EXPORT void BuildFaces (const TopTools_ListOfShape& LF,
const Handle(BRepAlgo_AsDes)& AsDes,
BRepAlgo_Image& Image);

View File

@ -591,6 +591,7 @@ BRepOffset_MakeOffset::BRepOffset_MakeOffset(const TopoDS_Shape& S,
: :
myOffset (Offset), myOffset (Offset),
myTol (Tol), myTol (Tol),
myInitialShape (S),
myShape (S), myShape (S),
myMode (Mode), myMode (Mode),
myInter (Inter), myInter (Inter),
@ -623,6 +624,7 @@ void BRepOffset_MakeOffset::Initialize(const TopoDS_Shape& S,
const Standard_Boolean RemoveIntEdges) const Standard_Boolean RemoveIntEdges)
{ {
myOffset = Offset; myOffset = Offset;
myInitialShape = S;
myShape = S; myShape = S;
myTol = Tol; myTol = Tol;
myMode = Mode; myMode = Mode;
@ -650,9 +652,11 @@ void BRepOffset_MakeOffset::Clear()
myInitOffsetFace .Clear(); myInitOffsetFace .Clear();
myInitOffsetEdge .Clear(); myInitOffsetEdge .Clear();
myImageOffset .Clear(); myImageOffset .Clear();
myImageVV .Clear();
myFaces .Clear(); myFaces .Clear();
myOriginalFaces .Clear(); myOriginalFaces .Clear();
myFaceOffset .Clear(); myFaceOffset .Clear();
myEdgeIntEdges .Clear();
myAsDes ->Clear(); myAsDes ->Clear();
myDone = Standard_False; myDone = Standard_False;
myGenerated.Clear(); myGenerated.Clear();
@ -1256,7 +1260,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
{ {
const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value()); const TopoDS_Face& NEF = TopoDS::Face(itLFE.Value());
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF); Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(NEF);
BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, aDMVV); BRepOffset_Inter2d::Compute(AsDes, NEF, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
} }
//---------------------------------------------- //----------------------------------------------
// Intersections 2d on caps. // Intersections 2d on caps.
@ -1266,10 +1270,10 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
{ {
const TopoDS_Face& Cork = TopoDS::Face(myFaces(i)); const TopoDS_Face& Cork = TopoDS::Face(myFaces(i));
Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork); Standard_Real aCurrFaceTol = BRep_Tool::Tolerance(Cork);
BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, aDMVV); BRepOffset_Inter2d::Compute(AsDes, Cork, NewEdges, aCurrFaceTol, myEdgeIntEdges, aDMVV);
} }
// //
BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes); BRepOffset_Inter2d::FuseVertices(aDMVV, AsDes, myImageVV);
//------------------------------- //-------------------------------
// Unwinding of extended Faces. // Unwinding of extended Faces.
//------------------------------- //-------------------------------
@ -1286,7 +1290,7 @@ void BRepOffset_MakeOffset::BuildOffsetByInter()
} }
} }
else { else {
myMakeLoops.Build(LFE, AsDes, IMOE); myMakeLoops.Build(LFE, AsDes, IMOE, myImageVV);
} }
// //
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
@ -2526,10 +2530,10 @@ void BRepOffset_MakeOffset::Intersection2D(const TopTools_IndexedMapOfShape& Mod
Standard_Integer i; Standard_Integer i;
for (i = 1; i <= Modif.Extent(); i++) { for (i = 1; i <= Modif.Extent(); i++) {
const TopoDS_Face& F = TopoDS::Face(Modif(i)); const TopoDS_Face& F = TopoDS::Face(Modif(i));
BRepOffset_Inter2d::Compute(myAsDes,F,NewEdges,myTol, aDMVV); BRepOffset_Inter2d::Compute(myAsDes, F, NewEdges, myTol, myEdgeIntEdges, aDMVV);
} }
// //
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes); BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, myImageVV);
// //
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
if (AffichInt2d) { if (AffichInt2d) {
@ -2569,7 +2573,7 @@ void BRepOffset_MakeOffset::MakeLoops(TopTools_IndexedMapOfShape& Modif)
BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset); BuildSplitsOfTrimmedFaces(LF, myAsDes, myImageOffset);
} }
else { else {
myMakeLoops.Build(LF,myAsDes,myImageOffset); myMakeLoops.Build(LF,myAsDes,myImageOffset,myImageVV);
} }
//----------------------------------------- //-----------------------------------------
@ -3345,7 +3349,7 @@ const BRepAlgo_Image& BRepOffset_MakeOffset::OffsetEdgesFromShapes() const
const TopTools_IndexedMapOfShape& BRepOffset_MakeOffset::ClosingFaces () const const TopTools_IndexedMapOfShape& BRepOffset_MakeOffset::ClosingFaces () const
{ {
return myFaces; return myOriginalFaces;
} }
@ -3998,8 +4002,8 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
{ {
const TopoDS_Face& aF = TopoDS::Face (it.Value()); const TopoDS_Face& aF = TopoDS::Face (it.Value());
aTolF = BRep_Tool::Tolerance (aF); aTolF = BRep_Tool::Tolerance (aF);
if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes2d, if (!BRepOffset_Inter2d::ConnexIntByInt(aF, theMapSF(aF), theMES, theBuild, theAsDes, theAsDes2d,
myOffset, aTolF, myAnalyse, aMFV, aDMVV)) myOffset, aTolF, myAnalyse, aMFV, myImageVV, myEdgeIntEdges, aDMVV))
{ {
myError = BRepOffset_CannotExtentEdge; myError = BRepOffset_CannotExtentEdge;
return; return;
@ -4015,7 +4019,7 @@ void BRepOffset_MakeOffset::IntersectEdges(const TopTools_ListOfShape& theFaces,
} }
// //
// fuse vertices on edges // fuse vertices on edges
if (!BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d)) if (!BRepOffset_Inter2d::FuseVertices(aDMVV, theAsDes2d, myImageVV))
{ {
myError = BRepOffset_CannotFuseVertices; myError = BRepOffset_CannotFuseVertices;
return; return;
@ -4490,9 +4494,24 @@ const TopTools_ListOfShape& BRepOffset_MakeOffset::Generated (const TopoDS_Shape
Standard_FALLTHROUGH Standard_FALLTHROUGH
case TopAbs_FACE: case TopAbs_FACE:
{ {
if (myInitOffsetFace.HasImage (theS)) TopoDS_Shape aS = theS;
const TopoDS_Shape* aPlanface = myFacePlanfaceMap.Seek(aS);
if (aPlanface)
aS = TopoDS::Face(*aPlanface);
if (!myFaces.Contains (aS) &&
myInitOffsetFace.HasImage (aS))
{ {
myInitOffsetFace.LastImage (theS, myGenerated); myInitOffsetFace.LastImage (aS, myGenerated);
if (!myFaces.IsEmpty())
{
// Reverse generated shapes in case of small solids.
// Useful only for faces without influence on others.
TopTools_ListIteratorOfListOfShape it(myGenerated);
for (; it.More(); it.Next())
it.Value().Reverse();
}
} }
break; break;
} }
@ -4524,9 +4543,33 @@ const TopTools_ListOfShape& BRepOffset_MakeOffset::Generated (const TopoDS_Shape
//function : Modified //function : Modified
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopTools_ListOfShape& BRepOffset_MakeOffset::Modified (const TopoDS_Shape&) const TopTools_ListOfShape& BRepOffset_MakeOffset::Modified (const TopoDS_Shape& theShape)
{ {
myGenerated.Clear(); myGenerated.Clear();
if (theShape.ShapeType() == TopAbs_FACE)
{
TopoDS_Shape aS = theShape;
const TopoDS_Shape* aPlanface = myFacePlanfaceMap.Seek(aS);
if (aPlanface)
aS = TopoDS::Face(*aPlanface);
if (myFaces.Contains (aS) &&
myInitOffsetFace.HasImage (aS))
{
myInitOffsetFace.LastImage (aS, myGenerated);
if (!myFaces.IsEmpty())
{
// Reverse generated shapes in case of small solids.
// Useful only for faces without influence on others.
TopTools_ListIteratorOfListOfShape it(myGenerated);
for (; it.More(); it.Next())
it.Value().Reverse();
}
}
}
return myGenerated; return myGenerated;
} }

View File

@ -97,7 +97,7 @@ public:
const TopoDS_Shape& InitShape() const const TopoDS_Shape& InitShape() const
{ {
return myShape; return myInitialShape;
} }
//! returns information about offset state. //! returns information about offset state.
@ -231,6 +231,7 @@ private:
Standard_Real myOffset; Standard_Real myOffset;
Standard_Real myTol; Standard_Real myTol;
TopoDS_Shape myInitialShape;
TopoDS_Shape myShape; TopoDS_Shape myShape;
TopoDS_Compound myFaceComp; TopoDS_Compound myFaceComp;
BRepOffset_Mode myMode; BRepOffset_Mode myMode;
@ -248,8 +249,10 @@ private:
BRepAlgo_Image myInitOffsetFace; BRepAlgo_Image myInitOffsetFace;
BRepAlgo_Image myInitOffsetEdge; BRepAlgo_Image myInitOffsetEdge;
BRepAlgo_Image myImageOffset; BRepAlgo_Image myImageOffset;
BRepAlgo_Image myImageVV;
TopTools_ListOfShape myWalls; TopTools_ListOfShape myWalls;
Handle(BRepAlgo_AsDes) myAsDes; Handle(BRepAlgo_AsDes) myAsDes;
TopTools_DataMapOfShapeListOfShape myEdgeIntEdges;
Standard_Boolean myDone; Standard_Boolean myDone;
BRepOffset_Error myError; BRepOffset_Error myError;
BRepOffset_MakeLoops myMakeLoops; BRepOffset_MakeLoops myMakeLoops;

View File

@ -195,6 +195,12 @@ static
BRepOffset_DataMapOfShapeMapOfShape& theLocValidEdges, BRepOffset_DataMapOfShapeMapOfShape& theLocValidEdges,
BRepOffset_DataMapOfShapeMapOfShape& theNeutralEdges); BRepOffset_DataMapOfShapeMapOfShape& theNeutralEdges);
static
void MakeInvertedEdgesInvalid(const TopTools_ListOfShape& theLFOffset,
const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
const TopTools_MapOfShape& theInvertedEdges,
TopTools_IndexedMapOfShape& theInvEdges);
static static
void FindInvalidFaces(TopTools_ListOfShape& theLFImages, void FindInvalidFaces(TopTools_ListOfShape& theLFImages,
const TopTools_IndexedMapOfShape& theInvEdges, const TopTools_IndexedMapOfShape& theInvEdges,
@ -1030,6 +1036,10 @@ void BuildSplitsOfFaces(const TopTools_ListOfShape& theLF,
FindInvalidEdges (aLFDone, theFImages, theFacesOrigins, theAnalyse, FindInvalidEdges (aLFDone, theFImages, theFacesOrigins, theAnalyse,
theInvEdges, theValidEdges, aDMFMIE, aDMFMVE, aDMFMNE); theInvEdges, theValidEdges, aDMFMIE, aDMFMVE, aDMFMNE);
// Additional step to mark inverted edges located inside loops
// of invalid edges as invalid as well
MakeInvertedEdgesInvalid(aLFDone, theFImages, theInvertedEdges, theInvEdges);
#ifdef OFFSET_DEBUG #ifdef OFFSET_DEBUG
// show invalid edges // show invalid edges
TopoDS_Compound aCEInv1; TopoDS_Compound aCEInv1;
@ -2180,6 +2190,82 @@ void FindInvalidEdges (const TopTools_ListOfShape& theLFOffset,
} }
} }
//=======================================================================
//function : MakeInvertedEdgesInvalid
//purpose : Makes inverted edges located inside loop of invalid edges, invalid as well
//=======================================================================
void MakeInvertedEdgesInvalid(const TopTools_ListOfShape& theLFOffset,
const TopTools_IndexedDataMapOfShapeListOfShape& theFImages,
const TopTools_MapOfShape& theInvertedEdges,
TopTools_IndexedMapOfShape& theInvEdges)
{
if (theInvEdges.IsEmpty() || theInvertedEdges.IsEmpty())
return;
// Map all invalid edges
TopoDS_Compound aCBEInv;
BRep_Builder().MakeCompound(aCBEInv);
for (Standard_Integer i = 1; i <= theInvEdges.Extent(); ++i)
{
BRep_Builder().Add(aCBEInv, theInvEdges(i));
}
// Make loops of invalid edges
TopTools_ListOfShape aLCB;
BOPTools_AlgoTools::MakeConnexityBlocks(aCBEInv, TopAbs_VERTEX, TopAbs_EDGE, aLCB);
// Analyze each loop on closeness and use only closed ones
TopTools_DataMapOfShapeShape aDMVCB;
for (TopTools_ListOfShape::Iterator itLCB(aLCB); itLCB.More(); itLCB.Next())
{
const TopoDS_Shape& aCB = itLCB.Value();
TopTools_IndexedDataMapOfShapeListOfShape aDMVE;
TopExp::MapShapesAndAncestors(aCB, TopAbs_VERTEX, TopAbs_EDGE, aDMVE);
Standard_Boolean isClosed = Standard_True;
for (Standard_Integer iV = 1; iV <= aDMVE.Extent(); ++iV)
{
if (aDMVE(iV).Extent() != 2)
{
isClosed = Standard_False;
break;
}
}
if (!isClosed)
continue;
// Bind loop to each vertex of the loop
for (Standard_Integer iV = 1; iV <= aDMVE.Extent(); ++iV)
{
aDMVCB.Bind(aDMVE.FindKey(iV), aCB);
}
}
// Check if any inverted edges of offset faces are locked inside the loops of invalid edges.
// Make such edges invalid as well.
for (TopTools_ListOfShape::Iterator itLF(theLFOffset); itLF.More(); itLF.Next())
{
const TopTools_ListOfShape& aLFIm = theFImages.FindFromKey(itLF.Value());
for (TopTools_ListOfShape::Iterator itLFIm(aLFIm); itLFIm.More(); itLFIm.Next())
{
for (TopExp_Explorer expE(itLFIm.Value(), TopAbs_EDGE); expE.More(); expE.Next())
{
const TopoDS_Edge& aE = TopoDS::Edge(expE.Current());
if (!theInvEdges.Contains(aE) && theInvertedEdges.Contains(aE))
{
const TopoDS_Shape* pCB1 = aDMVCB.Seek (TopExp::FirstVertex(aE));
const TopoDS_Shape* pCB2 = aDMVCB.Seek (TopExp::LastVertex(aE));
if (pCB1 && pCB2 && pCB1->IsSame(*pCB2))
{
theInvEdges.Add(aE);
}
}
}
}
}
}
//======================================================================= //=======================================================================
//function : FindInvalidFaces //function : FindInvalidFaces
//purpose : Looking for the invalid faces by analyzing their invalid edges //purpose : Looking for the invalid faces by analyzing their invalid edges
@ -5678,7 +5764,9 @@ void IntersectFaces(const TopoDS_Shape& theFInv,
TopAbs_State aSide = TopAbs_OUT; TopAbs_State aSide = TopAbs_OUT;
TopTools_ListOfShape aLInt1, aLInt2; TopTools_ListOfShape aLInt1, aLInt2;
TopoDS_Edge aNullEdge; TopoDS_Edge aNullEdge;
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide, aNullEdge); TopoDS_Face aNullFace;
BRepOffset_Tool::Inter3D(TopoDS::Face(theFi), TopoDS::Face(theFj), aLInt1, aLInt2, aSide,
aNullEdge, aNullFace, aNullFace);
// //
if (aLInt1.IsEmpty()) { if (aLInt1.IsEmpty()) {
return; return;

View File

@ -1402,7 +1402,8 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
TopTools_ListOfShape& L2, TopTools_ListOfShape& L2,
const TopAbs_State Side, const TopAbs_State Side,
const TopoDS_Edge& RefEdge, const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined) const TopoDS_Face& theRefFace1,
const TopoDS_Face& theRefFace2)
{ {
#ifdef DRAW #ifdef DRAW
if (AffichInter) { if (AffichInter) {
@ -1445,7 +1446,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
aPF.Perform(); aPF.Perform();
TopTools_IndexedMapOfShape TrueEdges; TopTools_IndexedMapOfShape TrueEdges;
if (IsRefEdgeDefined) if (!RefEdge.IsNull())
CheckIntersFF( aPF.PDS(), RefEdge, TrueEdges ); CheckIntersFF( aPF.PDS(), RefEdge, TrueEdges );
Standard_Boolean addPCurve1 = 1; Standard_Boolean addPCurve1 = 1;
@ -1563,6 +1564,84 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface))) else if (aSurf->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
isEl2 = Standard_True; isEl2 = Standard_True;
if (L1.Extent() > 1 && (!isEl1 || !isEl2) && !theRefFace1.IsNull())
{
//remove excess edges that are out of range
TopoDS_Vertex aV1, aV2;
TopExp::Vertices (RefEdge, aV1, aV2);
if (!aV1.IsSame(aV2)) //only if RefEdge is open
{
Handle(Geom_Surface) aRefSurf1 = BRep_Tool::Surface (theRefFace1);
Handle(Geom_Surface) aRefSurf2 = BRep_Tool::Surface (theRefFace2);
if (aRefSurf1->IsUClosed() || aRefSurf1->IsVClosed() ||
aRefSurf2->IsUClosed() || aRefSurf2->IsVClosed())
{
TopoDS_Edge MinAngleEdge;
Standard_Real MinAngle = Precision::Infinite();
BRepAdaptor_Curve aRefBAcurve (RefEdge);
gp_Pnt aRefPnt = aRefBAcurve.Value ((aRefBAcurve.FirstParameter() + aRefBAcurve.LastParameter())/2);
TopTools_ListIteratorOfListOfShape itl (L1);
for (; itl.More(); itl.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (itl.Value());
BRepAdaptor_Curve aBAcurve (anEdge);
gp_Pnt aMidPntOnEdge = aBAcurve.Value ((aBAcurve.FirstParameter() + aBAcurve.LastParameter())/2);
gp_Vec RefToMid (aRefPnt, aMidPntOnEdge);
Extrema_ExtPC aProjector (aRefPnt, aBAcurve);
if (aProjector.IsDone())
{
Standard_Integer imin = 0;
Standard_Real MinSqDist = Precision::Infinite();
for (Standard_Integer ind = 1; ind <= aProjector.NbExt(); ind++)
{
Standard_Real aSqDist = aProjector.SquareDistance(ind);
if (aSqDist < MinSqDist)
{
MinSqDist = aSqDist;
imin = ind;
}
}
if (imin != 0)
{
gp_Pnt aProjectionOnEdge = aProjector.Point(imin).Value();
gp_Vec RefToProj (aRefPnt, aProjectionOnEdge);
Standard_Real anAngle = RefToProj.Angle(RefToMid);
if (anAngle < MinAngle)
{
MinAngle = anAngle;
MinAngleEdge = anEdge;
}
}
}
}
if (!MinAngleEdge.IsNull())
{
TopTools_ListIteratorOfListOfShape itlist1 (L1);
TopTools_ListIteratorOfListOfShape itlist2 (L2);
while (itlist1.More())
{
const TopoDS_Shape& anEdge = itlist1.Value();
if (anEdge.IsSame(MinAngleEdge))
{
itlist1.Next();
itlist2.Next();
}
else
{
L1.Remove(itlist1);
L2.Remove(itlist2);
}
}
}
} //if closed
} //if (!aV1.IsSame(aV2))
} //if (L1.Extent() > 1 && (!isEl1 || !isEl2) && !theRefFace1.IsNull())
if (L1.Extent() > 1 && (!isEl1 || !isEl2)) { if (L1.Extent() > 1 && (!isEl1 || !isEl2)) {
TopTools_SequenceOfShape eseq; TopTools_SequenceOfShape eseq;
TopTools_SequenceOfShape EdgesForConcat; TopTools_SequenceOfShape EdgesForConcat;
@ -1724,7 +1803,7 @@ void BRepOffset_Tool::Inter3D(const TopoDS_Face& F1,
eseq.Append( aLocalEdgesForConcat(j) ); eseq.Append( aLocalEdgesForConcat(j) );
else else
eseq.Append( AssembledEdge ); eseq.Append( AssembledEdge );
} } //for (i = 1; i <= wseq.Length(); i++)
} //end of else (when TrueEdges is empty) } //end of else (when TrueEdges is empty)
if (eseq.Length() < L1.Extent()) if (eseq.Length() < L1.Extent())
@ -3468,7 +3547,8 @@ void BRepOffset_Tool::ExtentFace (const TopoDS_Face& F,
if (ConstShapes.IsBound(E)) ToBuild.UnBind(E); if (ConstShapes.IsBound(E)) ToBuild.UnBind(E);
if (ToBuild.IsBound(E)) { if (ToBuild.IsBound(E)) {
EnLargeFace(TopoDS::Face(ToBuild(E)),StopFace,Standard_False); EnLargeFace(TopoDS::Face(ToBuild(E)),StopFace,Standard_False);
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,Standard_True); TopoDS_Face NullFace;
BRepOffset_Tool::Inter3D (EF,StopFace,LInt1,LInt2,Side,E,NullFace,NullFace);
// No intersection, it may happen for example for a chosen (non-offseted) planar face and // No intersection, it may happen for example for a chosen (non-offseted) planar face and
// its neighbour offseted cylindrical face, if the offset is directed so that // its neighbour offseted cylindrical face, if the offset is directed so that
// the radius of the cylinder becomes smaller. // the radius of the cylinder becomes smaller.

View File

@ -89,7 +89,8 @@ public:
TopTools_ListOfShape& LInt2, TopTools_ListOfShape& LInt2,
const TopAbs_State Side, const TopAbs_State Side,
const TopoDS_Edge& RefEdge, const TopoDS_Edge& RefEdge,
const Standard_Boolean IsRefEdgeDefined = Standard_False); const TopoDS_Face& RefFace1,
const TopoDS_Face& RefFace2);
//! Find if the edges <Edges> of the face <F2> are on //! Find if the edges <Edges> of the face <F2> are on
//! the face <F1>. //! the face <F1>.

View File

@ -560,6 +560,10 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
di << " -CN dx dy dz : BiNormal is given by dx dy dz\n"; di << " -CN dx dy dz : BiNormal is given by dx dy dz\n";
di << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed\n"; di << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed\n";
di << " -G guide 0|1(Plan|ACR) 0|1|2(no contact|contact|contact on border) : with guide\n"; di << " -G guide 0|1(Plan|ACR) 0|1|2(no contact|contact|contact on border) : with guide\n";
di << " -SM : Set the maximum degree of approximation\n";
di << " paramvalue more then 0 (100 by default)\n";
di << " -DM : Set the maximum number of span of approximation\n";
di << " paramvalue [1; 14] (11 by default)\n";
return 0; return 0;
} }
@ -630,6 +634,42 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
(BRepFill_TypeOfContact)KeepContact); (BRepFill_TypeOfContact)KeepContact);
} }
} }
else if (!strcmp(a[1], "-DM"))
{
if (n != 3)
{
di << "bad arguments !\n";
return 1;
}
if (Draw::Atoi(a[2]) > 0 && Draw::Atoi(a[2]) < 15)
{
Sweep->SetMaxDegree(Draw::Atoi(a[2]));
}
else
{
di << " -DM paramvalue must be [1; 14]\n";
return 1;
}
}
else if (!strcmp(a[1], "-SM"))
{
if (n != 3)
{
di << "bad arguments !\n";
return 1;
}
if (Draw::Atoi(a[2]) > 0)
{
Sweep->SetMaxSegments(Draw::Atoi(a[2]));
}
else
{
di << " -SM paramvalue must be more then 0\n";
return 1;
}
}
else { else {
di << "The option " << a[1] << " is unknown !\n"; di << "The option " << a[1] << " is unknown !\n";
@ -638,7 +678,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
return 0; return 0;
} }
//======================================================================= //=======================================================================
// addsweep // addsweep
//======================================================================= //=======================================================================
@ -985,9 +1024,9 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
theCommands.Add("errorsweep", "errorsweep: returns the summary error on resulting surfaces reached by Sweep", theCommands.Add("errorsweep", "errorsweep: returns the summary error on resulting surfaces reached by Sweep",
__FILE__, errorsweep, g); __FILE__, errorsweep, g);
theCommands.Add("simulsweep", "simulsweep r [n] [option]" theCommands.Add("simulsweep", "simulsweep r [n] [option]",
__FILE__, simulsweep, g); __FILE__, simulsweep, g);
theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]" theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]",
__FILE__, geompipe, g); __FILE__, geompipe, g);
theCommands.Add("middlepath", "middlepath res shape startshape endshape", theCommands.Add("middlepath", "middlepath res shape startshape endshape",

View File

@ -1780,10 +1780,12 @@ void BiTgte_Blend::ComputeCenters()
} }
} }
} }
TopTools_DataMapOfShapeListOfShape anEmptyMap;
BRepOffset_Inter2d::Compute(myAsDes, BRepOffset_Inter2d::Compute(myAsDes,
CurOF, CurOF,
myEdges, myEdges,
myTol, myTol,
anEmptyMap,
aDMVV); aDMVV);
} }
} }
@ -1813,20 +1815,23 @@ void BiTgte_Blend::ComputeCenters()
myAsDes->Add(CurOF,CurOE); myAsDes->Add(CurOF,CurOE);
} }
TopTools_DataMapOfShapeListOfShape anEmptyMap;
BRepOffset_Inter2d::Compute(myAsDes, BRepOffset_Inter2d::Compute(myAsDes,
CurOF, CurOF,
myEdges, myEdges,
myTol, myTol,
anEmptyMap,
aDMVV); aDMVV);
} }
// //
// fuse vertices on edges stored in AsDes // fuse vertices on edges stored in AsDes
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes); BRepAlgo_Image anEmptyImage;
BRepOffset_Inter2d::FuseVertices(aDMVV, myAsDes, anEmptyImage);
// ------------ // ------------
// unwinding // unwinding
// ------------ // ------------
BRepOffset_MakeLoops MakeLoops; BRepOffset_MakeLoops MakeLoops;
MakeLoops.Build( LOF, myAsDes, myImageOffset ); MakeLoops.Build (LOF, myAsDes, myImageOffset, anEmptyImage);
// ------------------------------------------------------------ // ------------------------------------------------------------
// It is possible to unwind edges at least one ancestor which of // It is possible to unwind edges at least one ancestor which of

View File

@ -142,9 +142,9 @@ ChFiDS_TypeOfConcavity ChFi3d::DefineConnectType(const TopoDS_Edge& E,
Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge, Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
const TopoDS_Face& theFace1, const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2, const TopoDS_Face& theFace2,
const GeomAbs_Shape Order) const GeomAbs_Shape theOrder)
{ {
if (Order == GeomAbs_G1 && BRep_Tool::Continuity(theEdge, theFace1, theFace2) != GeomAbs_C0) if (theOrder == GeomAbs_G1 && BRep_Tool::Continuity(theEdge, theFace1, theFace2) != GeomAbs_C0)
return Standard_True; return Standard_True;
Standard_Real TolC0 = Max(0.001, 1.5*BRep_Tool::Tolerance(theEdge)); Standard_Real TolC0 = Max(0.001, 1.5*BRep_Tool::Tolerance(theEdge));
@ -152,15 +152,46 @@ Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
Standard_Real aFirst; Standard_Real aFirst;
Standard_Real aLast; Standard_Real aLast;
Handle(Geom2d_Curve) aC2d1, aC2d2;
if (!theFace1.IsSame (theFace2) &&
BRep_Tool::IsClosed (theEdge, theFace1) &&
BRep_Tool::IsClosed (theEdge, theFace2))
{
//Find the edge in the face 1: this edge will have correct orientation
TopoDS_Edge anEdgeInFace1;
TopoDS_Face aFace1 = theFace1;
aFace1.Orientation (TopAbs_FORWARD);
TopExp_Explorer anExplo (aFace1, TopAbs_EDGE);
for (; anExplo.More(); anExplo.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anExplo.Current());
if (anEdge.IsSame (theEdge))
{
anEdgeInFace1 = anEdge;
break;
}
}
if (anEdgeInFace1.IsNull())
return Standard_False;
aC2d1 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace1, aFirst, aLast);
TopoDS_Face aFace2 = theFace2;
aFace2.Orientation (TopAbs_FORWARD);
anEdgeInFace1.Reverse();
aC2d2 = BRep_Tool::CurveOnSurface (anEdgeInFace1, aFace2, aFirst, aLast);
}
else
{
// Obtaining of pcurves of edge on two faces. // Obtaining of pcurves of edge on two faces.
const Handle(Geom2d_Curve) aC2d1 = BRep_Tool::CurveOnSurface aC2d1 = BRep_Tool::CurveOnSurface (theEdge, theFace1, aFirst, aLast);
(theEdge, theFace1, aFirst, aLast);
//For the case of seam edge //For the case of seam edge
TopoDS_Edge EE = theEdge; TopoDS_Edge EE = theEdge;
if (theFace1.IsSame(theFace2)) if (theFace1.IsSame(theFace2))
EE.Reverse(); EE.Reverse();
const Handle(Geom2d_Curve) aC2d2 = BRep_Tool::CurveOnSurface aC2d2 = BRep_Tool::CurveOnSurface (EE, theFace2, aFirst, aLast);
(EE, theFace2, aFirst, aLast); }
if (aC2d1.IsNull() || aC2d2.IsNull()) if (aC2d1.IsNull() || aC2d2.IsNull())
return Standard_False; return Standard_False;
@ -191,15 +222,19 @@ Standard_Boolean ChFi3d::IsTangentFaces(const TopoDS_Edge& theEdge,
if (i == aNbSamples) aPar = aLast; if (i == aNbSamples) aPar = aLast;
LocalAnalysis_SurfaceContinuity aCont(aC2d1, aC2d2, aPar, LocalAnalysis_SurfaceContinuity aCont(aC2d1, aC2d2, aPar,
aSurf1, aSurf2, Order, aSurf1, aSurf2, theOrder,
0.001, TolC0, 0.1, 0.1, 0.1); 0.001, TolC0, 0.1, 0.1, 0.1);
if (!aCont.IsDone()) if (!aCont.IsDone())
{ {
if (theOrder == GeomAbs_C2 &&
aCont.StatusError() == LocalAnalysis_NullSecondDerivative)
continue;
nbNotDone++; nbNotDone++;
continue; continue;
} }
if (Order == GeomAbs_G1) if (theOrder == GeomAbs_G1)
{ {
if (!aCont.IsG1()) if (!aCont.IsG1())
return Standard_False; return Standard_False;

View File

@ -208,12 +208,13 @@ Standard_Integer Extrema_FuncExtCS::GetStateNumber()
std::cout <<"F(1)= "<<Sol(1)<<" F(2)= "<<Sol(2)<<" F(3)= "<<Sol(3)<<std::endl; std::cout <<"F(1)= "<<Sol(1)<<" F(2)= "<<Sol(2)<<" F(3)= "<<Sol(3)<<std::endl;
#endif #endif
//comparison of solution with previous solutions //comparison of solution with previous solutions
Standard_Real tol2d = Precision::PConfusion() * Precision::PConfusion(); Standard_Real tol2d = Precision::SquarePConfusion();
Standard_Integer i = 1, nbSol = mySqDist.Length(); Standard_Integer i = 1, nbSol = mySqDist.Length();
for( ; i <= nbSol; i++) for( ; i <= nbSol; i++)
{ {
Standard_Real aT = myPoint1(i).Parameter(); Standard_Real aT = myPoint1(i).Parameter();
if( (myt - aT) * (myt - aT) <= tol2d ) aT -= myt; aT *= aT;
if( aT <= tol2d )
break; break;
} }
if (i <= nbSol) if (i <= nbSol)

View File

@ -84,14 +84,21 @@ public:
//! Return the Nth extremum on S. //! Return the Nth extremum on S.
Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const; Standard_EXPORT const Extrema_POnSurf& PointOnSurface (const Standard_Integer N) const;
//! Change Sequence of SquareDistance
TColStd_SequenceOfReal& SquareDistances()
{
protected: return mySqDist;
}
//! Change Sequence of PointOnCurv
Extrema_SequenceOfPOnCurv& PointsOnCurve()
{
return myPoint1;
}
//! Change Sequence of PointOnSurf
Extrema_SequenceOfPOnSurf& PointsOnSurf()
{
return myPoint2;
}
private: private:

View File

@ -38,6 +38,8 @@
#include <TColgp_Array1OfPnt.hxx> #include <TColgp_Array1OfPnt.hxx>
#include <Geom_TrimmedCurve.hxx> #include <Geom_TrimmedCurve.hxx>
#include <ElCLib.hxx> #include <ElCLib.hxx>
#include <Extrema_GenLocateExtPS.hxx>
const Standard_Real MaxParamVal = 1.0e+10; const Standard_Real MaxParamVal = 1.0e+10;
const Standard_Real aBorderDivisor = 1.0e+4; const Standard_Real aBorderDivisor = 1.0e+4;
@ -304,17 +306,31 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
Tol(2) = mytol2; Tol(2) = mytol2;
Tol(3) = mytol2; Tol(3) = mytol2;
// //
TUVinf(1) = mytmin; // Number of particles used in PSO algorithm (particle swarm optimization).
const Standard_Integer aNbParticles = 48;
Standard_Integer aNbIntC = 1;
if (C.IsClosed() || C.IsPeriodic())
{
Standard_Real aPeriod = C.Period();
if (C.LastParameter() - C.FirstParameter() > 2. * aPeriod / 3.)
{
aNbIntC = 2;
}
}
Standard_Integer anInt;
Standard_Real dT = (mytsup - mytmin) / aNbIntC;
for (anInt = 1; anInt <= aNbIntC; anInt++)
{
TUVinf(1) = mytmin + (anInt - 1) * dT;
TUVinf(2) = trimumin; TUVinf(2) = trimumin;
TUVinf(3) = trimvmin; TUVinf(3) = trimvmin;
// //
TUVsup(1) = mytsup; TUVsup(1) = TUVinf(1) + dT; // mytsup;
TUVsup(2) = trimusup; TUVsup(2) = trimusup;
TUVsup(3) = trimvsup; TUVsup(3) = trimvsup;
// //
// Number of particles used in PSO algorithm (particle swarm optimization).
const Standard_Integer aNbParticles = 48;
//
if (aNbVar == 3) if (aNbVar == 3)
{ {
GlobMinGenCS(C, aNbParticles, TUVinf, TUVsup, TUV); GlobMinGenCS(C, aNbParticles, TUVinf, TUVsup, TUV);
@ -331,8 +347,44 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
// Find min approximation // Find min approximation
math_FunctionSetRoot anA(myF, Tol); math_FunctionSetRoot anA(myF, Tol);
anA.Perform(myF, TUV, TUVinf, TUVsup); anA.Perform(myF, TUV, TUVinf, TUVsup);
}
if (aNbIntC > 1 && myF.NbExt() > 1)
{
//Try to remove "false" extrema caused by dividing curve interval
TColStd_SequenceOfReal& aSqDists = myF.SquareDistances();
Extrema_SequenceOfPOnCurv& aPntsOnCrv = myF.PointsOnCurve();
Extrema_SequenceOfPOnSurf& aPntsOnSurf = myF.PointsOnSurf();
TColStd_SequenceOfReal aSqDists1(aSqDists);
Extrema_SequenceOfPOnCurv aPntsOnCrv1(aPntsOnCrv);
Extrema_SequenceOfPOnSurf aPntsOnSurf1(aPntsOnSurf);
Standard_Real aMinDist = aSqDists(1);
Standard_Integer i;
for (i = 2; i <= aSqDists.Length(); ++i)
{
Standard_Real aDist = aSqDists(i);
if (aDist < aMinDist)
{
aMinDist = aDist;
}
}
aSqDists.Clear();
aPntsOnCrv.Clear();
aPntsOnSurf.Clear();
Standard_Real aTol = Precision::SquareConfusion();
for (i = 1; i <= aSqDists1.Length(); ++i)
{
Standard_Real aDist = aSqDists1(i);
if (Abs(aDist - aMinDist) <= aTol)
{
aSqDists.Append(aDist);
aPntsOnCrv.Append(aPntsOnCrv1(i));
aPntsOnSurf.Append(aPntsOnSurf1(i));
}
}
}
myDone = Standard_True; myDone = Standard_True;
} }
//======================================================================= //=======================================================================
//function : GlobMinGenCS //function : GlobMinGenCS
@ -447,6 +499,7 @@ void Extrema_GenExtCS::GlobMinConicS(const Adaptor3d_Curve& theC,
anUVsup(i) = theTUVsup(i + 1); anUVsup(i) = theTUVsup(i + 1);
} }
// //
//
math_PSOParticlesPool aParticles(theNbParticles, aNbVar); math_PSOParticlesPool aParticles(theNbParticles, aNbVar);
math_Vector aMinUV(1, aNbVar); math_Vector aMinUV(1, aNbVar);
@ -517,10 +570,103 @@ void Extrema_GenExtCS::GlobMinConicS(const Adaptor3d_Curve& theC,
aCT = ElCLib::InPeriod(aCT, theTUVinf(1), theTUVinf(1) + 2. * M_PI); aCT = ElCLib::InPeriod(aCT, theTUVinf(1), theTUVinf(1) + 2. * M_PI);
} }
} }
theTUV(1) = aCT; theTUV(1) = aCT;
theTUV(2) = anUV(1); theTUV(2) = anUV(1);
theTUV(3) = anUV(2); theTUV(3) = anUV(2);
Standard_Boolean isBadSol = Standard_False;
gp_Vec aDU, aDV, aDT;
gp_Pnt aPOnS, aPOnC;
myS->D1(anUV(1), anUV(2), aPOnS, aDU, aDV);
theC.D1(aCT, aPOnC, aDT);
Standard_Real aSqDist = aPOnC.SquareDistance(aPOnS);
if (aSqDist <= Precision::SquareConfusion())
return;
gp_Vec aN = aDU.Crossed(aDV);
if (aN.SquareMagnitude() < Precision::SquareConfusion())
return;
gp_Vec PcPs(aPOnC, aPOnS);
Standard_Real anAngMin = M_PI_2 - M_PI_2 / 10.;
Standard_Real anAngMax = M_PI_2 + M_PI_2 / 10.;
Standard_Real anAngN = PcPs.Angle(aN);
if (anAngN >= anAngMin && anAngN <= anAngMax)
{
// PcPs is perpendicular to surface normal, it means that
// aPOnC can be on surface, but far from aPOnS
isBadSol = Standard_True;
Standard_Integer iu, iv;
for (iu = -1; iu <= 1; ++iu)
{
Standard_Real u = anUV(1) + iu * aStepSU;
u = Max(anUVinf(1), u);
u = Min(anUVsup(1), u);
for (iv = -1; iv <= 1; ++iv)
{
Standard_Real v = anUV(2) + iv * aStepSV;
v = Max(anUVinf(2), v);
v = Min(anUVsup(2), v);
myS->D1(u, v, aPOnS, aDU, aDV);
if (aPOnC.SquareDistance(aPOnS) < Precision::SquareConfusion())
{
isBadSol = Standard_False;
break;
}
aN = aDU.Crossed(aDV);
if (aN.SquareMagnitude() < Precision::SquareConfusion())
{
isBadSol = Standard_False;
break;
}
PcPs.SetXYZ(aPOnS.XYZ() - aPOnC.XYZ());
anAngN = PcPs.Angle(aN);
if (anAngN < anAngMin || anAngN > anAngMax)
{
isBadSol = Standard_False;
break;
}
}
if (!isBadSol)
{
break;
}
}
}
if (isBadSol)
{
//Try to precise solution with help of Extrema PS
math_Vector aF(1, 3);
aF(1) = PcPs.Dot(aDT);
aF(2) = PcPs.Dot(aDU);
aF(3) = PcPs.Dot(aDV);
Standard_Real aFF = aF.Norm2();
Extrema_GenLocateExtPS anExtPS(*myS, mytol2, mytol2);
anExtPS.Perform(aPOnC, anUV(1), anUV(2), Standard_False);
if (anExtPS.IsDone())
{
const Extrema_POnSurf& aPmin = anExtPS.Point();
aPmin.Parameter(anUV(1), anUV(2));
math_Vector aTUV = theTUV;
aTUV(2) = anUV(1);
aTUV(3) = anUV(2);
myF.Value(aTUV, aF);
Standard_Real aFF1 = aF.Norm2();
if (anExtPS.SquareDistance() < aSqDist && aFF1 <= 1.1 * aFF)
{
theTUV(2) = aTUV(2);
theTUV(3) = aTUV(3);
}
}
}
} }
//======================================================================= //=======================================================================
//function : GlobMinCQuadric //function : GlobMinCQuadric

View File

@ -882,7 +882,7 @@ Standard_Real GeomFill_CorrectedFrenet::GetAngleAT(const Standard_Real Param) co
frenet->Intervals(FrenetInt, S); frenet->Intervals(FrenetInt, S);
EvolAroundT->Intervals(LawInt, S); EvolAroundT->Intervals(LawInt, S);
GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion); GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion, Precision::PConfusion(), Standard_True);
return Fusion.Length()-1; return Fusion.Length()-1;
} }
@ -913,7 +913,7 @@ Standard_Real GeomFill_CorrectedFrenet::GetAngleAT(const Standard_Real Param) co
frenet->Intervals(FrenetInt, S); frenet->Intervals(FrenetInt, S);
EvolAroundT->Intervals(LawInt, S); EvolAroundT->Intervals(LawInt, S);
GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion); GeomLib::FuseIntervals(FrenetInt, LawInt, Fusion, Precision::PConfusion(), Standard_True);
for(Standard_Integer i = 1; i <= Fusion.Length(); i++) for(Standard_Integer i = 1; i <= Fusion.Length(); i++)
T.ChangeValue(i) = Fusion.Value(i); T.ChangeValue(i) = Fusion.Value(i);

View File

@ -692,7 +692,7 @@ Standard_Boolean
myCurve->Intervals(TrimInt, tmpS); myCurve->Intervals(TrimInt, tmpS);
TColStd_SequenceOfReal Fusion; TColStd_SequenceOfReal Fusion;
GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion); GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion, Precision::PConfusion(), Standard_True);
return Fusion.Length() - 1; return Fusion.Length() - 1;
} }
@ -726,7 +726,7 @@ Standard_Boolean
myCurve->Intervals(TrimInt, tmpS); myCurve->Intervals(TrimInt, tmpS);
TColStd_SequenceOfReal Fusion; TColStd_SequenceOfReal Fusion;
GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion); GeomLib::FuseIntervals(TrimInt, mySngl->Array1(), Fusion, Precision::PConfusion(), Standard_True);
for (Standard_Integer i = 1; i <= Fusion.Length(); i++) for (Standard_Integer i = 1; i <= Fusion.Length(); i++)
T.ChangeValue(i) = Fusion.Value(i); T.ChangeValue(i) = Fusion.Value(i);

View File

@ -415,7 +415,8 @@ void GeomLib::DensifyArray1OfReal(const Standard_Integer MinNumPoints,
void GeomLib::FuseIntervals(const TColStd_Array1OfReal& I1, void GeomLib::FuseIntervals(const TColStd_Array1OfReal& I1,
const TColStd_Array1OfReal& I2, const TColStd_Array1OfReal& I2,
TColStd_SequenceOfReal& Seq, TColStd_SequenceOfReal& Seq,
const Standard_Real Epspar) const Standard_Real Epspar,
const Standard_Boolean IsAdjustToFirstInterval)
{ {
Standard_Integer ind1=1, ind2=1; Standard_Integer ind1=1, ind2=1;
Standard_Real v1, v2; Standard_Real v1, v2;
@ -432,7 +433,14 @@ void GeomLib::FuseIntervals(const TColStd_Array1OfReal& I1,
v2 = I2(ind2); v2 = I2(ind2);
if (Abs(v1-v2)<= Epspar) { if (Abs(v1-v2)<= Epspar) {
// Ici les elements de I1 et I2 conviennent . // Ici les elements de I1 et I2 conviennent .
Seq.Append((v1+v2)/2); if (IsAdjustToFirstInterval)
{
Seq.Append(v1);
}
else
{
Seq.Append((v1 + v2) / 2);
}
ind1++; ind1++;
ind2++; ind2++;
} }

View File

@ -170,7 +170,19 @@ public:
//! non decreasing //! non decreasing
Standard_EXPORT static void DensifyArray1OfReal (const Standard_Integer MinNumPoints, const TColStd_Array1OfReal& InParameters, Handle(TColStd_HArray1OfReal)& OutParameters); Standard_EXPORT static void DensifyArray1OfReal (const Standard_Integer MinNumPoints, const TColStd_Array1OfReal& InParameters, Handle(TColStd_HArray1OfReal)& OutParameters);
Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1, const TColStd_Array1OfReal& Interval2, TColStd_SequenceOfReal& Fusion, const Standard_Real Confusion = 1.0e-9); //! This method fuse intervals Interval1 and Interval2 with specified Confusion
//! @param Interval1 [in] first interval to fuse
//! @param Interval2 [in] second interval to fuse
//! @param Confision [in] tolerance to compare intervals
//! @param IsAdjustToFirstInterval [in] flag to set method of fusion, if intervals are close
//! if false, intervals are fusing by half-division methdod
//! if true, intervals are fusing by selecting value from Interval1
//! @param Fusion [out] output interval
Standard_EXPORT static void FuseIntervals (const TColStd_Array1OfReal& Interval1,
const TColStd_Array1OfReal& Interval2,
TColStd_SequenceOfReal& Fusion,
const Standard_Real Confusion = 1.0e-9,
const Standard_Boolean IsAdjustToFirstInterval = Standard_False);
//! this will compute the maximum distance at the //! this will compute the maximum distance at the
//! parameters given in the Parameters array by //! parameters given in the Parameters array by

View File

@ -676,6 +676,10 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
IntPatch_Point aLVtx = theALine->Vertex(i); IntPatch_Point aLVtx = theALine->Vertex(i);
aLVtx.SetValue(aVertP2S); aLVtx.SetValue(aVertP2S);
aLVtx.SetTolerance(aVertToler); aLVtx.SetTolerance(aVertToler);
Standard_Real aParam = aLVtx.ParameterOnLine();
if (Abs(aParam - theLPar) <= Precision::PConfusion()) //in the case of closed curve,
aLVtx.SetParameter(-1); //we don't know yet the number of points in the curve
else
aLVtx.SetParameter(aNewVertexParam); aLVtx.SetParameter(aNewVertexParam);
aSeqVertex(++aNewVertID) = aLVtx; aSeqVertex(++aNewVertID) = aLVtx;
hasVertexBeenChecked(i) = Standard_True; hasVertexBeenChecked(i) = Standard_True;
@ -748,7 +752,9 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
for(Standard_Integer i = aSeqVertex.Lower(); i <= aNewVertID; i++) for(Standard_Integer i = aSeqVertex.Lower(); i <= aNewVertID; i++)
{ {
const IntPatch_Point& aVtx = aSeqVertex(i); IntPatch_Point aVtx = aSeqVertex(i);
if (aVtx.ParameterOnLine() == -1) //in the case of closed curve,
aVtx.SetParameter (aWLine->NbPnts()); //we set the last parameter
aWLine->AddVertex(aVtx); aWLine->AddVertex(aVtx);
} }

View File

@ -178,6 +178,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
#ifdef CHRONO #ifdef CHRONO
Chronrsnld.Stop(); Chronrsnld.Stop();
#endif #endif
Standard_Boolean isOnDegeneratedBorder = Standard_False;
if (Cadre) { // update of limits. if (Cadre) { // update of limits.
BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM; BornInf(1) = Um;BornSup(1) = UM;BornInf(2) = Vm;BornSup(2) = VM;
@ -262,6 +263,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
/ (uv[aCoordIdx - 1] - uvprev[aCoordIdx - 1]) ); / (uv[aCoordIdx - 1] - uvprev[aCoordIdx - 1]) );
Standard_Integer aFixIdx = aCoordIdx == 1? 2 : 1; // Fixing index; Standard_Integer aFixIdx = aCoordIdx == 1? 2 : 1; // Fixing index;
Uvap(aFixIdx) = uv[aFixIdx - 1] + (uv[aFixIdx - 1] - uvprev[aFixIdx - 1]) * aScaleCoeff; Uvap(aFixIdx) = uv[aFixIdx - 1] + (uv[aFixIdx - 1] - uvprev[aFixIdx - 1]) * aScaleCoeff;
isOnDegeneratedBorder = Standard_True;
} }
} }
} }
@ -307,6 +309,8 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
if (N <= 0) { // jag 941017 if (N <= 0) { // jag 941017
MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol); MakeWalkingPoint(2,Uvap(1),Uvap(2),Func,Psol);
Tgtend = Func.IsTangent(); // jag 940616 Tgtend = Func.IsTangent(); // jag 940616
if (isOnDegeneratedBorder)
Tgtend = Standard_True;
N = -N; N = -N;
} }
Arrive = (wd2[I].etat == 12); // the line is open Arrive = (wd2[I].etat == 12); // the line is open
@ -315,6 +319,9 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
aStatus = TestDeflection(Func, Arrive,Uvap,StatusPrecedent, aStatus = TestDeflection(Func, Arrive,Uvap,StatusPrecedent,
NbDivision,PasC,StepSign); NbDivision,PasC,StepSign);
if (isOnDegeneratedBorder && Tgtend)
aStatus = IntWalk_ArretSurPoint;
StatusPrecedent = aStatus; StatusPrecedent = aStatus;
if (aStatus == IntWalk_PasTropGrand) {// division of the step if (aStatus == IntWalk_PasTropGrand) {// division of the step
Arrive = Standard_False; Arrive = Standard_False;
@ -379,6 +386,9 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
StepSign = -1; StepSign = -1;
StatusPrecedent = IntWalk_OK; StatusPrecedent = IntWalk_OK;
PasC = PasSav; PasC = PasSav;
//Check if <Psol> has been really updated
if (Arrive || Rajout || (!ArretAjout && Cadre && SaveN <= 0))
{
if (aStatus == IntWalk_ArretSurPointPrecedent) { if (aStatus == IntWalk_ArretSurPointPrecedent) {
CurrentLine->AddPoint(Psol); CurrentLine->AddPoint(Psol);
OpenLine(0,Psol,Pnts1,Func,CurrentLine); OpenLine(0,Psol,Pnts1,Func,CurrentLine);
@ -386,6 +396,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
else { else {
OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine); OpenLine(-lines.Length()-1,Psol,Pnts1,Func,CurrentLine);
} }
}
//Remove <SaveN> from <seqAlone> and, if it is first found point, //Remove <SaveN> from <seqAlone> and, if it is first found point,
//from <seqAjout> too //from <seqAjout> too
if (IsValidEndPoint(I, SaveN)) if (IsValidEndPoint(I, SaveN))

View File

@ -1246,7 +1246,9 @@ void ProjLib_ComputeApprox::Perform
//Return curve home //Return curve home
Standard_Real UFirst = F.FirstParameter(); Standard_Real UFirst = F.FirstParameter();
gp_Pnt P3d = C->Value( UFirst ); Standard_Real ULast = F.LastParameter();
Standard_Real Umid = (UFirst + ULast)/2;
gp_Pnt P3d = C->Value (Umid);
Standard_Real u = 0., v = 0.; Standard_Real u = 0., v = 0.;
switch (SType) switch (SType)
{ {
@ -1301,7 +1303,7 @@ void ProjLib_ComputeApprox::Perform
if (F.UCouture || (F.VCouture && SType == GeomAbs_Sphere)) if (F.UCouture || (F.VCouture && SType == GeomAbs_Sphere))
{ {
Standard_Real aNbPer; Standard_Real aNbPer;
gp_Pnt2d P2d = F.Value(UFirst); gp_Pnt2d P2d = F.Value (Umid);
du = u - P2d.X(); du = u - P2d.X();
du = (du < 0) ? (du - Precision::PConfusion()) : du = (du < 0) ? (du - Precision::PConfusion()) :
(du + Precision::PConfusion()); (du + Precision::PConfusion());

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <Geom_Plane.hxx> #include <Geom_Plane.hxx>
#include <Precision.hxx> #include <Precision.hxx>
class ShapeBuild_ReShape; class ShapeBuild_ReShape;
@ -64,6 +65,13 @@ DEFINE_STANDARD_HANDLE(ShapeUpgrade_UnifySameDomain, Standard_Transient)
//! The algorithm provides a place holder for the history and collects the //! The algorithm provides a place holder for the history and collects the
//! history by default. //! history by default.
//! To avoid collecting of the history the place holder should be set to null handle. //! To avoid collecting of the history the place holder should be set to null handle.
struct SubSequenceOfEdges
{
TopTools_SequenceOfShape SeqsEdges;
TopoDS_Edge UnionEdges;
};
class ShapeUpgrade_UnifySameDomain : public Standard_Transient class ShapeUpgrade_UnifySameDomain : public Standard_Transient
{ {
@ -164,7 +172,29 @@ protected:
Standard_EXPORT void UnifyEdges(); Standard_EXPORT void UnifyEdges();
void IntUnifyFaces(const TopoDS_Shape& theInpShape, void IntUnifyFaces(const TopoDS_Shape& theInpShape,
TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces); TopTools_IndexedDataMapOfShapeListOfShape& theGMapEdgeFaces,
const TopTools_MapOfShape& theFreeBoundMap);
//! Splits the sequence of edges into the sequence of chains
Standard_Boolean MergeEdges(TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
NCollection_Sequence<SubSequenceOfEdges>& SeqOfSubSeqOfEdges,
const TopTools_MapOfShape& NonMergVrt);
//! Tries to unify the sequence of edges with the set of
//! another edges which lies on the same geometry
Standard_Boolean MergeSeq(TopTools_SequenceOfShape& SeqEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
const TopTools_MapOfShape& nonMergVert);
//! Merges a sequence of edges into one edge if possible
Standard_Boolean MergeSubSeq(const TopTools_SequenceOfShape& theChain,
const TopTools_IndexedDataMapOfShapeListOfShape& theVFmap,
TopoDS_Edge& OutEdge);
//! Unifies the pcurve of the chain into one pcurve of the edge
void UnionPCurves(const TopTools_SequenceOfShape& theChain,
TopoDS_Edge& theEdge);
//! Fills the history of the modifications during the operation. //! Fills the history of the modifications during the operation.
Standard_EXPORT void FillHistory(); Standard_EXPORT void FillHistory();
@ -183,6 +213,8 @@ private:
Handle(ShapeBuild_ReShape) myContext; Handle(ShapeBuild_ReShape) myContext;
TopTools_MapOfShape myKeepShapes; TopTools_MapOfShape myKeepShapes;
DataMapOfFacePlane myFacePlaneMap; DataMapOfFacePlane myFacePlaneMap;
TopTools_IndexedDataMapOfShapeListOfShape myEFmap;
TopTools_DataMapOfShapeShape myFaceNewFace;
Handle(BRepTools_History) myHistory; //!< The history. Handle(BRepTools_History) myHistory; //!< The history.
}; };

View File

@ -155,12 +155,21 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
//! Registers this callback object in the current error handler (if found). //! Registers this callback object in the current error handler (if found).
#if defined(OCC_CONVERT_SIGNALS)
Standard_EXPORT
#endif
void RegisterCallback(); void RegisterCallback();
//! Unregisters this callback object from the error handler. //! Unregisters this callback object from the error handler.
#if defined(OCC_CONVERT_SIGNALS)
Standard_EXPORT
#endif
void UnregisterCallback(); void UnregisterCallback();
//! Destructor //! Destructor
#if defined(OCC_CONVERT_SIGNALS)
Standard_EXPORT
#endif
virtual ~Callback(); virtual ~Callback();
//! The callback function to perform necessary callback action. //! The callback function to perform necessary callback action.
@ -171,6 +180,9 @@ public:
protected: protected:
//! Empty constructor //! Empty constructor
#if defined(OCC_CONVERT_SIGNALS)
Standard_EXPORT
#endif
Callback(); Callback();
private: private:

View File

@ -35,19 +35,20 @@
// Primary definitions // Primary definitions
#define OCC_VERSION_MAJOR 7 #define OCC_VERSION_MAJOR 7
#define OCC_VERSION_MINOR 5 #define OCC_VERSION_MINOR 5
#define OCC_VERSION_MAINTENANCE 0 #define OCC_VERSION_MAINTENANCE 3
//! This macro must be commented in official release, and set to non-empty //! This macro must be commented in official release, and set to non-empty
//! string in other situations, to identify specifics of the version, e.g.: //! string in other situations, to identify specifics of the version, e.g.:
//! - "dev" for development version between releases //! - "dev" for development version between releases
//! - "beta..." or "rc..." for beta releases or release candidates //! - "beta..." or "rc..." for beta releases or release candidates
//! - "project..." for version containing project-specific fixes //! - "project..." for version containing project-specific fixes
//#define OCC_VERSION_DEVELOPMENT "beta" //#define OCC_VERSION_DEVELOPMENT "dev"
#define OCC_VERSION_SERVICEPACK 2
// Derived (manually): version as real and string (major.minor) // Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.5 #define OCC_VERSION 7.5
#define OCC_VERSION_STRING "7.5" #define OCC_VERSION_STRING "7.5"
#define OCC_VERSION_COMPLETE "7.5.0" #define OCC_VERSION_COMPLETE "7.5.3"
//! Derived: extended version as string ("major.minor.maintenance.dev") //! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT #ifdef OCC_VERSION_DEVELOPMENT

View File

@ -186,9 +186,11 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
Handle(StepGeom_Curve) Gpms; Handle(StepGeom_Curve) Gpms;
Handle(Geom_Curve) C = CA.Curve().Curve(); Handle(Geom_Curve) C = CA.Curve().Curve();
if (!C.IsNull()) { if (!C.IsNull()) {
C = Handle(Geom_Curve)::DownCast(C->Copy()); C = Handle(Geom_Curve)::DownCast(C->Copy());
gp_Trsf Tr1 = CA.Trsf();
C->Transform(Tr1);
// Special treatment is needed for very short edges based on periodic curves. // Special treatment is needed for very short edges based on periodic curves.
// Since edge in STEP does not store its parametric range, parameters are computed // Since edge in STEP does not store its parametric range, parameters are computed
// on import by projecting vertices on a curve, and for periodic curve this may // on import by projecting vertices on a curve, and for periodic curve this may
@ -246,8 +248,7 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
} }
} }
gp_Trsf Tr1 = CA.Trsf();
C->Transform(Tr1);
GeomToStep_MakeCurve MkCurve(C); GeomToStep_MakeCurve MkCurve(C);
Gpms = MkCurve.Value(); Gpms = MkCurve.Value();
} }

View File

@ -197,8 +197,8 @@ void TopoDSToStep_MakeStepWire::Init(const TopoDS_Wire& aWire,
//#11 ItW.Init(ForwardWire, aTool.CurrentFace()); //#11 ItW.Init(ForwardWire, aTool.CurrentFace());
//#11 for (;ItW.More();ItW.Next()) { //#11 for (;ItW.More();ItW.Next()) {
Handle(ShapeFix_Wire) STW = new ShapeFix_Wire; Handle(ShapeFix_Wire) STW =
STW->Load (ForwardWire); new ShapeFix_Wire(ForwardWire, aTool.CurrentFace(), Precision::Confusion());
STW->FixReorder(); STW->FixReorder();
Handle(ShapeExtend_WireData) sbwd = STW->WireData(); Handle(ShapeExtend_WireData) sbwd = STW->WireData();
Standard_Integer nb = sbwd->NbEdges(); Standard_Integer nb = sbwd->NbEdges();

View File

@ -32,7 +32,7 @@ CheckIsFeatureRemoved feature3 {v e f}
removefeatures res5 s feature4 removefeatures res5 s feature4
checkshape res5 checkshape res5
checkprops res5 -s 2387.67 -v 1060.67 -deps 1.e-7 checkprops res5 -s 2387.67 -v 1060.68 -deps 1.e-7
checknbshapes res5 -vertex 67 -edge 100 -wire 35 -face 35 -shell 1 -solid 1 -t checknbshapes res5 -vertex 67 -edge 100 -wire 35 -face 35 -shell 1 -solid 1 -t
CheckIsFeatureRemoved feature4 {v e f} CheckIsFeatureRemoved feature4 {v e f}

View File

@ -10,6 +10,6 @@ compound s_2 s_25 s_1 s_4 feature
removefeatures result s feature removefeatures result s feature
checkshape result checkshape result
checkprops result -s 2392.41 -v 1063.75 -deps 1.e-7 checkprops result -s 2392.42 -v 1063.76 -deps 1.e-7
checknbshapes result -vertex 61 -edge 91 -wire 34 -face 33 -shell 1 -solid 1 checknbshapes result -vertex 61 -edge 91 -wire 34 -face 33 -shell 1 -solid 1
CheckIsFeatureRemoved feature {e f} CheckIsFeatureRemoved feature {e f}

View File

@ -8,7 +8,7 @@ compound s_11 s_12 s_17 gap2
removefeatures res1 s gap1 removefeatures res1 s gap1
checkshape res1 checkshape res1
checkprops res1 -s 1200 -v 1875 checkprops res1 -s 1200 -v 1875
checknbshapes res1 -vertex 21 -edge 35 -wire 17 -face 17 -shell 2 -solid 2 checknbshapes res1 -vertex 19 -edge 31 -wire 15 -face 15 -shell 2 -solid 2
CheckIsFeatureRemoved gap1 {e f} CheckIsFeatureRemoved gap1 {e f}
# check that the common face is still shared # check that the common face is still shared
@ -32,7 +32,7 @@ checkprops m1 -s 600 -v 1000
removefeatures res2 s gap2 removefeatures res2 s gap2
checkshape res2 checkshape res2
checkprops res2 -s 1200 -v 1875 checkprops res2 -s 1200 -v 1875
checknbshapes res2 -vertex 21 -edge 35 -wire 17 -face 17 -shell 2 -solid 2 checknbshapes res2 -vertex 19 -edge 31 -wire 15 -face 15 -shell 2 -solid 2
CheckIsFeatureRemoved gap2 {e f} CheckIsFeatureRemoved gap2 {e f}
# get history of the operation # get history of the operation

View File

@ -0,0 +1,24 @@
puts "================================================================================"
puts "OCC29382: ShapeUpgrade_UnifySameDomain algorithm incorrectly processes the shape"
puts "================================================================================"
puts ""
restore [locate_data_file bug29382_Group_3.brep] a
unifysamedom result a +b
checkshape result
checkshape a
checknbshapes result -solid 3 -shell 3 -face 16 -wire 16 -edge 30 -vertex 18
set tolres [checkmaxtol result]
if { ${tolres} > 1.8066863810061599e-05} {
puts "Error: bad tolerance of result"
}
explode result
checkprops result_1 -v 4.41996e-06
checkprops result_2 -v 1.30453e-06
checkprops result_3 -v 1.16532e-06

View File

@ -0,0 +1,24 @@
puts "================================================================================"
puts "OCC29382: ShapeUpgrade_UnifySameDomain algorithm incorrectly processes the shape"
puts "================================================================================"
puts ""
beziercurve a 5 0 0 0 1 0 0 2 2 0 0 0.5 0 0 0 0
mkedge a a
wire a a
mkplane a a
prism a a 0 0 1
box b -0.3 -0.2 0 1 0.4 1
bcommon shape a b
unifysamedom result shape +b
checkshape result
checknbshapes result -solid 1 -shell 1 -face 5 -wire 5 -edge 9 -vertex 5
set tolres [checkmaxtol result]
if { ${tolres} > 6.e-6} {
puts "Error: bad tolerance of result"
}

12
tests/bugs/heal/bug31524 Normal file
View File

@ -0,0 +1,12 @@
puts "TODO OCC31524 ALL: Faulty shapes in variables faulty_1"
puts "==============================================================================================="
puts "0031524: Modeling Algorithms - Unify same domain corrupts shape representing a cylindrical tube"
puts "==============================================================================================="
puts ""
restore [locate_data_file bug31524.brep] shape
unifysamedom res shape
checkshape shape

28
tests/bugs/heal/bug31778 Normal file
View File

@ -0,0 +1,28 @@
puts "============================================="
puts "OCC31778: UnifySameDomain fails in Debug mode"
puts "============================================="
puts ""
brestore [locate_data_file bug31778.brep] s
explode s
bclearobjects
bcleartools
baddobjects s_1
baddtools s_2 s_3
bfillds
bbop q 1
explode q
unifysamedom result q_1
checkshape result
checknbshapes result -solid 1 -shell 1 -face 19 -wire 21 -edge 51 -vertex 34
set tolres [checkmaxtol result]
if { ${tolres} > 5.e-5} {
puts "Error: bad tolerance of result"
}
checkprops result -v 15173.9

18
tests/bugs/heal/bug32140 Normal file
View File

@ -0,0 +1,18 @@
puts "=============================================================="
puts "OCC32140: unify same domain calls crossed for opposite vectors"
puts "=============================================================="
puts ""
restore [locate_data_file bug32140.brep] a
unifysamedom result a
checkshape result
checknbshapes result -solid 1 -shell 1 -face 26 -wire 32 -edge 69 -vertex 41
set tolres [checkmaxtol result]
if { ${tolres} > 6.e-6} {
puts "Error: bad tolerance of result"
}

20
tests/bugs/heal/bug32213 Normal file
View File

@ -0,0 +1,20 @@
puts "==========================================="
puts "OCC32213: Invalid result of UnifySameDomain"
puts "==========================================="
puts ""
restore [locate_data_file bug32213.brep] a
unifysamedom result a
checkshape result
checknbshapes result -solid 1 -shell 1 -face 21 -wire 22 -edge 58 -vertex 38
set tolres [checkmaxtol result]
if { ${tolres} > 6.e-6} {
puts "Error: bad tolerance of result"
}
checkprops result -s 81.9221

View File

@ -0,0 +1,18 @@
puts "=========================================================="
puts "OCC32332: Incorrect result of ShapeUpgrade_UnifySameDomain"
puts "=========================================================="
puts ""
restore [locate_data_file bug32332_1.brep] a
unifysamedom result a
checkshape result
checknbshapes result -wire 4 -edge 9 -vertex 6
set tolres [checkmaxtol result]
if { ${tolres} > 2.e-7} {
puts "Error: bad tolerance of result"
}

View File

@ -0,0 +1,18 @@
puts "=========================================================="
puts "OCC32332: Incorrect result of ShapeUpgrade_UnifySameDomain"
puts "=========================================================="
puts ""
restore [locate_data_file bug32332_2.brep] a
unifysamedom result a
checkshape result
checknbshapes result -wire 4 -edge 12 -vertex 8
set tolres [checkmaxtol result]
if { ${tolres} > 2.e-7} {
puts "Error: bad tolerance of result"
}

18
tests/bugs/heal/bug32561 Normal file
View File

@ -0,0 +1,18 @@
puts "======================================================================================="
puts "OCC32561: UnifySameDomain does nothing while it is expected to union two pairs of faces"
puts "======================================================================================="
puts ""
restore [locate_data_file bug32561.brep] a
unifysamedom result a
checkshape result
checknbshapes result -t -solid 64 -shell 64 -face 233 -wire 233 -edge 284 -vertex 116
set tolres [checkmaxtol result]
if { ${tolres} > 2.e-7} {
puts "Error: bad tolerance of result"
}

20
tests/bugs/heal/bug32581 Normal file
View File

@ -0,0 +1,20 @@
puts "================================================="
puts "OCC32581: UnifySameDomain produces invalid result"
puts "================================================="
puts ""
restore [locate_data_file bug32581.brep] a
unifysamedom result a
checkshape result
checknbshapes result -t -solid 3 -shell 3 -face 14 -wire 16 -edge 31 -vertex 20
set tolres [checkmaxtol result]
if { ${tolres} > 2.e-7} {
puts "Error: bad tolerance of result"
}
checkprops result -s 63178.1 -v 1e+06

20
tests/bugs/heal/bug32619 Normal file
View File

@ -0,0 +1,20 @@
puts "============================================="
puts "OCC32619: UnifySameDomain ignores shared face"
puts "============================================="
puts ""
restore [locate_data_file bug32619.brep] a
unifysamedom result a
checkshape result
checknbshapes result -t -shell 2 -face 3 -wire 3 -edge 12 -vertex 10
set tolres [checkmaxtol result]
if { ${tolres} > 2.e-7} {
puts "Error: bad tolerance of result"
}
checkview -display result -2d -path ${imagedir}/${test_image}.png

20
tests/bugs/heal/bug32623 Normal file
View File

@ -0,0 +1,20 @@
puts "============================================================="
puts "OCC32623: UnifySameDomain invalid result only in release mode"
puts "============================================================="
puts ""
restore [locate_data_file bug32623.brep] a
unifysamedom result a
checkshape result
checknbshapes result -t -solid 1 -shell 1 -face 58 -wire 68 -edge 163 -vertex 107
set tolres [checkmaxtol result]
if { ${tolres} > 2.e-5} {
puts "Error: bad tolerance of result"
}
checkprops result -s 56934.4 -v 244645

20
tests/bugs/heal/bug32719 Normal file
View File

@ -0,0 +1,20 @@
puts "============================================================"
puts "OCC32719: UnifySameDomain result has incorrect triangulation"
puts "============================================================"
puts ""
restore [locate_data_file bug32719.brep] a
unifysamedom result a
checkshape result
checknbshapes result -t -solid 4 -shell 4 -face 20 -wire 20 -edge 32 -vertex 16
set tolres [checkmaxtol result]
if { ${tolres} > 6.e-6} {
puts "Error: bad tolerance of result"
}
checkprops result -s 0.0222593 -v 5.17261e-05

View File

@ -13,6 +13,6 @@ vdisplay result
vsetdispmode result 1 vsetdispmode result 1
vfit vfit
checktrinfo result -tri 244 -nod 237 checktrinfo result -tri 200 -nod 215
checkview -display result -2d -path ${imagedir}/${test_image}.png checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -12,7 +12,7 @@ vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png checkview -screenshot -3d -path ${imagedir}/${test_image}.png
checktrinfo result -tri 323820 -nod 161951 -defl 0.00096399964870812682 checktrinfo result -tri 62936 -nod 31509 -defl 0.00096399964870812682
set log [tricheck result] set log [tricheck result]
if { [llength $log] != 0 } { if { [llength $log] != 0 } {

View File

@ -17,7 +17,7 @@ vdefaults -autoTriang 0
vdisplay result vdisplay result
vfit vfit
set rel_tol 0.035439456401028344 set rel_tol 0.6928018366802983
set max_rel_tol_diff 0.001 set max_rel_tol_diff 0.001
set area_eps 1 set area_eps 1

View File

@ -12,6 +12,6 @@ vdisplay result
vviewparams -scale 8.46292 -proj 0.653203 -0.644806 0.396926 -up -0.0109833 0.51609 0.856464 -at 347.559 1026.89 219.262 -eye 2080.75 -684.022 1272.45 vviewparams -scale 8.46292 -proj 0.653203 -0.644806 0.396926 -up -0.0109833 0.51609 0.856464 -at 347.559 1026.89 219.262 -eye 2080.75 -684.022 1272.45
tricheck result tricheck result
checktrinfo result -tri 11826 -nod 7310 -defl 7.6167024939147652 checktrinfo result -tri 6978 -nod 4890 -defl 7.6167024939147652
checkview -screenshot -3d -path ${imagedir}/${test_image}.png checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -15,7 +15,7 @@ vdefaults -autoTriang 0
tclean result tclean result
incmesh result 0.004 -a 14 incmesh result 0.004 -a 14
checktrinfo result -tri 70560 -nod 39946 -defl 0.22962869401103247 checktrinfo result -tri 70556 -nod 39944 -defl 0.22962869401103247
vdisplay result -redisplay vdisplay result -redisplay
vfit vfit
@ -23,7 +23,7 @@ checkview -screenshot -3d -path ${imagedir}/${test_image}_default.png
tclean result tclean result
incmesh result 0.004 -a 14 -force_face_def incmesh result 0.004 -a 14 -force_face_def
checktrinfo result -tri 292560 -nod 150946 -defl 0.04579460790575135 checktrinfo result -tri 292556 -nod 150944 -defl 0.04579460790575135
vdisplay result -redisplay vdisplay result -redisplay
vfit vfit

18
tests/bugs/mesh/bug32424 Normal file
View File

@ -0,0 +1,18 @@
puts "======="
puts "0032424: Mesh - Slow triangulation of a simple shape."
puts "======="
puts ""
cpulimit 3
restore [locate_data_file bug32424.brep] result
incmesh result 0.17 -a 20
checktrinfo result -tri 16168 -nod 8206
vinit
vdefaults -autoTriang 0
vsetdispmode 1
vdisplay result
vfit
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

View File

@ -1,4 +1,8 @@
puts "TODO OCC25925 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "TODO OCC25925 ALL: ERROR. offsetperform operation not done."
puts "TODO OCC25925 ALL: Error: The command cannot be built"
puts "TODO OCC25925 ALL: Faulty OCC5805 : result is not Closed shape"
puts "TODO OCC25925 ALL: TEST INCOMPLETE"
puts "TODO OCC25925 ALL: Tcl Exception: Error : command \\\"nbshapes result\\\" gives an empty result"
puts "============" puts "============"
puts "OCC5805" puts "OCC5805"
@ -32,7 +36,7 @@ if [catch { thrusections s ${issolid} ${isruled} UpCover BottomCover } catch_res
set distance -0.001 set distance -0.001
catch { OFFSETSHAPE $distance {s_2} $calcul $type } catch { OFFSETSHAPE $distance {s_2} $calcul $type }
# Bad result # Null result
checkprops result -s 358.795 checkprops result -s 358.795
@ -48,6 +52,6 @@ if {$index == -1} {
} }
checkshape result
checknbshapes result -t -wire 5 -face 5 -shell 2 -solid 1 checknbshapes result -t -wire 5 -face 5 -shell 2 -solid 1
checkview -display result -2d -path ${imagedir}/${test_image}.png checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -1,6 +1,6 @@
puts "TODO OCC23068 ALL: Error : is WRONG because number of" puts "TODO OCC25925 ALL: Error: The command cannot be built"
puts "TODO OCC23068 ALL: Error : The area of result shape is" puts "TODO OCC25925 ALL: TEST INCOMPLETE"
puts "TODO OCC23068 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "TODO OCC25925 ALL: Tcl Exception: Error : command \\\"nbshapes result\\\" gives an empty result"
puts "============" puts "============"
puts "OCC5805" puts "OCC5805"
@ -36,9 +36,7 @@ set distance -0.001
catch { OFFSETSHAPE $distance {} $calcul $type } catch { OFFSETSHAPE $distance {} $calcul $type }
# Null result # Null result
checkprops result -s 495.635 checkprops result -s 495.635
checkshape result
checknbshapes result -vertex 2 -edge 3 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 0 -shape 13 checknbshapes result -vertex 2 -edge 3 -wire 3 -face 3 -shell 1 -solid 1 -compsolid 0 -compound 0 -shape 13
@ -54,5 +52,4 @@ if {$index == -1} {
} }
checkview -display result -2d -path ${imagedir}/${test_image}.png checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -1,4 +1,6 @@
puts "TODO OCC25925 ALL: Faulty shapes in variables faulty_1 to faulty_" puts "TODO OCC25925 ALL: Faulty OCC5805 : result is not Closed shape"
puts "TODO OCC25925 ALL: ERROR. offsetperform operation not done."
puts "TODO OCC25925 ALL: Error: The command cannot be built"
puts "============" puts "============"
puts "OCC5805" puts "OCC5805"
@ -32,11 +34,10 @@ if [catch { thrusections s ${issolid} ${isruled} UpCover BottomCover } catch_res
set distance -0.001 set distance -0.001
catch { OFFSETSHAPE $distance {s_2} $calcul $type } catch { OFFSETSHAPE $distance {s_2} $calcul $type }
# Bad result # Null result
checkprops result -s 495.635 checkprops result -s 495.635
checkshape result
set index [lsearch [whatis s] Closed] set index [lsearch [whatis s] Closed]
if {$index == -1} { if {$index == -1} {
@ -50,5 +51,4 @@ if {$index == -1} {
} }
checkview -display result -2d -path ${imagedir}/${test_image}.png checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -19,16 +19,18 @@ checkprops result -s 8206.54
set nbshapes_expected " set nbshapes_expected "
Number of shapes in shape Number of shapes in shape
VERTEX : 5 VERTEX : 5
EDGE : 9 EDGE : 8
WIRE : 4 WIRE : 4
FACE : 4 FACE : 4
SHELL : 1 SHELL : 1
SOLID : 1 SOLID : 1
COMPSOLID : 0 COMPSOLID : 0
COMPOUND : 1 COMPOUND : 1
SHAPE : 25 SHAPE : 24
" "
checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations common" checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations common"
set tolres [checkmaxtol result]
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png checkview -display result -2d -path ${imagedir}/${test_image}-2d.png

View File

@ -19,16 +19,18 @@ checkprops result -s 34566
set nbshapes_expected " set nbshapes_expected "
Number of shapes in shape Number of shapes in shape
VERTEX : 13 VERTEX : 13
EDGE : 21 EDGE : 20
WIRE : 8 WIRE : 8
FACE : 8 FACE : 8
SHELL : 1 SHELL : 1
SOLID : 1 SOLID : 1
COMPSOLID : 0 COMPSOLID : 0
COMPOUND : 1 COMPOUND : 1
SHAPE : 53 SHAPE : 52
" "
checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations cut" checknbshapes result -ref ${nbshapes_expected} -t -m "Boolean operations cut"
set tolres [checkmaxtol result]
checkview -display result -3d -path ${imagedir}/${test_image}-3d.png checkview -display result -3d -path ${imagedir}/${test_image}-3d.png
checkview -display result -2d -path ${imagedir}/${test_image}-2d.png checkview -display result -2d -path ${imagedir}/${test_image}-2d.png

View File

@ -0,0 +1,31 @@
puts "========================================"
puts "0031578: BOP: wrong result in Debug mode"
puts "========================================"
puts ""
restore [locate_data_file bug31578_a.brep] a
restore [locate_data_file bug31578_b.brep] b
bclearobjects
bcleartools
baddobjects a
baddtools b
bfillds
bbuild r
checkshape r
set tolres [checkmaxtol r]
if { ${tolres} > 7.e-7} {
puts "Error: bad tolerance of result"
}
checknbshapes r -solid 3 -shell 3 -face 21 -wire 21 -edge 36 -vertex 19
bbop r_1 1
checkshape r_1
checknbshapes r_1 -solid 1 -shell 1 -face 18 -wire 18
checkprops r_1 -s 0.035795 -v 6.60461e-05

View File

@ -0,0 +1,43 @@
puts "======================================================================"
puts "OCC31735: BRepOffset_MakeOffset works slowly and produces wrong result"
puts "======================================================================"
puts ""
setfillhistory 1
restore [locate_data_file bug31735_1.brep] a
offsetparameter 1e-7 c i
offsetload a 0.02
offsetperform result
checkshape result
checknbshapes result -t -wire 28 -face 28 -shell 1 -solid 1
set tolres [checkmaxtol result]
if { ${tolres} > 0.001001} {
puts "Error: bad tolerance of result"
}
savehistory hh
explode a f
generated gf hh a_2
checkprops gf -s 0.582567
explode a_2 e
generated ge hh a_2_3
checkprops ge -l 0.440027
explode a_2_3
generated gv hh a_2_3_1
axo
donly a_2 a_2_3 a_2_3_1 result gf ge gv
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
puts "TEST COMPLETED"

View File

@ -0,0 +1,41 @@
puts "======================================================================"
puts "OCC31735: BRepOffset_MakeOffset works slowly and produces wrong result"
puts "======================================================================"
puts ""
setfillhistory 1
restore [locate_data_file bug31735_1.brep] a
explode a f
offsetparameter 1e-7 c i
offsetload a -0.02 a_1 a_2 a_3 a_4 a_10 a_11 a_12 a_15
offsetperform result
checknbshapes result -t -wire 49 -face 49 -shell 1 -solid 1
set tolres [checkmaxtol result]
if { ${tolres} > 0.001001} {
puts "Error: bad tolerance of result"
}
savehistory hh
generated gf6 hh a_6
checkprops gf6 -s 0.255127
modified mf2 hh a_2
checkprops mf2 -s 0.0270215
if {[regexp "Not deleted" [isdeleted hh a_1]]} {
puts "Error: History information is wrong"
}
axo
donly result gf6 mf2
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
puts "TEST COMPLETED"

View File

@ -0,0 +1,15 @@
puts "============================================"
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
puts "============================================"
puts ""
restore [locate_data_file bug31845_1.brep] a
offsetparameter 1e-7 c i
offsetload a 0.2
offsetperform result
checkshape result
checkprops result -s 271.847
checknbshapes result -t -edge 12 -wire 6 -face 6 -shell 1 -solid 1
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,15 @@
puts "============================================"
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
puts "============================================"
puts ""
restore [locate_data_file bug31845_1.brep] a
offsetparameter 1e-7 c i
offsetload a -0.2
offsetperform result
checkshape result
checkprops result -s 210.825
checknbshapes result -t -edge 12 -wire 6 -face 6 -shell 1 -solid 1
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,16 @@
puts "============================================"
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
puts "============================================"
puts ""
restore [locate_data_file bug31845_1.brep] a
explode a f
offsetparameter 1e-7 p i
offsetload a 0.2 a_5 a_6
offsetperform result
checkshape result
checkprops result -s 423.33
checknbshapes result -t -edge 24 -wire 12 -face 10 -shell 1 -solid 1
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,17 @@
puts "============================================"
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
puts "============================================"
puts ""
restore [locate_data_file bug31845_1.brep] a
explode a f
offsetparameter 1e-7 p i
offsetload a -0.2 a_5 a_6
offsetperform result
checkshape result
checkprops result -s 388.879
checknbshapes result -t -edge 24 -wire 12 -face 10 -shell 1 -solid 1
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,14 @@
puts "TODO OCC31845 All: ERROR. offsetperform operation not done."
puts "============================================"
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
puts "============================================"
puts ""
restore [locate_data_file bug31845_f.brep] a
explode a f
offsetparameter 1e-7 p i
offsetload a 0.001 a_4 a_5
offsetperform result

View File

@ -0,0 +1,16 @@
puts "TODO OCC31845 All: ERROR: null result"
puts "============================================"
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
puts "============================================"
puts ""
restore [locate_data_file bug31845_h.brep] a
offsetparameter 1e-7 p i
offsetload a -0.01
offsetperform result
if {[llength [whatis result]] < 4} {
puts "ERROR: null result"
}

View File

@ -0,0 +1,13 @@
puts "TODO OCC31845 All: ERROR. offsetperform operation not done."
puts "============================================"
puts "OCC31845: BRepOffsetAPI_MakeThickSolid fails"
puts "============================================"
puts ""
restore [locate_data_file bug31845_h.brep] a
explode a f
offsetparameter 1e-7 p i
offsetload a 0.001 a_3 a_4
offsetperform result

View File

@ -0,0 +1,36 @@
puts "TODO CR29596 ALL: Warning: Intersection of pair of shapes has failed"
puts "=========================================="
puts "0031890: Invalid result of common fuse BOP"
puts "=========================================="
puts ""
restore [locate_data_file bug31890_sol.brep] sol
restore [locate_data_file bug31890_ext.brep] ext
bclearobjects
bcleartools
baddobjects sol
baddtools ext
bfillds
bbuild inv
checkshape inv
set tolres [checkmaxtol inv]
if { ${tolres} > 6.e-6} {
puts "Error: bad tolerance of result"
}
bbop r_0 0
bbop r_1 1
checkshape r_0
checknbshapes r_0 -solid 1 -shell 1 -face 9 -wire 11
checkprops r_0 -s 58.2381 -v 14.1288
checkshape r_1
checknbshapes r_1 -solid 1 -shell 1 -face 16 -wire 18
checkprops r_1 -s 91.6213 -v 39.4973

View File

@ -0,0 +1,46 @@
puts "======================================================="
puts "0031912: Modeling Algorithms - Boolean Cut can't build resulting shape"
puts "======================================================="
puts ""
pload DATAEXCHANGE
stepread [locate_data_file bug31912_s.stp] s *
stepread [locate_data_file bug31912_b.stp] b *
bclearobjects
bcleartools
baddobjects s_1
baddtools b_1
bfillds
bbop r0 0
bbop r1 1
bbop r2 2
bbop r3 3
bbop r4 4
bbuild rgf
foreach r {r0 r1 r2 r3 r4 rgf} {
checkshape $r
}
checknbshapes r0 -wire 6 -face 6 -shell 1 -solid 1 -t
checkprops r0 -s 279207 -v 5.32814e+06
checknbshapes r1 -wire 12 -face 12 -shell 1 -solid 1 -t
checkprops r1 -s 4.93771e+06 -v 1.56185e+08
checknbshapes r2 -wire 8 -face 8 -shell 1 -solid 1 -t
checkprops r2 -s 4.37427e+06 -v 1.34873e+08
checknbshapes r3 -wire 6 -face 6 -shell 1 -solid 1 -t
checkprops r3 -s 571214 -v 1.59844e+07
checkprops r4 -l 3810.09
checksection r4 -r 4
checknbshapes rgf -wire 16 -face 16 -shell 3 -solid 3 -t
checkprops rgf -s 5.22469e+06 -v 1.56185e+08
checkview -display rgf -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,12 @@
puts "=============================================="
puts " 0031984: Sweep crashes if Bi-normal is given"
puts "=============================================="
puts ""
restore [locate_data_file bug31984.brep] a
explode a
mksweep a_1
addsweep a_2
setsweep -CN 0 0 1
buildsweep result

View File

@ -0,0 +1,54 @@
puts "============================================================================================="
puts "0032136: Modeling Algorithms - Boolean fuse fails and corrupts the argument-shape"
puts "============================================================================================="
puts ""
restore [locate_data_file bug32136_obj.brep] s
restore [locate_data_file bug32136_tools.brep] t
bclearobjects
bcleartools
baddobjects s
eval baddtools [explode t]
bfillds
bbop result 1
checkshape result
checknbshapes result -face 731 -shell 1 -solid 1 -t
checkprops result -s 0.051066 -v 8.9084e-06
foreach sh {result s} {
if {![regexp "This shape seems to be OK" [bopcheck $sh]]} {
puts "Error: the $sh shape is self-interfered"
}
checkmaxtol $sh -ref 5.e-6
}
foreach sh [explode t] {
if {![regexp "This shape seems to be OK" [bopcheck $sh]]} {
puts "Error: the $sh shape is self-interfered"
}
checkmaxtol $sh -ref 5.e-6
}
checkview -display result -2d -path ${imagedir}/${test_image}_fuse.png
# subsequent cut operation
box box 0.06335 0.06335 0.05
bclearobjects
bcleartools
baddobjects box
baddtools result
bfillds
bbop result_cut 2
checkshape result_cut
checknbshapes result_cut -face 756 -shell 1 -solid 1 -t
checkprops result_cut -s 0.0545148 -v 0.000191753
if {![regexp "This shape seems to be OK" [bopcheck result_cut]]} {
puts "Error: the result_cut shape is self-interfered"
}
checkmaxtol result_cut -ref 5.e-6
checkview -display result_cut -2d -path ${imagedir}/${test_image}_cut.png

View File

@ -0,0 +1,15 @@
puts "============================="
puts " 0032189: BOP Cut regression"
puts "============================="
puts ""
restore [locate_data_file bug32189_a.brep] a
restore [locate_data_file bug32189_b.brep] b
bcut result a b
checkshape result
checknbshapes result -vertex 5 -edge 6 -wire 3 -face 3 -shell 1 -solid 1
checkprops result -s 0.000687454 -v 8.86946e-07
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,46 @@
puts "================================"
puts " 0032196: Invalid section curve"
puts "================================"
puts ""
restore [locate_data_file bug32136_obj.brep] s
restore [locate_data_file bug32136_tools.brep] t
explode s f
explode t
explode t_3 f
set log [bopcurves s_44 t_3_4 -2d]
if {![regexp "has no 3d curves" ${log}] ||
![regexp "has no 3d points" ${log}]} {
puts "Error: the result contains curves or points"
}
set log [bopcurves s_2 t_3_82 -2d]
if {![regexp "has no 3d curves" ${log}] ||
![regexp "has no 3d points" ${log}]} {
puts "Error: the result contains curves or points"
}
set log [bopcurves s_2 t_3_95 -2d]
if {![regexp "has no 3d curves" ${log}] ||
![regexp "has no 3d points" ${log}]} {
puts "Error: the result contains curves or points"
}
set log [bopcurves s_2 t_3_108 -2d]
if {![regexp "has no 3d curves" ${log}] ||
![regexp "has no 3d points" ${log}]} {
puts "Error: the result contains curves or points"
}
set log [bopcurves s_52 t_3_43 -2d]
if {![regexp "has no 3d curves" ${log}] ||
![regexp "has no 3d points" ${log}]} {
puts "Error: the result contains curves or points"
}

View File

@ -0,0 +1,29 @@
puts "======================================================="
puts " 0032291: General Fuse produces wrong number of solids"
puts "======================================================="
puts ""
restore [locate_data_file bug32291.brep] s
explode s
baddobjects s_1
baddtools s_2 s_3 s_4 s_5 s_6 s_7 s_8
bfillds
bbuild result
checkshape result
checknbshapes result -vertex 79 -edge 176 -wire 112 -face 112 -shell 18 -solid 18
set tolres [checkmaxtol result]
if { ${tolres} > 7.e-5} {
puts "Error: bad tolerance of result"
}
axo
clear
explode result So
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,22 @@
puts "============================================"
puts "OCC32470: BOP wrong result on sphere and box"
puts "============================================"
puts ""
psphere sph 10
box b 20 100 100
ttranslate b 0 -50 -50
trotate b 0 0 10 0 -1 0 45
bcut result sph b
checkshape result
checknbshapes result -t -vertex 3 -edge 5 -wire 2 -face 2 -shell 1 -solid 1
set tolres [checkmaxtol result]
if { ${tolres} > 1.e-5} {
puts "Error: bad tolerance of result"
}
checkprops result -s 1229.69 -v 3945.6

View File

@ -0,0 +1,24 @@
puts "================================================="
puts "OCC32502: BOP wrong result on sphere and cylinder"
puts "================================================="
puts ""
psphere sph 10
plane pln 0 0 7 0 1 0 0 0 1
pcylinder cyl pln 3 40
ttranslate cyl 0 -20 0
bop sph cyl
bopfuse result
checkshape result
checknbshapes result -t -vertex 4 -edge 11 -wire 5 -face 5 -shell 1 -solid 1
set tolres [checkmaxtol result]
if { ${tolres} > 3.e-5} {
puts "Error: bad tolerance of result"
}
checkprops result -s 1750.1 -v 4947.2

View File

@ -19,5 +19,5 @@ isos result 0
triangles result triangles result
fit fit
checktrinfo result -tri 10924 -nod 7869 checktrinfo result -tri 7863 -nod 6342
checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png

View File

@ -0,0 +1,15 @@
puts "========="
puts "0032058: Modeling Data - Extrema curve-surface gives wrong result for planar surface of revolunion and circle"
puts "========="
puts ""
restore [locate_data_file bug32058_c] c
restore [locate_data_file bug32058_s] s
extrema c s
checklength ext_1 -l 2.3437142008433856e-13
smallview
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@ -17,6 +17,38 @@ trim c2 c pi 2.*pi
project c2d1 c1 s project c2d1 c1 s
project c2d2 c2 s project c2d2 c2 s
2dcvalue c2d1 0 x1 y1
2dcvalue c2d1 pi x2 y2
2dcvalue c2d2 pi x3 y3
2dcvalue c2d2 2*pi x4 y4
set tol 1.e-9
if {[expr abs([dval x1]) - 4.7123885383825099] > $tol} {
puts "Error: Wrong projection in 2D"
}
if {[expr abs([dval y1]) - 1.5707963267948966] > $tol} {
puts "Error: Wrong projection in 2D"
}
if {[expr abs([dval x2]) - 6.2831853071795862] > $tol} {
puts "Error: Wrong projection in 2D"
}
if {[expr abs(-1.2217304763960311 - [dval y2])] > $tol} {
puts "Error: Wrong projection in 2D"
}
if {[expr abs([dval x3])] > $tol} {
puts "Error: Wrong projection in 2D"
}
if {[expr abs(-1.2217304763960311 - [dval y3])] > $tol} {
puts "Error: Wrong projection in 2D"
}
if {[expr abs([dval x4]) - 1.5707967687970734] > $tol} {
puts "Error: Wrong projection in 2D"
}
if {[expr abs([dval y4]) - 1.5707963267948948] > $tol} {
puts "Error: Wrong projection in 2D"
}
checklength c2d1 -l 3.68009 checklength c2d1 -l 3.68009
checklength c2d2 -l 3.68009 checklength c2d2 -l 3.68009

View File

@ -1,5 +1,3 @@
puts "TODO OCC25989 ALL: Error : The volume of result shape is"
puts "========" puts "========"
puts "OCC25989" puts "OCC25989"
puts "========" puts "========"

8
tests/bugs/step/bug32264 Normal file
View File

@ -0,0 +1,8 @@
restore [locate_data_file bug32264.brep] s
set aTmpFile "$imagedir/${casename}.brep"
testwritestep "$aTmpFile" s
testreadstep "$aTmpFile" s1
file delete "$aTmpFile"
checkshape s1 f
checkmaxtol s1 -ref 1.e-7
checkprops s1 -v 16.1759 -deps 0.01

30
tests/bugs/step/bug32556 Normal file
View File

@ -0,0 +1,30 @@
puts "========================"
puts "0032556: Data Exchange - A toroidal part of solid is corrupted while writing or reading STEP file"
puts "========================"
# Create fused shape
ptorus a1 5 3
plane pp 5 0 -5
pcylinder a2 pp 2 10
bfuse a a1 a2
# Write fused shape
testwritestep ${imagedir}/${casename}.stp a
# Read fused shape
testreadstep ${imagedir}/${casename}.stp res
file delete ${imagedir}/${casename}.stp
# Check fused shape
checkshape res f
checknbshapes res -edge 12 -vertex 7
checkprops res -s 649.9
# Display result fused shape
clear
smallview
donly res
isos res 0
fit
isos res 2
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@ -10,4 +10,4 @@ bfuse f pt pr
nexplode f f nexplode f f
depouille result f 0 0 1 f_4 5 0 0 40 0 0 1 depouille result f 0 0 1 f_4 5 0 0 40 0 0 1
checkprops result -s 10112.2 checkprops result -s 9447.73

View File

@ -18,7 +18,7 @@ if {[regexp "Faulties" [bopargcheck result]]} {
puts "Error: bopargcheck has found some faulties in res2" puts "Error: bopargcheck has found some faulties in res2"
} }
checkmaxtol result -ref 0.031968491076118669 checkmaxtol result -ref 5.e-6
smallview smallview
don result sw tw don result sw tw

View File

@ -1,5 +1,5 @@
set viewname "vright" set viewname "vright"
set length 9547.11 set length 9546.99
testreadstep [locate_data_file bug27341_Assembly_ABS_1_CAD.stp] a testreadstep [locate_data_file bug27341_Assembly_ABS_1_CAD.stp] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,4 +1,4 @@
puts "TODO OCC30286 ALL: Error : The length of result shape is 5496.05, expected 5934.34" puts "TODO OCC30286 ALL: Error : The length of result shape is 5499.*, expected 5934.34"
set viewname "vright" set viewname "vright"
set length 5934.34 set length 5934.34

View File

@ -1,4 +1,4 @@
puts "TODO OCC30286 ALL: Error : The length of result shape is 2707.33, expected 2765.47" puts "TODO OCC30286 ALL: Error : The length of result shape is 2705.91, expected 2765.47"
set viewname "vright" set viewname "vright"
set length 2765.47 set length 2765.47

View File

@ -4,7 +4,7 @@ puts "============"
puts "" puts ""
set viewname "vfront" set viewname "vfront"
set length 28991.6 set length 29113.3
restore [locate_data_file bug23625_a2.brep] a restore [locate_data_file bug23625_a2.brep] a
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

Some files were not shown because too many files have changed in this diff Show More