1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
akaftasev
1083b94cf9 0033418: Modeling Algorithms - BRepExtrema_DistShapeShape wrong arc ellipse - point result
Wrong calculation of distance arises for ellipse with MajorRadius == MinorRadius when first or last parameter of trimmed ellipse more then 2*pi
This case should be calculated as circle
2023-08-04 10:04:44 +01:00
35 changed files with 55 additions and 690 deletions

View File

@@ -1177,45 +1177,6 @@ void BRepOffset_BuildOffsetFaces::IntersectTrimmedEdges (const Message_ProgressR
UpdateIntersectedEdges (aLA, aGFE);
}
namespace
{
//=======================================================================
//function : CheckConnectionsOfFace
//purpose : Checks number of connections for theFace with theLF
// Returns true if number of connections more than 1
//=======================================================================
static Standard_Boolean checkConnectionsOfFace(const TopoDS_Shape& theFace,
const TopTools_ListOfShape& theLF)
{
TopTools_IndexedMapOfShape aShapeVert;
for (TopTools_ListOfShape::Iterator aFImIterator(theLF); aFImIterator.More(); aFImIterator.Next())
{
const TopoDS_Shape& aShape = aFImIterator.Value();
if (aShape.IsSame(theFace))
{
continue;
}
TopExp::MapShapes(aShape, TopAbs_VERTEX, aShapeVert);
}
Standard_Integer aNbConnections = 0;
TopTools_IndexedMapOfShape aFaceVertices;
TopExp::MapShapes(theFace, TopAbs_VERTEX, aFaceVertices);
for (TopTools_IndexedMapOfShape::Iterator aVertIter(aFaceVertices); aVertIter.More(); aVertIter.Next())
{
const TopoDS_Shape& aVert = aVertIter.Value();
if (aShapeVert.Contains(aVert))
{
++aNbConnections;
}
if (aNbConnections > 1)
{
return Standard_True;
}
}
return Standard_False;
}
}
//=======================================================================
//function : BuildSplitsOfFaces
//purpose : Building the splits of offset faces and
@@ -1307,10 +1268,6 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
for (TopTools_ListIteratorOfListOfShape aItLFIm (aLFImages1); aItLFIm.More();)
{
Standard_Boolean bAllInv = Standard_True;
// Additional check for artificial case
// if current image face consist only of edges from aMapEInv and aMENInv
// then recheck current face for the futher processing
Standard_Boolean aToReCheckFace = bArtificialCase;
const TopoDS_Shape& aFIm = aItLFIm.Value();
TopExp_Explorer aExpE (aFIm, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next())
@@ -1321,19 +1278,12 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
bAllInv = Standard_False;
if (!aMENInv.Contains (aE))
{
aToReCheckFace = Standard_False;
break;
}
}
}
// if current image face is to recheck then check number of connections for this face
// with other image faces for current face
if (!aExpE.More() && aToReCheckFace)
{
aToReCheckFace = checkConnectionsOfFace(aFIm, aLFImages1);
}
// do not delete image face from futher processing if aToReCheckFace is true
if (!aExpE.More() && !aToReCheckFace)
//
if (!aExpE.More())
{
if (bAllInv)
{

View File

@@ -42,12 +42,9 @@
#include <Geom2d_Circle.hxx>
#include <Geom2dAPI_Interpolate.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Message.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_Edge.hxx>
#include <DBRep.hxx>
#include <DBRep_DrawableShape.hxx>
@@ -274,142 +271,6 @@ static Standard_Integer wire(Draw_Interpretor& di, Standard_Integer n, const cha
return 0;
}
//=======================================================================
// strongwire
//=======================================================================
static Standard_Integer strongwire(Draw_Interpretor& theDI, Standard_Integer theArgC, const char** theArgV)
{
enum StrongWireMode {
StrongWireMode_FixTolerance = 1,
StrongWireMode_Approximation = 2,
StrongWireMode_KeepCurveType = 3
};
BRep_Builder aB;
TopoDS_Wire aWire;
aB.MakeWire(aWire);
if (theArgC < 3)
return 1;
// Tolerance
double aTolerance = Precision::Confusion();
// mode
StrongWireMode aMode = StrongWireMode_KeepCurveType;
// add edges
for (Standard_Integer anArgIter = 2; anArgIter < theArgC; anArgIter++)
{
TCollection_AsciiString aParam(theArgV[anArgIter]);
if (aParam == "-t")
{
anArgIter++;
if (anArgIter < theArgC)
aTolerance = Draw::Atof(theArgV[anArgIter]);
}
else if (aParam == "-m")
{
anArgIter++;
if (anArgIter < theArgC)
{
if (aParam == "keepType" || Draw::Atoi(theArgV[anArgIter]) == 1)
{
aMode = StrongWireMode_KeepCurveType;
continue;
}
else if (aParam == "approx" || Draw::Atoi(theArgV[anArgIter]) == 2)
{
aMode = StrongWireMode_Approximation;
continue;
}
else if (aParam == "fixTol" || Draw::Atoi(theArgV[anArgIter]) == 3)
{
aMode = StrongWireMode_FixTolerance;
continue;
}
}
}
else
{
TopoDS_Shape aShape = DBRep::Get(theArgV[anArgIter]);
if (aShape.IsNull())
Standard_NullObject::Raise("Shape for wire construction is null");
if (aShape.ShapeType() == TopAbs_EDGE || aShape.ShapeType() == TopAbs_WIRE)
{
TopExp_Explorer anExp(aShape, TopAbs_EDGE);
for (; anExp.More(); anExp.Next())
aB.Add(aWire, TopoDS::Edge(anExp.Current()));
}
else
Standard_TypeMismatch::Raise("Shape for wire construction is neither an edge nor a wire");
}
}
// fix edges order
Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
aFW->Load(aWire);
aFW->FixReorder();
if (aFW->StatusReorder(ShapeExtend_FAIL1))
{
Message::SendFail() << "Error: Wire construction failed: several loops detected";
return 1;
}
else if (aFW->StatusReorder(ShapeExtend_FAIL))
{
Message::SendFail() << "Wire construction failed";
return 1;
}
bool isClosed = false;
Handle(ShapeAnalysis_Wire) aSaw = aFW->Analyzer();
if (aSaw->CheckGap3d(1)) // between last and first edges
{
Standard_Real aDist = aSaw->MinDistance3d();
if (aDist < aTolerance)
isClosed = true;
}
aFW->ClosedWireMode() = isClosed;
aFW->FixConnected(aTolerance);
if (aMode == StrongWireMode_KeepCurveType)
aFW->FixCurves();
if (aFW->StatusConnected(ShapeExtend_FAIL))
{
Message::SendFail() << "Wire construction failed: cannot build connected wire";
return 1;
}
if (aFW->StatusConnected(ShapeExtend_DONE3))
{
if (aMode != StrongWireMode_Approximation)
aFW->SetPrecision(aTolerance);
aFW->FixGapsByRangesMode() = Standard_True;
if (aFW->FixGaps3d())
{
Handle(ShapeExtend_WireData) sbwd = aFW->WireData();
Handle(ShapeFix_Edge) aFe = new ShapeFix_Edge;
for (Standard_Integer anIdx = 1; anIdx <= sbwd->NbEdges(); anIdx++)
{
TopoDS_Edge aEdge = TopoDS::Edge(sbwd->Edge(anIdx));
aFe->FixVertexTolerance(aEdge);
aFe->FixSameParameter(aEdge);
}
}
else if (aFW->StatusGaps3d(ShapeExtend_FAIL))
{
Message::SendFail() << "Wire construction failed: cannot fix 3d gaps";
return 1;
}
}
aWire = aFW->WireAPIMake();
DBRep::Set(theArgV[1], aWire);
return 0;
}
//=======================================================================
// mkedge
//=======================================================================
@@ -2136,10 +1997,6 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
"wire wirename [-unsorted] e1/w1 [e2/w2 ...]",__FILE__,
wire,g);
theCommands.Add("strongwire",
"strongwire wirename e1/w1 [e2/w2 ...] [-t tol] [-m mode(keepType/1 | approx/2 | fixTol/3)]", __FILE__,
strongwire, g);
theCommands.Add("profile",
"profile, no args to get help",__FILE__,
profile,g);

View File

@@ -538,6 +538,7 @@ Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath
{
theProvider = aNode->BuildProvider();
aNode->GlobalParameters = GlobalParameters;
theProvider->SetNode(aNode);
return Standard_True;
}
}

