Skip to content

Commit

Permalink
removed references to OCC<7
Browse files Browse the repository at this point in the history
  • Loading branch information
mosfet80 authored and donovaly committed Jun 25, 2022
1 parent e9890c0 commit 93525ff
Show file tree
Hide file tree
Showing 46 changed files with 49 additions and 714 deletions.
5 changes: 0 additions & 5 deletions src/Mod/Import/App/AppImportPy.cpp
Expand Up @@ -356,12 +356,7 @@ class Module : public Py::ExtensionModule<Module>
// writer.SetColorMode(Standard_False);
writer.Transfer(hDoc, STEPControl_AsIs);

// edit STEP header
#if OCC_VERSION_HEX >= 0x060500
APIHeaderSection_MakeHeader makeHeader(writer.ChangeWriter().Model());
#else
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
#endif
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");

Expand Down
4 changes: 0 additions & 4 deletions src/Mod/Import/App/ExportOCAF.cpp
Expand Up @@ -73,11 +73,7 @@
# include <TopoDS_Iterator.hxx>
# include <APIHeaderSection_MakeHeader.hxx>
# include <OSD_Exception.hxx>
#if OCC_VERSION_HEX >= 0x060500
# include <TDataXtd_Shape.hxx>
# else
# include <TDataStd_Shape.hxx>
# endif
#endif

#include <Base/Console.h>
Expand Down
4 changes: 0 additions & 4 deletions src/Mod/Import/App/ImportOCAF.cpp
Expand Up @@ -75,11 +75,7 @@
# include <TopoDS_Iterator.hxx>
# include <APIHeaderSection_MakeHeader.hxx>
# include <OSD_Exception.hxx>
#if OCC_VERSION_HEX >= 0x060500
# include <TDataXtd_Shape.hxx>
# else
# include <TDataStd_Shape.hxx>
# endif
#endif

#include <boost/algorithm/string.hpp>
Expand Down
4 changes: 0 additions & 4 deletions src/Mod/Import/App/ImportOCAFAssembly.cpp
Expand Up @@ -56,11 +56,7 @@
# include <TopoDS_Iterator.hxx>
# include <APIHeaderSection_MakeHeader.hxx>
# include <OSD_Exception.hxx>
#if OCC_VERSION_HEX >= 0x060500
# include <TDataXtd_Shape.hxx>
# else
# include <TDataStd_Shape.hxx>
# endif
#endif

#include "ImportOCAFAssembly.h"
Expand Down
9 changes: 1 addition & 8 deletions src/Mod/Import/Gui/AppImportGuiPy.cpp
Expand Up @@ -71,11 +71,7 @@
# include <XSControl_TransferReader.hxx>
# include <XSControl_WorkSession.hxx>

#if OCC_VERSION_HEX >= 0x060500
# include <TDataXtd_Shape.hxx>
# else
# include <TDataStd_Shape.hxx>
# endif
#if OCC_VERSION_HEX >= 0x070500
# include <Message_ProgressRange.hxx>
# include <RWGltf_CafWriter.hxx>
Expand Down Expand Up @@ -644,11 +640,8 @@ class Module : public Py::ExtensionModule<Module>
writer.Transfer(hDoc, STEPControl_AsIs);

// edit STEP header
#if OCC_VERSION_HEX >= 0x060500
APIHeaderSection_MakeHeader makeHeader(writer.ChangeWriter().Model());
#else
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
#endif

Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");

Expand Down
8 changes: 1 addition & 7 deletions src/Mod/MeshPart/App/MeshFlattening.cpp
Expand Up @@ -196,15 +196,9 @@ ColMat<double, 3> FaceUnwrapper::interpolateFlatFace(const TopoDS_Face& face)
// extract xyz poles, knots, weights, degree
const Handle(Geom_Surface) &_surface = BRep_Tool::Surface(face);
const Handle(Geom_BSplineSurface) &_bspline = Handle(Geom_BSplineSurface)::DownCast(_surface);
#if OCC_VERSION_HEX < 0x070000
TColStd_Array1OfReal _uknots(1, _bspline->NbUPoles() + _bspline->UDegree() + 1);
TColStd_Array1OfReal _vknots(1, _bspline->NbVPoles() + _bspline->VDegree() + 1);
_bspline->UKnotSequence(_uknots);
_bspline->VKnotSequence(_vknots);
#else

const TColStd_Array1OfReal &_uknots = _bspline->UKnotSequence();
const TColStd_Array1OfReal &_vknots = _bspline->VKnotSequence();
#endif

