-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "GEOM_Function.hxx"
#include "GEOM_IOperations.hxx"
#include "GEOMUtils.hxx"
-#include "GEOMAlgo_FinderShapeOn1.hxx"
#include "GEOMAlgo_FinderShapeOn2.hxx"
#include "GEOMAlgo_ClsfBox.hxx"
+#include "GEOMAlgo_ClsfSurf.hxx"
#include "GEOMAlgo_Splitter.hxx"
#include "Geom_CylindricalSurface.hxx"
#include <gp_Pln.hxx>
#include <gp_Dir.hxx>
#include <gp_Trsf.hxx>
-#include <TFunction_Logbook.hxx>
#include <StdFail_NotDone.hxx>
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <vector>
+// Undefine below macro to enable workaround about problem with wrong
+// tolerances of intersection curves in MakePipeTShape and MakeQuarterPipeTShape
+// VSR 30/12/2014: macro enabled
+#define FIX_CURVES_TOLERANCES
+
//=======================================================================
//function : GetID
//purpose :
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
TCollection_AsciiString aMsg (" iErr : ");
aMsg += TCollection_AsciiString(iErr);
}
// Call algo
- GEOMAlgo_FinderShapeOn1 aFinder;
- Standard_Real aTol = 1e-6;
+ GEOMAlgo_FinderShapeOn2 aFinder;
+ Handle(GEOMAlgo_ClsfSurf) aClsfSurf = new GEOMAlgo_ClsfSurf;
+ Standard_Real aTol = 1e-6;
+ aClsfSurf->SetSurface(theSurface);
aFinder.SetShape(theShape);
aFinder.SetTolerance(aTol);
- aFinder.SetSurface(theSurface);
+ aFinder.SetClsf(aClsfSurf);
aFinder.SetShapeType(theShapeType);
aFinder.SetState(theState);
// Default value=3
aFinder.SetNbPntsMin(3);
// Sets the maximal number of inner points for edges or faces.
- // It is usefull for the cases when this number is very big (e.g =2000) to improve
+ // It is useful for the cases when this number is very big (e.g =2000) to improve
// the performance. If this value =0, all inner points will be taken into account.
// Default value=0
aFinder.SetNbPntsMax(0);
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn2.cxx
if (iErr) {
// MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
return aSeqOfIDs;
}
// Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn2.cxx
// if (iWrn) {
// MESSAGE(" *** iWrn : " << iWrn);
// }
//purpose :
//=======================================================================
TopoDS_Shape AdvancedEngine_PipeTShapeDriver::MakePipeTShape (const double r1, const double w1, const double l1,
- const double r2, const double w2, const double l2) const
+ const double r2, const double w2, const double l2) const
{
double r1Ext = r1 + w1;
double r2Ext = r2 + w2;
gp_Pnt aP0 (0, 0, 0);
gp_Pnt aP1 (-l1, 0, 0);
- gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
+ gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
gp_Ax2 anAxes1 (aP1, aVX, aVZ);
gp_Ax2 anAxes2 (aP0, aVZ, aVX);
// Remove small radius main pipe
BRepAlgoAPI_Cut cut1 (fuse1.Shape(), C1Int.Shape());
if (!cut1.IsDone()) {
- StdFail_NotDone::Raise("Coudn't cut cylinders");
+ StdFail_NotDone::Raise("Couldn't cut cylinders");
}
// Remove small radius incident pipe => Te
BRepAlgoAPI_Cut Te (cut1.Shape(), C2Int.Shape());
if (!Te.IsDone()) {
- StdFail_NotDone::Raise("Coudn't cut cylinders");
+ StdFail_NotDone::Raise("Couldn't cut cylinders");
}
- return Te.Shape();
+ TopoDS_Shape aShape = Te.Shape();
+
+ // VSR: 30/12/2014: temporary workaround about intersection curves problem
+#ifdef FIX_CURVES_TOLERANCES
+ GEOMUtils::FixShapeCurves(aShape);
+#endif
+
+ return aShape;
}
//=======================================================================
//purpose :
//=======================================================================
TopoDS_Shape AdvancedEngine_PipeTShapeDriver::MakeQuarterPipeTShape (const double r1, const double w1, const double l1,
- const double r2, const double w2, const double l2) const
+ const double r2, const double w2, const double l2) const
{
TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2);
if (Te.IsNull())
StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
}
+ TopoDS_Shape aShape = Te4.Shape();
+
+ // VSR: 30/12/2014: temporary workaround about intersection curves problem
+#ifdef FIX_CURVES_TOLERANCES
+ GEOMUtils::FixShapeCurves(aShape);
+#endif
+
return Te4.Shape();
}
//function : Execute
//purpose :
//=======================================================================
-Standard_Integer AdvancedEngine_PipeTShapeDriver::Execute (TFunction_Logbook& log) const
+Standard_Integer AdvancedEngine_PipeTShapeDriver::Execute(Handle(TFunction_Logbook)& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
aFunction->SetValue(aShape);
- log.SetTouched(Label());
+ log->SetTouched(Label());
return 1;
}
return true;
}
-IMPLEMENT_STANDARD_HANDLE (AdvancedEngine_PipeTShapeDriver,GEOM_BaseDriver);
IMPLEMENT_STANDARD_RTTIEXT (AdvancedEngine_PipeTShapeDriver,GEOM_BaseDriver);