View File

@@ -125,7 +125,7 @@ Handle(DE_ConfigurationNode) DEXCAFCascade_ConfigurationNode::Copy() const
//=======================================================================
Handle(DE_Provider) DEXCAFCascade_ConfigurationNode::BuildProvider()
{
return new DEXCAFCascade_Provider (this);
return new DEXCAFCascade_Provider();
}
//=======================================================================

View File

@@ -217,6 +217,10 @@ Method:
Then, (1) <=> (A*Cos-X,B*Sin-Y).(-A*Sin,B*Cos) = 0.
(B**2-A**2)*Cos*Sin - B*Y*Cos + A*X*Sin = 0.
Use algorithm math_TrigonometricFunctionRoots to solve this equation.
Addition:
In case, when MajorRadius == MinorRadius calcualtion errors may occur
This case should be processed as Circle
-----------------------------------------------------------------------------*/
{
myDone = Standard_False;
@@ -229,6 +233,12 @@ Method:
gp_Vec Trsl = Axe.Multiplied(-(gp_Vec(O,P).Dot(Axe)));
gp_Pnt Pp = P.Translated(Trsl);
if (Abs(C.MajorRadius() - C.MinorRadius() < Precision::Confusion()))
{
Perform(P, gp_Circ(gp_Ax2(O, C.Axis().Direction()), C.MajorRadius()), Tol, Uinf, Usup);
return;
}
// 2- Calculation of solutions ...
Standard_Integer NoSol, NbSol;

View File

@@ -609,7 +609,7 @@ void GeomFill_SectionPlacement::Perform(const Handle(Adaptor3d_Curve)& Path,
myAdpSection.LastParameter(),
Path->Resolution(Tol/100),
myAdpSection.Resolution(Tol/100));
if (Ext.IsDone() && !Ext.IsParallel()) {
if (Ext.IsDone()) {
Extrema_POnCurv P1, P2;
for (ii=1; ii<=Ext.NbExt(); ii++) {
distaux = sqrt (Ext.SquareDistance(ii));

View File

@@ -73,7 +73,7 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol,
"write.iges.resource.name",
"write.iges.sequence", info,
theProgress, false, TopAbs_EDGE);
theProgress );
// modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP);

View File

@@ -92,7 +92,7 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
TopoDS_Shape Shape = XSAlgo::AlgoContainer()->ProcessShape( theShape, Tol, maxTol,
"write.iges.resource.name",
"write.iges.sequence", info,
aPS.Next(), false, TopAbs_EDGE);
aPS.Next());
if (!aPS.More())
return Standard_False;

View File

@@ -198,7 +198,7 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
"read.iges.resource.name",
"read.iges.sequence",
info, mymodel->ReShape(),
aPS.Next(), false, TopAbs_EDGE);
aPS.Next());
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
}