Eigen::VectorXd weights;
weights.resize(_bspline->NbUPoles() * _bspline->NbVPoles());
Expand Down
6 changes: 1 addition & 5 deletions src/Mod/Part/App/AppPartPy.cpp
Expand Up @@ -1172,11 +1172,7 @@ class Module : public Py::ExtensionModule<Module>
aPlane = new Geom_Plane(p, d);
}

BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width
#if OCC_VERSION_HEX >= 0x060502
, Precision::Confusion()
#endif
);
BRepBuilderAPI_MakeFace Face(aPlane, 0.0, length, 0.0, width, Precision::Confusion() );
return Py::asObject(new TopoShapeFacePy(new TopoShape((Face.Face()))));
}
catch (Standard_DomainError&) {
Expand Down
4 changes: 1 addition & 3 deletions src/Mod/Part/App/Attacher.cpp
Expand Up @@ -495,10 +495,8 @@ eRefType AttachEngine::getShapeType(const TopoDS_Shape& sh)
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
#if OCC_VERSION_HEX >= 0x070000
case GeomAbs_OffsetCurve:
#endif
return rtCurve;
return rtCurve;
}
}break;
case TopAbs_WIRE:
Expand Down
5 changes: 0 additions & 5 deletions src/Mod/Part/App/BRepOffsetAPI_MakeOffsetFix.cpp
Expand Up @@ -52,12 +52,7 @@ BRepOffsetAPI_MakeOffsetFix::BRepOffsetAPI_MakeOffsetFix()

BRepOffsetAPI_MakeOffsetFix::BRepOffsetAPI_MakeOffsetFix(const GeomAbs_JoinType Join, const Standard_Boolean IsOpenResult)
{
#if OCC_VERSION_HEX >= 0x060900
mkOffset.Init(Join, IsOpenResult);
#else
(void)IsOpenResult;
mkOffset.Init(Join);
#endif
}

BRepOffsetAPI_MakeOffsetFix::~BRepOffsetAPI_MakeOffsetFix()
Expand Down
43 changes: 0 additions & 43 deletions src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp
Expand Up @@ -142,7 +142,6 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject *args)

PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
{
#if OCC_VERSION_HEX >= 0x060700
PyObject *spine, *curv, *keep;
if (!PyArg_ParseTuple(args, "O!O!O!",&Part::TopoShapePy::Type,&spine
,&PyBool_Type,&curv
Expand Down Expand Up @@ -178,31 +177,6 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args)
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
return nullptr;
}
#else
PyObject *spine, *curv, *keep;
if (!PyArg_ParseTuple(args, "O!O!O!",&Part::TopoShapePy::Type,&spine
,&PyBool_Type,&curv
,&PyBool_Type,&keep))
return 0;

try {
const TopoDS_Shape& s = static_cast<Part::TopoShapePy*>(spine)->getTopoShapePtr()->getShape();
if (s.IsNull() || s.ShapeType() != TopAbs_WIRE) {
PyErr_SetString(PyExc_TypeError, "spine is not a wire");
return 0;
}

this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(
TopoDS::Wire(s),
PyObject_IsTrue(curv) ? Standard_True : Standard_False,
PyObject_IsTrue(keep) ? Standard_True : Standard_False);
Py_Return;
}
catch (Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
return 0;
}
#endif
}

PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds)
Expand Down Expand Up @@ -440,14 +414,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject *args)
return nullptr;

try {
#if OCC_VERSION_HEX >= 0x060800
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMaxDegree(degree);
Py_Return;
#else
(void)args;
PyErr_SetString(PyExc_RuntimeError, "requires OCC >= 6.8");
return 0;
#endif
}
catch (Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
Expand All @@ -462,14 +430,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject *args)
return nullptr;

try {
#if OCC_VERSION_HEX >= 0x060800
this->getBRepOffsetAPI_MakePipeShellPtr()->SetMaxSegments(nbseg);
Py_Return;
#else
(void)args;
PyErr_SetString(PyExc_RuntimeError, "requires OCC >= 6.8");
return 0;
#endif
}
catch (Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
Expand All @@ -484,13 +446,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args)
return nullptr;

