From 7e5248da29506af5ff4789da8ee1600d3d3f2039 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 13 Jan 2026 08:44:30 +0100 Subject: [PATCH] Fix create_shape() overloads because SWIG does not map None for us anymore --- src/ifcopenshell-python/ifcopenshell/geom/main.py | 2 +- src/ifcwrap/IfcGeomWrapper.i | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index c86175fb07..38903e5948 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -507,7 +507,7 @@ def create_shape( """ return wrap_shape_creation( settings, - ifcopenshell_wrapper.create_shape(settings, inst, repr if repr is not None else None, geometry_library), + ifcopenshell_wrapper.create_shape(settings, inst, repr, geometry_library) if repr else ifcopenshell_wrapper.create_shape(settings, inst, geometry_library), ) diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index 88630e6a12..5e23ba4a0e 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -1040,7 +1040,7 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type %} %inline %{ - static std::variant create_shape(ifcopenshell::geometry::Settings& settings, const express::Base& instance, const express::Base& representation = express::Base(), const char* const geometry_library="opencascade") { + static std::variant create_shape(ifcopenshell::geometry::Settings& settings, const express::Base& instance, const express::Base& representation, const char* const geometry_library="opencascade") { const std::string& schema_name = instance.declaration().schema()->name(); #ifdef HAS_SCHEMA_2x3 @@ -1106,6 +1106,11 @@ ifcopenshell::geometry::taxonomy::item::ptr try_upcast(PyObject* obj0, swig_type throw IfcParse::IfcException("No geometry support for " + schema_name); } + + // Manual definition of overload without representation argument + static std::variant create_shape(ifcopenshell::geometry::Settings& settings, const express::Base& instance, const char* const geometry_library="opencascade") { + return create_shape(settings, instance, express::Base(), geometry_library); + } %} #ifdef IFOPSH_WITH_OPENCASCADE