View File

@@ -552,7 +552,7 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, eps*CAS.GetUnitFactor(), CAS.GetMaxTol(),
"read.iges.resource.name",
"read.iges.sequence", info,
aPS.Next(), false, TopAbs_EDGE);
aPS.Next() );
if (aPS.UserBreak())
return Standard_False;

View File

@@ -52,19 +52,13 @@
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeArcOfEllipse.hxx>
#include <GC_MakeLine.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dConvert.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_OffsetCurve.hxx>
#include <Geom_Plane.hxx>
#include <Geom_SphericalSurface.hxx>
@@ -74,7 +68,6 @@
#include <GeomAdaptor_Curve.hxx>
#include <GeomAPI.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <IntRes2d_SequenceOfIntersectionPoint.hxx>
@@ -519,25 +512,6 @@ Standard_Boolean ShapeFix_Wire::FixConnected (const Standard_Real prec)
return StatusConnected ( ShapeExtend_DONE );
}
//=======================================================================
//function : FixCurves
//purpose :
//=======================================================================
Standard_Boolean ShapeFix_Wire::FixCurves()
{
myStatusConnected = ShapeExtend::EncodeStatus(ShapeExtend_OK);
if (!IsLoaded()) return Standard_False;
Standard_Integer stop = (myClosedMode ? 0 : 1);
for (Standard_Integer anIdx = NbEdges(); anIdx > stop; anIdx--)
{
FixCurves(anIdx);
myStatusConnected |= myLastFixStatus;
}
return StatusConnected(ShapeExtend_DONE);
}
//=======================================================================
//function : FixEdgeCurves
//purpose :
@@ -1325,169 +1299,6 @@ Standard_Boolean ShapeFix_Wire::FixConnected (const Standard_Integer num,
return Standard_True;
}
//=======================================================================
//function : FixCurves
//purpose :
//=======================================================================
Standard_Boolean ShapeFix_Wire::FixCurves(const Standard_Integer theIdx)
{
// assume fix curves step should be after fix vertices
myLastFixStatus = ShapeExtend::EncodeStatus(ShapeExtend_OK);
if (!IsLoaded() || NbEdges() <= 0)
return Standard_False;
// action: replacing curves in edges
Handle(ShapeExtend_WireData) anSbwd = WireData();
Standard_Integer anIdx = (theIdx > 0 ? theIdx : anSbwd->NbEdges());
TopoDS_Edge anEdge = anSbwd->Edge(anIdx);
Standard_Real aPrec = BRep_Tool::Tolerance(anEdge);
ShapeAnalysis_Edge aSae;
ShapeAnalysis_Wire aSaw;
Handle(Geom_Curve) aCurve3d;
Standard_Real aCurBounds[3];
Standard_Boolean IsReversed = Standard_False;
aSae.Curve3d(anEdge, aCurve3d, aCurBounds[0], aCurBounds[2], IsReversed);
aCurBounds[1] = (aCurBounds[0] + aCurBounds[2]) / 2;
gp_Pnt anEnds[3];
anEnds[0] = BRep_Tool::Pnt(aSae.FirstVertex(anEdge));
aCurve3d->D0(aCurBounds[1], anEnds[1]);
anEnds[2] = BRep_Tool::Pnt(aSae.LastVertex(anEdge));
gp_Pnt aGeomEnds[2];
aCurve3d->D0(aCurBounds[0], aGeomEnds[0]);
aCurve3d->D0(aCurBounds[2], aGeomEnds[1]);
// TODO: precise, if IsReversed flag should be considered here
Standard_Real aGap0 = Min(anEnds[0].Distance(aGeomEnds[0]), anEnds[0].Distance(aGeomEnds[1]));
Standard_Real aGap2 = Min(anEnds[2].Distance(aGeomEnds[0]), anEnds[2].Distance(aGeomEnds[1]));
if (Max (aGap0, aGap2) < aPrec) // nothing to do
return true;
if (aCurve3d->IsKind(STANDARD_TYPE(Geom_Circle)))
{
Standard_Real anOldR = Handle(Geom_Circle)::DownCast(aCurve3d)->Circ().Radius();
gp_Vec anArcNorm = gp_Vec(anEnds[2], anEnds[0]) / 2;
gp_Pnt aCenter(anEnds[0].XYZ() - anArcNorm.XYZ());
int aSign = anEnds[1].Distance(aCenter) > anOldR ? 1 : -1; // for arc length > PI
Standard_Real aD = anOldR*anOldR - anArcNorm.SquareMagnitude();
aD = abs(aD) < Precision::Confusion() ? 0. : aD;
Standard_Real anArcR = anOldR + aSign * sqrt(aD);
gp_Ax2 aNormal(aCenter, anArcNorm);
Handle(Geom_Circle) anArc = new Geom_Circle(aNormal, anArcR);
GeomAPI_ProjectPointOnCurve projector(anEnds[1], anArc);
anEnds[1] = projector.NearestPoint();
GC_MakeArcOfCircle arc(anEnds[0], anEnds[1], anEnds[2]);
TopoDS_Edge aNewEdge = BRepBuilderAPI_MakeEdge(arc.Value()).Edge();
anSbwd->Set(aNewEdge, theIdx);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_Ellipse)))
{
Handle(Geom_Ellipse) anOld = Handle(Geom_Ellipse)::DownCast(aCurve3d);
Handle(Geom_Plane) aPln = new Geom_Plane(anEnds[0], gp_Vec(anEnds[2], anEnds[0]).Crossed(gp_Vec(anEnds[1], anEnds[0])));
GeomAPI_ProjectPointOnSurf aProjector(anOld->Elips().Location(), aPln);
gp_Pnt anOrigin = aProjector.NearestPoint();
aProjector.Init(anOld->Elips().Location().XYZ() + anOld->Elips().XAxis().Direction().XYZ(), aPln);
gp_Ax2 anAx(anOrigin, aPln->Axis().Direction(), aProjector.NearestPoint().XYZ() - anOrigin.XYZ());
// compute angle
Standard_Real aRec = DBL_MAX;
Standard_Real anAngle = 0.;
Standard_Integer aSplNum = 10;
for (Standard_Integer anIdxI = -aSplNum; anIdxI < aSplNum; ++anIdxI)
{
Handle(Geom_Ellipse) anEll = new Geom_Ellipse(anAx, anOld->MajorRadius(), anOld->MinorRadius());
anEll->Rotate(anAx.Axis(), aPrec*anIdxI / anEll->MajorRadius() / aSplNum);
GeomAPI_ProjectPointOnCurve aProjector1(anEnds[0], anEll);
Standard_Real aDist = 0.;
for (Standard_Integer anIdxJ = 0; anIdxJ < 2; ++anIdxJ)
{
aProjector1.Perform(anEnds[anIdxJ *2]);
aDist += std::fmin (aProjector1.Distance(1), aProjector1.Distance(2));
}
if (aDist < aRec)
{
aRec = aDist;
anAngle = aPrec*anIdxI / anEll->MajorRadius() / aSplNum;
}
}
gp_Elips aTemp(anAx, anOld->MajorRadius(), anOld->MinorRadius());
aTemp.Rotate(anAx.Axis(), anAngle);
// compute shift
gp_Vec aX = aTemp.XAxis().Direction();
gp_Vec aY = aTemp.YAxis().Direction();
gp_Pnt2d aP1((anEnds[0].XYZ() - anOrigin.XYZ()).Dot(aX.XYZ()), (anEnds[0].XYZ() - anOrigin.XYZ()).Dot(aY.XYZ()));
gp_Pnt2d aP2((anEnds[2].XYZ() - anOrigin.XYZ()).Dot(aX.XYZ()), (anEnds[2].XYZ() - anOrigin.XYZ()).Dot(aY.XYZ()));
// x = ky + p linear equation
// where (x, y) shift point,
// k, p constant coefficients
Standard_Real k = 1, p = 0;
Standard_Real R = anOld->MajorRadius();
Standard_Real r = anOld->MinorRadius();
k = (R / r) * (R / r) *
(aP1.Y() - aP2.Y()) / (aP2.X() - aP1.X());
p = -(1. / 2) * (R / r) * (R / r) *
(aP1.Y()*aP1.Y() - aP2.Y()*aP2.Y()) / (aP2.X() - aP1.X()) + aP1.X() / 2 + aP2.X() / 2;
// ax^2 + bx + c = 0 square equation
// a, b, c constant coefficients
Standard_Real a = 0., b = 0., c = 0.;
a = R*R + k*k*r*r;
b = 2 * (k*p*r*r - k*aP1.X()*r*r - aP1.Y()*R*R);
c = aP1.X()*aP1.X()*r*r +
aP1.Y()*aP1.Y()*R*R -
r*r*R*R +
p*p*r*r - 2 * aP1.X()*p*r*r;
Standard_Real y1 = (-b - sqrt(b*b - 4 * a*c)) / 2 / a;
Standard_Real y2 = (-b + sqrt(b*b - 4 * a*c)) / 2 / a;
Standard_Real x1 = k*y1 + p;
Standard_Real x2 = k*y2 + p;
gp_Pnt anOri = anOld->Location();
if (x1*x1 + y1*y1 < x2*x2 + y2*y2)
anOri = anOri.XYZ() + aX.XYZ()*x1 + aY.XYZ()*y1;
else
anOri = anOri.XYZ() + aX.XYZ()*x2 + aY.XYZ()*y2;
aTemp.SetLocation(anOri);
GC_MakeArcOfEllipse anArc(aTemp, anEnds[2], anEnds[0], true);
TopoDS_Edge aNewEdge = BRepBuilderAPI_MakeEdge(anArc.Value()).Edge();
anSbwd->Set(aNewEdge, theIdx);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_Line)))
{
TopoDS_Edge aNewEdge = BRepBuilderAPI_MakeEdge(anEnds[2], anEnds[0]).Edge();
anSbwd->Set(aNewEdge, theIdx);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_BSplineCurve)))
{
Handle(Geom_BSplineCurve) anOld = Handle(Geom_BSplineCurve)::DownCast(aCurve3d);
Standard_Integer f, l;
int p = anEnds[0].Distance(aGeomEnds[0]) < anEnds[1].Distance(aGeomEnds[0]) ? 0 : 2;
anOld->MovePoint(aCurBounds[0], anEnds[p], 1, 1, f, l);
anOld->MovePoint(aCurBounds[2], anEnds[2-p], anOld->NbPoles(), anOld->NbPoles(), f, l);
return true;
}
else if (aCurve3d->IsKind(STANDARD_TYPE(Geom_BezierCurve)))
{
Handle(Geom_BezierCurve) anOld = Handle(Geom_BezierCurve)::DownCast(aCurve3d);
int p = anEnds[0].Distance(aGeomEnds[0]) < anEnds[1].Distance(aGeomEnds[0]) ? 0 : 2;
anOld->SetPole(1, anEnds[p]);
anOld->SetPole(anOld->NbPoles(), anEnds[2-p]);
return true;
}
// TODO: question: the below code works only for other curve types (not line/arc/circle/ellipse/bspline)
// Is it really needed?
myAnalyzer->CheckConnected(theIdx, aPrec);
if (myAnalyzer->LastCheckStatus(ShapeExtend_FAIL))
myLastFixStatus |= ShapeExtend::EncodeStatus(ShapeExtend_FAIL1);
return true;
}
//=======================================================================
//function : FixSeam