try {
#if OCC_VERSION_HEX >= 0x060700
this->getBRepOffsetAPI_MakePipeShellPtr()->SetForceApproxC1(PyObject_IsTrue(obj) ? Standard_True : Standard_False);
Py_Return;
#else
PyErr_SetString(PyExc_RuntimeError, "requires OCC >= 6.7");
return 0;
#endif
}
catch (Standard_Failure& e) {
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
Expand Down
29 changes: 0 additions & 29 deletions src/Mod/Part/App/FeaturePartFuse.cpp
Expand Up @@ -112,34 +112,6 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void)
if (s.size() >= 2) {
try {
std::vector<ShapeHistory> history;
#if OCC_VERSION_HEX <= 0x060800
TopoDS_Shape resShape = s.front();
if (resShape.IsNull())
throw NullShapeException("Input shape is null");
for (std::vector<TopoDS_Shape>::iterator it = s.begin()+1; it != s.end(); ++it) {
if (it->IsNull())
throw NullShapeException("Input shape is null");

// Let's call algorithm computing a fuse operation:
BRepAlgoAPI_Fuse mkFuse(resShape, *it);
// Let's check if the fusion has been successful
if (!mkFuse.IsDone())
throw BooleanException("Fusion failed");
resShape = mkFuse.Shape();

ShapeHistory hist1 = buildHistory(mkFuse, TopAbs_FACE, resShape, mkFuse.Shape1());
ShapeHistory hist2 = buildHistory(mkFuse, TopAbs_FACE, resShape, mkFuse.Shape2());
if (history.empty()) {
history.push_back(hist1);
history.push_back(hist2);
}
else {
for (std::vector<ShapeHistory>::iterator jt = history.begin(); jt != history.end(); ++jt)
*jt = joinHistory(*jt, hist1);
history.push_back(hist2);
}
}
#else
BRepAlgoAPI_Fuse mkFuse;
TopTools_ListOfShape shapeArguments,shapeTools;
const TopoDS_Shape& shape = s.front();
Expand All @@ -163,7 +135,6 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void)
for (std::vector<TopoDS_Shape>::iterator it = s.begin(); it != s.end(); ++it) {
history.push_back(buildHistory(mkFuse, TopAbs_FACE, resShape, *it));
}
#endif
if (resShape.IsNull())
throw Base::RuntimeError("Resulting shape is null");

Expand Down
5 changes: 1 addition & 4 deletions src/Mod/Part/App/FeaturePartSection.cpp
Expand Up @@ -51,9 +51,7 @@ short Section::mustExecute() const
BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, const TopoDS_Shape& tool) const
{
// Let's call algorithm computing a section operation:
#if OCC_VERSION_HEX < 0x060900
return new BRepAlgoAPI_Section(base, tool);
#else

bool approx = Approximation.getValue();
std::unique_ptr<BRepAlgoAPI_Section> mkSection(new BRepAlgoAPI_Section());
mkSection->Init1(base);
Expand All @@ -63,5 +61,4 @@ BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, c
if (!mkSection->IsDone())
throw Base::RuntimeError("Section failed");
return mkSection.release();
#endif
}
8 changes: 1 addition & 7 deletions src/Mod/Part/App/Geom2d/Geometry2dPyImp.cpp
Expand Up @@ -143,13 +143,7 @@ PyObject* Geometry2dPy::transform(PyObject *args)
double a23 = static_cast<double>(Py::Float(list.getItem(5)));

gp_Trsf mat;
mat.SetValues(a11, a12, 0, a13,
a21, a22, 0, a23,
0 , 0, 1, 0
#if OCC_VERSION_HEX < 0x060800
, 0.00001,0.00001
#endif
); //precision was removed in OCCT CR0025194
mat.SetValues(a11, a12, 0, a13, a21, a22, 0, a23, 0, 0, 1, 0);
gp_Trsf2d trf(mat);

getGeometry2dPtr()->handle()->Transform(trf);
Expand Down
32 changes: 3 additions & 29 deletions src/Mod/Part/App/Geometry.cpp
Expand Up @@ -462,11 +462,7 @@ void Geometry::transform(const Base::Matrix4D& mat)
gp_Trsf trf;
trf.SetValues(mat[0][0],mat[0][1],mat[0][2],mat[0][3],
mat[1][0],mat[1][1],mat[1][2],mat[1][3],
mat[2][0],mat[2][1],mat[2][2],mat[2][3]
#if OCC_VERSION_HEX < 0x060800
, 0.00001,0.00001
#endif
); //precision was removed in OCCT CR0025194
mat[2][0],mat[2][1],mat[2][2],mat[2][3]);
handle()->Transform(trf);
}

