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

0027325: [Regression to 6.9.1] geom/revolution_00/A1: BOPTools_AlgoTools2D::AttachExistingPCurve doesn't work

1. Check, if edge is same-range, is now made with some tolerance (not strictly) in GeomLib_CheckCurveOnSurface class. Default value of this tolerance is Precision::PConfusion(). However, this value can be changed with corresponding interface.

2. DRAW-command "attachpcurve" has been added to BOPTest_UtilityCommands.cxx file. This command creates p-curve of given edge on given face. It can assign 2D-curve of one of the edge already included in the face or (if it is not possible) rebuilds new 2D-curve.

Creation of test case for this issue.
Adjusting test case boolean volumemaker A8 according to its new behavior on Windows.
This commit is contained in:
nbv 2016-04-01 14:54:12 +03:00 committed by abv
parent 4c0d97ac42
commit 6ca1c7466b
11 changed files with 172 additions and 20 deletions

View File

@ -44,6 +44,7 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands)
BOPTest::HistoryCommands (theCommands);
BOPTest::DebugCommands (theCommands);
BOPTest::CellsCommands (theCommands);
BOPTest::UtilityCommands (theCommands);
}
//=======================================================================
//function : Factory

View File

@ -58,7 +58,9 @@ public:
Standard_EXPORT static void DebugCommands (Draw_Interpretor& aDI);
Standard_EXPORT static void CellsCommands (Draw_Interpretor& aDI);
Standard_EXPORT static void UtilityCommands (Draw_Interpretor& aDI);
protected:

View File

@ -0,0 +1,104 @@
// Created on: 2016-04-01
// Created by: Nikolai BUKHALOV
// Copyright (c) 2000-2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPTest.hxx>
#include <BOPTools_AlgoTools2D.hxx>
#include <DBRep.hxx>
#include <IntTools_Context.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
static Standard_Integer attachpcurve (Draw_Interpretor&, Standard_Integer, const char**);
//=======================================================================
//function : BOPCommands
//purpose :
//=======================================================================
void BOPTest::UtilityCommands(Draw_Interpretor& theCommands)
{
static Standard_Boolean done = Standard_False;
if (done) return;
done = Standard_True;
// Chapter's name
const char* group = "BOPTest commands";
// Commands
theCommands.Add("attachpcurve", "attachpcurve eold enew face", __FILE__, attachpcurve, group);
}
//=======================================================================
//function : BOPCommands
//purpose : Attaches p-curve of the given edge to the given face.
//=======================================================================
static Standard_Integer attachpcurve(Draw_Interpretor& theDI,
Standard_Integer theNArg,
const char ** theArgVal)
{
if (theNArg != 4)
{
theDI << "Use: " << theArgVal[0] << " eold enew face\n";
return 1;
}
TopoDS_Shape aShEOld(DBRep::Get(theArgVal[1]));
TopoDS_Shape aShENew(DBRep::Get(theArgVal[2]));
TopoDS_Shape aShFace(DBRep::Get(theArgVal[3]));
if (aShEOld.IsNull()) {
theDI << theArgVal[1] << " is null shape\n";
return 1;
} else if (aShEOld.ShapeType() != TopAbs_EDGE) {
theDI << theArgVal[1] << " is not an edge\n";
return 1;
}
if (aShENew.IsNull()) {
theDI << theArgVal[2] << " is null shape\n";
return 1;
} else if (aShENew.ShapeType() != TopAbs_EDGE) {
theDI << theArgVal[2] << " is not an edge\n";
return 1;
}
if (aShFace.IsNull()) {
theDI << theArgVal[3] << " is null shape\n";
return 1;
} else if (aShFace.ShapeType() != TopAbs_FACE) {
theDI << theArgVal[3] << " is not a face\n";
return 1;
}
TopoDS_Edge aEOld = TopoDS::Edge(aShEOld);
TopoDS_Edge aENew = TopoDS::Edge(aShENew);
TopoDS_Face aFace = TopoDS::Face(aShFace);
// Try to copy PCurve from old edge to the new one.
Handle(IntTools_Context) aCtx = new IntTools_Context;
const Standard_Integer iRet =
BOPTools_AlgoTools2D::AttachExistingPCurve(aEOld, aENew, aFace, aCtx);
if (iRet) {
theDI << "Error! Code: " << iRet << "\n";
} else {
theDI << "PCurve is attached successfully\n";
}
return 0;
}

