From 56b1406fff208a2e6e6250c8eef49d57d170d31b Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Tue, 21 Jul 2026 19:55:25 +0300 Subject: [PATCH] ifcgeom: map IfcSphericalSurface so advanced-brep spheres render (#586) The IfcSphericalSurface mapping was a dead stub returning nullptr (the 0.5-era implementation was left commented out against a removed kernel API), so any IfcAdvancedBrep whose face lies on a spherical surface failed to convert - the Sphere case from the Allplan free-form models attached to #586. Map it to taxonomy::sphere, mirroring the existing IfcCylindricalSurface and IfcToroidalSurface mappings. This activates the existing single-face spherical-solid shortcut in the OpenCascade kernel (BRepPrimAPI_MakeSphere), which is only reachable from IfcManifoldSolidBrep closed shells and CSG primitives, so it can only fire on the genuine full-sphere degenerate-seam pattern. This change was written with AI assistance. --- src/ifcgeom/mapping/IfcSphericalSurface.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/ifcgeom/mapping/IfcSphericalSurface.cpp b/src/ifcgeom/mapping/IfcSphericalSurface.cpp index 13c2286e03..05ffd7f905 100644 --- a/src/ifcgeom/mapping/IfcSphericalSurface.cpp +++ b/src/ifcgeom/mapping/IfcSphericalSurface.cpp @@ -24,16 +24,10 @@ using namespace ifcopenshell::geometry; #ifdef SCHEMA_HAS_IfcSphericalSurface taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSphericalSurface* inst) { - return nullptr; - - /* - gp_Trsf trsf; - IfcGeom::Kernel::convert(inst->Position(), trsf); - - // IfcElementarySurface.Position has unit scale factor - face = BRepBuilderAPI_MakeFace(new Geom_SphericalSurface(gp::XOY(), inst->Radius() * length_unit_), getValue(GV_PRECISION)).Face().Moved(trsf); - return true; - */ + auto s = taxonomy::make(); + s->radius = inst->Radius() * length_unit_; + s->matrix = taxonomy::cast(map(inst->Position())); + return s; } #endif