View File

@@ -277,7 +277,6 @@ public:
//! flag ClosedMode is True
//! If <prec> is -1 then MaxTolerance() is taken.
Standard_EXPORT Standard_Boolean FixConnected (const Standard_Real prec = -1.0);
Standard_EXPORT Standard_Boolean FixCurves();
//! Groups the fixes dealing with 3d and pcurves of the edges.
//! The order of the fixes and the default behaviour are:
@@ -347,7 +346,6 @@ public:
//! Tests with starting preci or, if given greater, <prec>
//! If <prec> is -1 then MaxTolerance() is taken.
Standard_EXPORT Standard_Boolean FixConnected (const Standard_Integer num, const Standard_Real prec);
Standard_EXPORT Standard_Boolean FixCurves(const Standard_Integer num);
//! Fixes a seam edge
//! A Seam edge has two pcurves, one for forward. one for reversed

View File

@@ -340,22 +340,16 @@ static Standard_Real ComputeMinEdgeSize(const TopTools_SequenceOfShape& theEdges
return MinSize;
}
//=======================================================================
//function : FindCoordBounds
//purpose : Searching for origin of U in 2d space
// Returns Standard_False if could not find curve on surface
// Returns Standard_True if succeed
//=======================================================================
static Standard_Boolean FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
const TopoDS_Face& theRefFace,
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
const TopTools_MapOfShape& theEdgesMap,
const Standard_Integer theIndCoord,
const Standard_Real thePeriod,
Standard_Real& theMinCoord,
Standard_Real& theMaxCoord,
Standard_Integer& theNumberOfIntervals,
Standard_Integer& theIndFaceMax)
static void FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
const TopoDS_Face& theRefFace,
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
const TopTools_MapOfShape& theEdgesMap,
const Standard_Integer theIndCoord,
const Standard_Real thePeriod,
Standard_Real& theMinCoord,
Standard_Real& theMaxCoord,
Standard_Integer& theNumberOfIntervals,
Standard_Integer& theIndFaceMax)
{
NCollection_Sequence<std::pair<Standard_Real, Standard_Real>> aPairSeq;
@@ -378,10 +372,6 @@ static Standard_Boolean FindCoordBounds(const TopTools_SequenceOfShape& theFaces
continue;
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theRefFace, fpar, lpar);
if (aPCurve.IsNull())
{
return Standard_False;
}
UpdateBoundaries (aPCurve, fpar, lpar, theIndCoord, aMinCoord, aMaxCoord);
}
@@ -446,7 +436,6 @@ static Standard_Boolean FindCoordBounds(const TopTools_SequenceOfShape& theFaces
theMinCoord = aPairSeq(1).first;
theMaxCoord = aPairSeq(1).second;
return Standard_True;
}
static void RelocatePCurvesToNewUorigin(const TopTools_SequenceOfShape& theEdges,
@@ -3308,11 +3297,8 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
//so that all the faces are in [origin, origin + Uperiod]
Standard_Real aMinCoord, aMaxCoord; //Umin, Umax;
Standard_Integer aNumberOfIntervals, i_face_max;
if (!FindCoordBounds(faces, F_RefFace, aMapEF, edgesMap, ii + 1, aPeriods[ii],
aMinCoord, aMaxCoord, aNumberOfIntervals, i_face_max))
{
break;
}
FindCoordBounds (faces, F_RefFace, aMapEF, edgesMap, ii+1, aPeriods[ii],
aMinCoord, aMaxCoord, aNumberOfIntervals, i_face_max);
if (aMaxCoord - aMinCoord > aPeriods[ii] - 1.e-5)
anIsSeamFound[ii] = Standard_True;
@@ -3617,10 +3603,6 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
ReconstructMissedSeam (RemovedEdges, F_RefFace, CurEdge, CurVertex, CurPoint,
Uperiod, Vperiod, NextEdge, NextPoint);
if (NextEdge.IsNull())
{
return;
}
}
else
return;