View File

@ -15,3 +15,4 @@ BOPTest_TolerCommands.cxx
BOPTest_HistoryCommands.cxx
BOPTest_DebugCommands.cxx
BOPTest_CellsCommands.cxx
BOPTest_UtilityCommands.cxx

View File

@ -114,7 +114,7 @@ Standard_Integer BOPTools_AlgoTools2D::AttachExistingPCurve
Handle(Geom_Surface) aSF = BRep_Tool::Surface(aF);
//
bComp = IntTools_Tools::ComputeTolerance
(aCE1, aC2DT, aSF, aT11, aT12, aTolSP, aTMax);
(aCE1, aC2DT, aSF, aT11, aT12, aTolSP, aTMax, aTolPPC);
if (!bComp) {
iRet = 3;
return iRet;

View File

@ -310,7 +310,8 @@ GeomLib_CheckCurveOnSurface::GeomLib_CheckCurveOnSurface()
myLast(0.),
myErrorStatus(0),
myMaxDistance(RealLast()),
myMaxParameter(0.)
myMaxParameter(0.),
myTolRange(Precision::PConfusion())
{
}
@ -322,14 +323,16 @@ GeomLib_CheckCurveOnSurface::
GeomLib_CheckCurveOnSurface(const Handle(Geom_Curve)& theCurve,
const Handle(Geom_Surface)& theSurface,
const Standard_Real theFirst,
const Standard_Real theLast):
const Standard_Real theLast,
const Standard_Real theTolRange):
myCurve(theCurve),
mySurface(theSurface),
myFirst(theFirst),
myLast(theLast),
myErrorStatus(0),
myMaxDistance(RealLast()),
myMaxParameter(0.)
myMaxParameter(0.),
myTolRange(theTolRange)
{
}
@ -346,6 +349,7 @@ void GeomLib_CheckCurveOnSurface::Init()
myErrorStatus = 0;
myMaxDistance = RealLast();
myMaxParameter = 0.0;
myTolRange = Precision::PConfusion();
}
//=======================================================================
@ -355,7 +359,8 @@ void GeomLib_CheckCurveOnSurface::Init()
void GeomLib_CheckCurveOnSurface::Init( const Handle(Geom_Curve)& theCurve,
const Handle(Geom_Surface)& theSurface,
const Standard_Real theFirst,
const Standard_Real theLast)
const Standard_Real theLast,
const Standard_Real theTolRange)
{
myCurve = theCurve;
mySurface = theSurface;
@ -364,13 +369,13 @@ void GeomLib_CheckCurveOnSurface::Init( const Handle(Geom_Curve)& theCurve,
myErrorStatus = 0;
myMaxDistance = RealLast();
myMaxParameter = 0.0;
myTolRange = theTolRange;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
#ifndef HAVE_TBB
//After fixing bug # 26365, this fragment should be deleted
//(together the text "#ifdef HAVE_TBB")
@ -392,10 +397,10 @@ void GeomLib_CheckCurveOnSurface::Perform(const Handle(Geom2d_Curve)& thePCurve,
return;
}
if( (myCurve->FirstParameter() > myFirst) ||
(myCurve->LastParameter() < myLast) ||
(thePCurve->FirstParameter() > myFirst) ||
(thePCurve->LastParameter() < myLast))
if(((myCurve->FirstParameter() - myFirst) > myTolRange) ||
((myCurve->LastParameter() - myLast) < -myTolRange) ||
((thePCurve->FirstParameter() - myFirst) > myTolRange) ||
((thePCurve->LastParameter() - myLast) < -myTolRange))
{
myErrorStatus = 2;
return;

View File

@ -16,6 +16,7 @@
#define _GeomLib_CheckCurveOnSurface_HeaderFile
#include <Geom_Curve.hxx>
#include <Precision.hxx>
#include <Standard.hxx>
class Geom_Surface;
@ -33,16 +34,20 @@ public:
Standard_EXPORT GeomLib_CheckCurveOnSurface(void);
//! Contructor
Standard_EXPORT GeomLib_CheckCurveOnSurface(const Handle(Geom_Curve)& theCurve,
const Handle(Geom_Surface)& theSurface,
const Standard_Real theFirst,
const Standard_Real theLast);
Standard_EXPORT
GeomLib_CheckCurveOnSurface(const Handle(Geom_Curve)& theCurve,
const Handle(Geom_Surface)& theSurface,
const Standard_Real theFirst,
const Standard_Real theLast,
const Standard_Real theTolRange =
Precision::PConfusion());
//! Sets the data for the algorithm
Standard_EXPORT void Init (const Handle(Geom_Curve)& theCurve,
const Handle(Geom_Surface)& theSurface,
const Standard_Real theFirst,
const Standard_Real theLast);
const Standard_Real theLast,
const Standard_Real theTolRange = Precision::PConfusion());
//! Initializes all members by dafault values
Standard_EXPORT void Init();
@ -112,6 +117,7 @@ private:
Standard_Integer myErrorStatus;
Standard_Real myMaxDistance;
Standard_Real myMaxParameter;
Standard_Real myTolRange;
};
#endif // _BRepLib_CheckCurveOnSurface_HeaderFile

View File

@ -787,11 +787,12 @@ Standard_Boolean IntTools_Tools::ComputeTolerance
const Standard_Real theFirst,
const Standard_Real theLast,
Standard_Real& theMaxDist,
Standard_Real& theMaxPar)
Standard_Real& theMaxPar,
const Standard_Real theTolRange)
{
GeomLib_CheckCurveOnSurface aCS;
//
aCS.Init(theCurve3D, theSurf, theFirst, theLast);
aCS.Init(theCurve3D, theSurf, theFirst, theLast, theTolRange);
aCS.Perform(theCurve2D);
if (!aCS.IsDone()) {
return Standard_False;

View File

@ -25,6 +25,7 @@
#include <TopAbs_State.hxx>
#include <Standard_Real.hxx>
#include <IntTools_SequenceOfCurves.hxx>
#include <Precision.hxx>
class TopoDS_Vertex;
class TopoDS_Wire;
class TopoDS_Face;
@ -160,7 +161,16 @@ public:
//! Computes the max distance between points
//! taken from 3D and 2D curves by the same parameter
Standard_EXPORT static Standard_Boolean ComputeTolerance (const Handle(Geom_Curve)& theCurve3D, const Handle(Geom2d_Curve)& theCurve2D, const Handle(Geom_Surface)& theSurf, const Standard_Real theFirst, const Standard_Real theLast, Standard_Real& theMaxDist, Standard_Real& theMaxPar);
Standard_EXPORT static
Standard_Boolean ComputeTolerance(const Handle(Geom_Curve)& theCurve3D,
const Handle(Geom2d_Curve)& theCurve2D,
const Handle(Geom_Surface)& theSurf,
const Standard_Real theFirst,
const Standard_Real theLast,
Standard_Real& theMaxDist,
Standard_Real& theMaxPar,
const Standard_Real theTolRange =
Precision::PConfusion());
//! Computes the correct Intersection range for

View File

@ -1,7 +1,7 @@
# test script on make volume operation
# plane sphere
puts "TODO OCC26020 ALL: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC26020 Linux: Faulty shapes in variables faulty_1 to faulty_"
puts "TODO OCC26020 ALL: Error: bopcheck failed"
puts "TODO OCC26020 ALL: Error : The area of result shape is"

View File

@ -0,0 +1,22 @@
puts "============"
puts "OCC27325"
puts "============"
puts ""
###############################
## [Regression to 6.9.1] geom/revolution_00/A1: BOPTools_AlgoTools2D::AttachExistingPCurve doesn't work
###############################
restore [locate_data_file bug27325_edge.brep] en
restore [locate_data_file bug27325_face.brep] f
explode f e
attachpcurve f_3 en f
#Check attached p-curve
pcurve result en f
#whatis result
set ind [string first "2d curve" [whatis result]]
if {${ind} < 0} {
puts "Error: PCurve has not been attached"
} else {
dump result
}