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.
BOPTest::HistoryCommands (theCommands);
BOPTest::DebugCommands (theCommands);
BOPTest::CellsCommands (theCommands);
+ BOPTest::UtilityCommands (theCommands);
}
//=======================================================================
//function : Factory
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:
--- /dev/null
+// 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;
+}
BOPTest_HistoryCommands.cxx
BOPTest_DebugCommands.cxx
BOPTest_CellsCommands.cxx
+BOPTest_UtilityCommands.cxx
\ No newline at end of file
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;
myLast(0.),
myErrorStatus(0),
myMaxDistance(RealLast()),
- myMaxParameter(0.)
+ myMaxParameter(0.),
+ myTolRange(Precision::PConfusion())
{
}
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)
{
}
myErrorStatus = 0;
myMaxDistance = RealLast();
myMaxParameter = 0.0;
+ myTolRange = Precision::PConfusion();
}
//=======================================================================
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;
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")
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;
#define _GeomLib_CheckCurveOnSurface_HeaderFile
#include <Geom_Curve.hxx>
+#include <Precision.hxx>
#include <Standard.hxx>
class Geom_Surface;
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();
Standard_Integer myErrorStatus;
Standard_Real myMaxDistance;
Standard_Real myMaxParameter;
+ Standard_Real myTolRange;
};
#endif // _BRepLib_CheckCurveOnSurface_HeaderFile
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;
#include <TopAbs_State.hxx>
#include <Standard_Real.hxx>
#include <IntTools_SequenceOfCurves.hxx>
+#include <Precision.hxx>
class TopoDS_Vertex;
class TopoDS_Wire;
class TopoDS_Face;
//! 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
# 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"
--- /dev/null
+ 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
+}
\ No newline at end of file