View File

@@ -92,8 +92,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
Handle(Standard_Transient)& theInfo,
const Handle(ShapeBuild_ReShape)& theReShape,
const Message_ProgressRange& theProgress,
const Standard_Boolean theNonManifold,
const TopAbs_ShapeEnum theDetalisationLevel) const
const Standard_Boolean theNonManifold) const
{
if (theShape.IsNull())
{
@@ -115,7 +114,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
aRscfile = thePrscfile;
aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
}
aContext->SetDetalisation(theDetalisationLevel);
aContext->SetDetalisation(TopAbs_EDGE);
}
aContext->SetNonManifold(theNonManifold);
theInfo = aContext;
@@ -200,13 +199,12 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
const Message_ProgressRange& theProgress,
const Standard_Boolean theNonManifold,
const TopAbs_ShapeEnum theDetalisationLevel) const
const Standard_Boolean theNonManifold) const
{
Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape();
return ProcessShape(theShape, thePrec, theMaxTol, thePrscfile,
thePseq, theInfo, aReShape, theProgress,
theNonManifold, theDetalisationLevel);
theNonManifold);
}
//=======================================================================

View File

@@ -19,10 +19,9 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Message_ProgressRange.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <Standard_Integer.hxx>
#include <Message_ProgressRange.hxx>
class ShapeBuild_ReShape;
class XSAlgo_ToolContainer;
@@ -72,8 +71,7 @@ public:
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
const Message_ProgressRange& theProgress = Message_ProgressRange(),
const Standard_Boolean theNonManifold = Standard_False,
const TopAbs_ShapeEnum theDetalisationLevel = TopAbs_VERTEX) const;
const Standard_Boolean theNonManifold = Standard_False) const;
//! Does shape processing with specified tolerances
//! @param[in] theShape shape to process
@@ -94,8 +92,7 @@ public:
Handle(Standard_Transient)& theInfo,
const Handle(ShapeBuild_ReShape)& theReShape,
const Message_ProgressRange& theProgress = Message_ProgressRange(),
const Standard_Boolean theNonManifold = Standard_False,
const TopAbs_ShapeEnum theDetalisationLevel = TopAbs_VERTEX) const;
const Standard_Boolean theNonManifold = Standard_False) const;
//! Checks quality of pcurve of the edge on the given face,
//! and corrects it if necessary.