Expand Down Expand Up @@ -2138,11 +2134,8 @@ void GeomArcOfConic::setXAxisDir(const Base::Vector3d& newdir)
Handle(Geom_TrimmedCurve) curve = Handle(Geom_TrimmedCurve)::DownCast(handle());
Handle(Geom_Conic) c = Handle(Geom_Conic)::DownCast( curve->BasisCurve() );
assert(!c.IsNull());
#if OCC_VERSION_HEX >= 0x060504

if (newdir.Sqr() < Precision::SquareConfusion())
#else
if (newdir.Length() < Precision::Confusion())
#endif
return;//zero vector was passed. Keep the old orientation.

try {
Expand Down Expand Up @@ -2722,11 +2715,7 @@ Base::Vector3d GeomEllipse::getMajorAxisDir() const
*/
void GeomEllipse::setMajorAxisDir(Base::Vector3d newdir)
{
#if OCC_VERSION_HEX >= 0x060504
if (newdir.Sqr() < Precision::SquareConfusion())
#else
if (newdir.Length() < Precision::Confusion())
#endif
return;//zero vector was passed. Keep the old orientation.
try {
gp_Ax2 pos = myCurve->Position();
Expand Down Expand Up @@ -2941,11 +2930,7 @@ void GeomArcOfEllipse::setMajorAxisDir(Base::Vector3d newdir)
{
Handle(Geom_Ellipse) c = Handle(Geom_Ellipse)::DownCast( myCurve->BasisCurve() );
assert(!c.IsNull());
#if OCC_VERSION_HEX >= 0x060504
if (newdir.Sqr() < Precision::SquareConfusion())
#else
if (newdir.Length() < Precision::Confusion())
#endif
return;//zero vector was passed. Keep the old orientation.
try {
gp_Ax2 pos = c->Position();
Expand Down Expand Up @@ -3379,11 +3364,7 @@ void GeomArcOfHyperbola::setMajorAxisDir(Base::Vector3d newdir)
{
Handle(Geom_Hyperbola) c = Handle(Geom_Hyperbola)::DownCast( myCurve->BasisCurve() );
assert(!c.IsNull());
#if OCC_VERSION_HEX >= 0x060504
if (newdir.Sqr() < Precision::SquareConfusion())
#else
if (newdir.Length() < Precision::Confusion())
#endif
return;//zero vector was passed. Keep the old orientation.

try {
Expand Down Expand Up @@ -4239,11 +4220,7 @@ TopoDS_Shape GeomSurface::toShape() const
Handle(Geom_Surface) s = Handle(Geom_Surface)::DownCast(handle());
Standard_Real u1,u2,v1,v2;
s->Bounds(u1,u2,v1,v2);
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2
#if OCC_VERSION_HEX >= 0x060502
, Precision::Confusion()
#endif
);
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion() );
return mkBuilder.Shape();
}

Expand All @@ -4255,7 +4232,6 @@ bool GeomSurface::tangentU(double u, double v, gp_Dir& dirU) const
prop.TangentU(dirU);
return true;
}

return false;
}

Expand Down Expand Up @@ -5555,13 +5531,11 @@ std::unique_ptr<GeomCurve> makeFromCurveAdaptor(const Adaptor3d_Curve& adapt)
geoCurve.reset(new GeomBSplineCurve(adapt.BSpline()));
break;
}
#if OCC_VERSION_HEX >= 0x070000
case GeomAbs_OffsetCurve:
{
geoCurve.reset(new GeomOffsetCurve(adapt.OffsetCurve()));
break;
}
#endif
case GeomAbs_OtherCurve:
default:
break;
Expand Down
6 changes: 1 addition & 5 deletions src/Mod/Part/App/GeometrySurfacePyImp.cpp
Expand Up @@ -136,11 +136,7 @@ PyObject* GeometrySurfacePy::toShape(PyObject *args)
s->Bounds(u1,u2,v1,v2);
if (!PyArg_ParseTuple(args, "|dddd", &u1,&u2,&v1,&v2))
return nullptr;
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2
#if OCC_VERSION_HEX >= 0x060502
, Precision::Confusion()
#endif
);
BRepBuilderAPI_MakeFace mkBuilder(s, u1, u2, v1, v2, Precision::Confusion() );
TopoDS_Shape sh = mkBuilder.Shape();
return new TopoShapeFacePy(new TopoShape(sh));
}
Expand Down

0 comments on commit 93525ff

Please sign in to comment.