OCC_VER Compatibility

This commit is contained in:
Thomas Krijnen
2026-06-29 10:22:02 +02:00
parent b4d7780e14
commit 8bd22178f7
3 changed files with 32 additions and 1 deletions
@@ -38,6 +38,7 @@
#include <BRepClass3d_SolidClassifier.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Version.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Integer.hxx>
#include <TopTools_ShapeMapHasher.hxx>
@@ -1932,7 +1933,11 @@ namespace IfcGeom {
BVH_Triangulation<double, 3> triangulation(builder);
for (int i = 0; i < elem_verts.size(); i += 3) {
#if OCC_VERSION_HEX >= 0x80000
triangulation.Vertices.Append(BVH_Vec3d(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2]));
#else
triangulation.Vertices.push_back(BVH_Vec3d(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2]));
#endif
verts.push_back(gp_Pnt(elem_verts[i], elem_verts[i + 1], elem_verts[i + 2]));
}
@@ -1944,7 +1949,11 @@ namespace IfcGeom {
gp_Vec dir2(v1_pnt, v3_pnt);
gp_Vec cross_product = dir1.Crossed(dir2);
if (cross_product.Magnitude() > Precision::Confusion()) {
#if OCC_VERSION_HEX >= 0x80000
triangulation.Elements.Append(BVH_Vec4i(
#else
triangulation.Elements.push_back(BVH_Vec4i(
#endif
elem_faces[i], elem_faces[i + 1], elem_faces[i + 2], original_tris_index
));
original_tris_index++;
+10 -1
View File
@@ -42,9 +42,14 @@
#include <BRepAlgoAPI_Section.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <Standard_Version.hxx>
#if OCC_VERSION_HEX >= 0x80000
#include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx>
#include <NCollection_HSequence.hxx>
#else
#include <TopTools_HSequenceOfShape.hxx>
#endif
#include <TopExp.hxx>
@@ -57,7 +62,6 @@
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <gp_Ax22d.hxx>
#include <Standard_Version.hxx>
#include <GeomAPI.hxx>
#include <TopoDS_Wire.hxx>
@@ -1438,8 +1442,13 @@ void SvgSerializer::write(const geometry_data& data) {
result = make_transform_mirror_.Shape();
}
#if OCC_VERSION_HEX >= 0x80000
opencascade::handle<NCollection_HSequence<TopoDS_Shape>> edges = new NCollection_HSequence<TopoDS_Shape>();
opencascade::handle<NCollection_HSequence<TopoDS_Shape>> wires = new NCollection_HSequence<TopoDS_Shape>();
#else
Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape();
Handle(TopTools_HSequenceOfShape) wires = new TopTools_HSequenceOfShape();
#endif
{
TopExp_Explorer exp(result, TopAbs_EDGE);
for (; exp.More(); exp.Next()) {
+13
View File
@@ -22,9 +22,14 @@
#ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcgeom/kernels/opencascade/OpenCascadeConversionResult.h"
#include <Standard_Version.hxx>
#if OCC_VERSION_HEX >= 0x80000
#include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx>
#include <NCollection_HSequence.hxx>
#else
#include <TopTools_HSequenceOfShape.hxx>
#endif
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepBndLib.hxx>
@@ -411,13 +416,21 @@ void TtlWktSerializer::write(const IfcGeom::BRepElement* brep_obj) {
for (int iter = 0; iter < 10; ++iter) {
gp_Pln pln(gp_Pnt(0, 0, zmin + section_height + iter * (height - 1.) / 10.), gp::DZ());
#if OCC_VERSION_HEX >= 0x80000
opencascade::handle<NCollection_HSequence<TopoDS_Shape>> wires = new NCollection_HSequence<TopoDS_Shape>();
#else
Handle(TopTools_HSequenceOfShape) wires = new TopTools_HSequenceOfShape();
#endif
size_t N = 0;
TopoDS_Iterator it(compound);
// Iterate over components of compound to have better chance of matching section edges to closed wires
for (; it.More(); it.Next()) {
#if OCC_VERSION_HEX >= 0x80000
opencascade::handle<NCollection_HSequence<TopoDS_Shape>> edges = new NCollection_HSequence<TopoDS_Shape>();
#else
Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape();
#endif
TopoDS_Shape result = BRepAlgoAPI_Section(it.Value(), pln);
{