View File

@@ -1,10 +0,0 @@
puts "========================================="
puts "0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain fails on specific STEP model"
puts "========================================="
puts ""
testreadstep [locate_data_file bug33398.step] s
unifysamedom result s
checknbshapes result -vertex 506 -edge 908 -wire 394 -face 382 -shell 4 -solid 4
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,19 +0,0 @@
puts "TODO CR33439 ALL: Error : is WRONG because number of EDGE entities in shape"
puts "TODO CR33439 ALL: Error : is WRONG because number of WIRE entities in shape"
puts "TODO CR33439 ALL: Error : is WRONG because number of FACE entities in shape"
puts "========================================="
puts "0033421: Modeling Algorithms - ShapeUpgrade_UnifySameDomain fails"
puts "========================================="
puts ""
pcylinder c1 10 10
copy c1 c2
tmirror c2 0 0 10 0 0 1
bop c1 c2
bopfuse c3
unifysamedom result c3
checknbshapes result -t -solid 1 -shell 1 -face 3 -wire 3 -edge 3 -vertex 3
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,14 +0,0 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate1.brep] s
offsetparameter 1e-7 p i
offsetload s 100
offsetperform r
checkshape r
checknbshapes r -vertex 22 -edge 32 -wire 11 -face 11
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,12 +0,0 @@
puts "REQUIRED ALL: ERROR. Can not trim edges."
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate2.brep] s
offsetparameter 1e-7 p i
offsetload s -30
offsetperform r

