Use opencascade::handle for compatibility with earlier versions

This commit is contained in:
Thomas Krijnen
2026-06-28 13:54:58 +02:00
parent 7c092db9e6
commit b4d7780e14
4 changed files with 16 additions and 16 deletions
@@ -109,7 +109,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
std::vector<std::tuple<int, int, int>> triangle_indices;
TopLoc_Location loc;
occ::handle<Poly_Triangulation> tri = BRep_Tool::Triangulation(face, loc);
opencascade::handle<Poly_Triangulation> tri = BRep_Tool::Triangulation(face, loc);
if (tri.IsNull()) {
Logger::Root().Message(Logger::LOG_ERROR, "GEO", 184, "Triangulation missing for face");
@@ -145,7 +145,7 @@ void ifcopenshell::geometry::OpenCascadeShape::Triangulate(ifcopenshell::geometr
normal = normal_direction;
}
} else {
occ::handle<Geom_Surface> surf = BRep_Tool::Surface(face);
opencascade::handle<Geom_Surface> surf = BRep_Tool::Surface(face);
// Special case the normal at the poles of a spherical surface
if (surf->DynamicType() == STANDARD_TYPE(Geom_SphericalSurface)) {
if (fabs(fabs(uv.Y()) - M_PI / 2.) < 1.e-9) {
+6 -6
View File
@@ -167,12 +167,12 @@ namespace {
}
bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const std::vector< std::vector<occ::handle<Geom_Surface>>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const std::vector< std::vector<opencascade::handle<Geom_Surface>>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
Bnd_Box bb;
TopoDS_Shape input;
flatten_shape_list(items, input, false, false, tol);
typedef std::vector< std::vector<occ::handle<Geom_Surface>> > folded_surfaces_t;
typedef std::vector< std::vector<opencascade::handle<Geom_Surface>> > folded_surfaces_t;
typedef std::vector< std::pair< TopoDS_Face, std::pair<gp_Pnt, gp_Pnt> > > faces_with_mass_t;
NCollection_List<TopoDS_Shape> shells;
@@ -181,7 +181,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
if (it->empty()) {
continue;
} else if (it->size() == 1) {
const occ::handle<Geom_Surface>& surface = (*it)[0];
const opencascade::handle<Geom_Surface>& surface = (*it)[0];
double u1, v1, u2, v2;
if (!project(surface, input, u1, v1, u2, v2)) {
continue;
@@ -190,7 +190,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
} else {
faces_with_mass_t solids;
for (folded_surfaces_t::value_type::const_iterator jt = it->begin(); jt != it->end(); ++jt) {
const occ::handle<Geom_Surface>& surface = *jt;
const opencascade::handle<Geom_Surface>& surface = *jt;
double u1, v1, u2, v2;
if (!project(surface, input, u1, v1, u2, v2)) {
continue;
@@ -284,7 +284,7 @@ bool IfcGeom::util::apply_folded_layerset(const ConversionResults& items, const
}
bool IfcGeom::util::apply_layerset(const ConversionResults& items, const std::vector<occ::handle<Geom_Surface>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
bool IfcGeom::util::apply_layerset(const ConversionResults& items, const std::vector<opencascade::handle<Geom_Surface>>& surfaces, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>& styles, ConversionResults& result, double tol) {
if (surfaces.size() < 3) {
return false;
@@ -373,7 +373,7 @@ bool IfcGeom::util::apply_layerset(const ConversionResults& items, const std::ve
}
bool IfcGeom::util::split_solid_by_surface(const TopoDS_Shape& input, const occ::handle<Geom_Surface>& surface, TopoDS_Shape& front, TopoDS_Shape& back, double tol) {
bool IfcGeom::util::split_solid_by_surface(const TopoDS_Shape& input, const opencascade::handle<Geom_Surface>& surface, TopoDS_Shape& front, TopoDS_Shape& back, double tol) {
// Use an unbounded surface, that isolate part of the input shape,
// to split this shape into two parts. Make sure that the addition
// of the two result volumes matches that of the input.
+3 -3
View File
@@ -11,11 +11,11 @@
namespace IfcGeom {
namespace util {
bool apply_layerset(const ConversionResults&, const std::vector<occ::handle<Geom_Surface>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
bool apply_layerset(const ConversionResults&, const std::vector<opencascade::handle<Geom_Surface>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
bool apply_folded_layerset(const ConversionResults&, const std::vector<std::vector<occ::handle<Geom_Surface>>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
bool apply_folded_layerset(const ConversionResults&, const std::vector<std::vector<opencascade::handle<Geom_Surface>>>&, const std::vector<ifcopenshell::geometry::taxonomy::style::ptr>&, ConversionResults&, double tol);
bool split_solid_by_surface(const TopoDS_Shape&, const occ::handle<Geom_Surface>&, TopoDS_Shape&, TopoDS_Shape&, double tol);
bool split_solid_by_surface(const TopoDS_Shape&, const opencascade::handle<Geom_Surface>&, TopoDS_Shape&, TopoDS_Shape&, double tol);
bool split_solid_by_shell(const TopoDS_Shape&, const TopoDS_Shape& s, TopoDS_Shape&, TopoDS_Shape&, double tol);
}
@@ -117,7 +117,7 @@ bool IfcGeom::util::is_single_linear_edge(const TopoDS_Wire & wire) {
return false;
}
double u, v;
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
return crv->DynamicType() == STANDARD_TYPE(Geom_Line);
}
@@ -132,7 +132,7 @@ bool IfcGeom::util::is_single_circular_edge(const TopoDS_Wire & wire) {
return false;
}
double u, v;
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
return crv->DynamicType() == STANDARD_TYPE(Geom_Circle);
}
@@ -140,7 +140,7 @@ void IfcGeom::util::process_sweep_as_extrusion(const TopoDS_Wire & wire, const T
TopExp_Explorer exp(wire, TopAbs_EDGE);
TopoDS_Edge e = TopoDS::Edge(exp.Current());
double u, v;
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
const auto& dir = Handle(Geom_Line)::DownCast(crv)->Position().Direction();
// OCCT line is normalized so diff in parametric coords equals length
const double depth = std::abs(u - v);
@@ -153,7 +153,7 @@ void IfcGeom::util::process_sweep_as_revolution(const TopoDS_Wire & wire, const
TopExp_Explorer exp(wire, TopAbs_EDGE);
TopoDS_Edge e = TopoDS::Edge(exp.Current());
double u, v;
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
auto circ = Handle(Geom_Circle)::DownCast(crv);
// @todo we could be extruding the wire only when we know this is an intermediate edge.
const double depth = std::abs(u - v);
@@ -269,7 +269,7 @@ void IfcGeom::util::segment_adjacent_non_linear(const TopoDS_Wire & wire, std::v
for (int i = 0; i < (int)sorted_edges.size() - 1; ++i) {
const auto& e = sorted_edges[i];
occ::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
opencascade::handle<Geom_Curve> crv = BRep_Tool::Curve(e, u, v);
const bool is_linear = crv->DynamicType() == STANDARD_TYPE(Geom_Line);
const auto& f = sorted_edges[i + 1];