From 5af975f99e4e80773acd5c8bda0a0b49fd36a33b Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 15 Nov 2023 13:42:55 +0100 Subject: [PATCH 1/2] Backwards compatibility for py setting strings --- src/ifcopenshell-python/ifcopenshell/geom/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/geom/main.py b/src/ifcopenshell-python/ifcopenshell/geom/main.py index 551f331972..55d5538a0c 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/main.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/main.py @@ -97,6 +97,12 @@ class settings_mixin: def get(self, k): return self.get_(self.name(k)) + def __getattr__(self, k): + if k in map(self.rname, self.setting_names()): + return k + else: + raise AttributeError("'Settings' object has no attribute '%s'" % k) + class serializer_settings(settings_mixin, ifcopenshell_wrapper.SerializerSettings): pass From dc6eb8611a2af0bedc1d8af5a79f9a2a9c4c5e7c Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 16 Nov 2023 09:15:19 +0100 Subject: [PATCH 2/2] More robust conversion to nef in CgalShape --- src/ifcgeom/kernels/cgal/CgalConversionResult.cpp | 15 +++++++++++++++ src/ifcgeom/kernels/cgal/CgalConversionResult.h | 13 ++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp b/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp index 2d29b2d3a1..f29b935501 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp +++ b/src/ifcgeom/kernels/cgal/CgalConversionResult.cpp @@ -18,6 +18,21 @@ using ifcopenshell::geometry::NumberEpeck; #define NumberType NumberEpeck #endif +#ifndef IFOPSH_SIMPLE_KERNEL +void ifcopenshell::geometry::CgalShape::to_poly() const { + if (!shape_) { + shape_.emplace(); + nef_->convert_to_polyhedron(*shape_); + } +} + +void ifcopenshell::geometry::CgalShape::to_nef() const { + if (!nef_) { + nef_ = utils::create_nef_polyhedron(*shape_); + } +} +#endif + void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Settings settings, const ifcopenshell::geometry::taxonomy::matrix4& place, IfcGeom::Representation::Triangulation* t, int surface_style_id) const { // Copy is made because triangulate_faces() obviously does not accept a const argument // ... also becuase of transforming the vertex positions, right? diff --git a/src/ifcgeom/kernels/cgal/CgalConversionResult.h b/src/ifcgeom/kernels/cgal/CgalConversionResult.h index 0644edd183..b0e3da28c0 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionResult.h +++ b/src/ifcgeom/kernels/cgal/CgalConversionResult.h @@ -182,18 +182,9 @@ namespace ifcopenshell { namespace geometry { #endif #ifndef IFOPSH_SIMPLE_KERNEL - void to_poly() const { - if (!shape_) { - shape_.emplace(); - nef_->convert_to_polyhedron(*shape_); - } - } + void to_poly() const; - void to_nef() const { - if (!nef_) { - nef_.emplace(*shape_); - } - } + void to_nef() const; operator const CGAL::Nef_polyhedron_3& () const { to_nef(); return *nef_; } const CGAL::Nef_polyhedron_3& nef() const { to_nef(); return *nef_; }