View File

@@ -1,14 +0,0 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate3.brep] s
offsetparameter 1e-7 p i
offsetload s 4
offsetperform r
checkshape r
checknbshapes r -vertex 25 -edge 36 -wire 12 -face 12
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,14 +0,0 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate4.brep] s
offsetparameter 1e-7 p i
offsetload s 2
offsetperform r
checkshape r
checknbshapes r -vertex 22 -edge 31 -wire 10 -face 10
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,14 +0,0 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate5.brep] s
offsetparameter 1e-7 p i
offsetload s 2
offsetperform r
checkshape r
checknbshapes r -vertex 39 -edge 57 -wire 19 -face 19
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -1,14 +0,0 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate7.brep] s
offsetparameter 1e-7 p i
offsetload s 60
offsetperform r
checkshape r
checknbshapes r -vertex 15 -edge 21 -wire 7 -face 7
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,13 @@
puts "================================================================="
puts "0033418: Modeling Algorithms - BRepExtrema_DistShapeShape wrong arc ellipse - point result"
puts "================================================================="
puts ""
ellipse el 0 0 0 0 1 0 1 1
trim el el 4.71238898038 1.57079632679
mkedge el el
vertex v 0 0 1.5
distmini d el v
if {[dval d_val] > 0.5000001} {
puts "ERROR: Wrong distance calculation"
}

View File

@@ -1,27 +0,0 @@
puts "=================================="
puts "0032681: Data Exchange - Missed dimension after STEP export"
puts "Check adding of dimension"
puts "=================================="
pload DCAF
ReadStep D [locate_data_file bug32681.stp]
XGetOneShape s D
explode s V
XAddSubShape D s_1 0:1:1:1
XAddSubShape D s_84 0:1:1:1
XAddDimension D 0:1:1:1:57 0:1:1:1:58
param write.step.schema 5
param write.surfacecurve.mode 0
set tmpFile ${imagedir}/tmpFile.stp
WriteStep D $tmpFile
Close D
ReadStep D1 $tmpFile
set str [XDumpDGTs D1 all]
if {[string first "0:1:1:1:57" $str] == -1 || [string first "0:1:1:1:58" $str] == -1} {
puts "Error: don't find subshape"
}
Close D1
file delete $tmpFile
param write.step.schema 4
param write.surfacecurve.mode 1

View File

@@ -25,5 +25,4 @@
025 update_tolerance_locked
026 checkshape
027 split_number
028 split_two_numbers
029 wire_fix_curves
028 split_two_numbers

View File

@@ -1,16 +0,0 @@
#############################################################
## Fix wire algo
## moves a curve of invalid wire to make it valid
#############################################################
circle c1 0 0 0 15
circle c2 0 0 0 15
trim c1 c1 0 pi
trim c2 c2 pi 2*pi
translate c1 0 0 0.00000005
translate c2 0 0 -0.00000005
mkedge c1 c1
mkedge c2 c2
strongwire w c1 c2
checkshape w
whatis w

View File

@@ -1,16 +0,0 @@
#############################################################
## Fix wire algo
## moves a curve of invalid wire to make it valid
#############################################################
ellipse e1 0 0 0 25 15
ellipse e2 0 0 0 25 15
trim e1 e1 0 pi
trim e2 e2 pi 2*pi
translate e1 0 0 0.00000005
translate e2 0 0 -0.00000005
mkedge e1 e1
mkedge e2 e2
strongwire w e1 e2
checkshape w
whatis w

View File

@@ -1,18 +0,0 @@
#############################################################
## Fix wire algo
## moves a curve of invalid wire to make it valid
#############################################################
point px 100 0 0
point py 0 100 0
point pz 0 0 100
vertex vx px
vertex vy py
edge exy vx vy
gcarc arc cir py pz px
mkedge earc arc
strongwire w exy earc
whatis w

View File

@@ -1,23 +0,0 @@
#############################################################
## Fix wire algo
## moves a curve of invalid wire to make it valid
#############################################################
point p1 0 0 0
point p2 100 0 0
point p4 100 110 0
gcarc arc cir p1 p2 p4
mkedge arc1 arc
mkedge arc2 arc
tmirror arc2 0 0 0 -110 100 0 -copy
ttranslate arc2 0 0 0.003 -copy
strongwire w1 arc1 arc2 -t 0.01 -m keepType
checkshape w1
whatis w1

View File

@@ -1,14 +0,0 @@
#############################################################
## Fix wire algo
## moves a curve of invalid wire to make it valid
#############################################################
bsplinecurve c1 3 2 -1.0 4 1.0 4 0 0 0 1 1 4 0 1 2 4 0 1 3 0 0 1
bsplinecurve c2 3 2 -1.0 4 1.0 4 0 0 0 1 1 -4 0 1 2 -4 0 1 3 0 0 1
translate c1 0 0 0.00000005
translate c2 0 0 -0.00000005
mkedge c1 c1
mkedge c2 c2
strongwire w c1 c2
checkshape w
whatis w

View File

@@ -1,17 +0,0 @@
#############################################################
## Fix wire algo
## moves a curve of invalid wire to make it valid
#############################################################
vertex v1 0 0 0
vertex v2 100 0 0
vertex v3 50 100 0
edge e1 v1 v2
edge e2 v2 v3
edge e3 v3 v1
strongwire w1 e1 e2 e3
checkshape w1
whatis w1

View File

@@ -1,7 +0,0 @@
restore [locate_data_file bug33420.brep] s
OFFSETSHAPE 35 {} $calcul $type
checkprops result -v 4.04602e+07
checknbshapes result -face 43 -shell 1

View File

@@ -1,5 +1,3 @@
puts "TODO OCC27414 ALL: Error : The area of result shape is"
restore [locate_data_file bug26917_M2_trim33.brep] s
OFFSETSHAPE 8 {} $calcul $type

View File

@@ -7,4 +7,4 @@ offsetperform result
checkprops result -s 6.21471e+06 -v 8.95633e+08
unifysamedom result_unif result
checknbshapes result_unif -wire 142 -face 140 -shell 1 -solid 1
checknbshapes result_unif -wire 140 -face 138 -shell 1 -solid 1