From b52c5ab08297f3a986e0c71af07bb131a1d26b58 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 21 Nov 2023 14:40:50 +0100 Subject: [PATCH 1/3] Don't emit empty results for representation and allow implicit items to pass when using --plan --- src/ifcgeom/mapping/IfcRepresentation.cpp | 10 ++++++++-- src/ifcgeom/mapping/mapping.cpp | 12 +++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/ifcgeom/mapping/IfcRepresentation.cpp b/src/ifcgeom/mapping/IfcRepresentation.cpp index 0d87f13e64..733b3d71a8 100644 --- a/src/ifcgeom/mapping/IfcRepresentation.cpp +++ b/src/ifcgeom/mapping/IfcRepresentation.cpp @@ -42,10 +42,16 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcRepresentation* inst) { // @todo // if (s.ShapeType() == TopAbs_COMPOUND && TopoDS_Iterator(s).More() && TopoDS_Iterator(s).Value().ShapeType() == TopAbs_SOLID) { - return filter_in_place(items, [&use_body](taxonomy::ptr i) { + auto filtered = filter_in_place(items, [&use_body](taxonomy::ptr i) { // @todo just filter loops for now. - return (i->kind() != taxonomy::LOOP) == use_body; + return (i->kind() != taxonomy::LOOP && i->kind() != taxonomy::PIECEWISE_FUNCTION) == use_body; }); + + if (filtered->children.empty()) { + return nullptr; + } + + return filtered; } /* diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index d33ac0c0db..1f05206e45 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -236,14 +236,12 @@ void mapping::get_representations(std::vector& tasks, } // @todo, fix this properly by considering the mapped geometry types in the representation. - if (representation->RepresentationIdentifier() && *representation->RepresentationIdentifier() == "Body") { - geometry_conversion_task task; - task.index = task_index++; - task.representation = representation; - task.products = ifcproducts->generalize(); + geometry_conversion_task task; + task.index = task_index++; + task.representation = representation; + task.products = ifcproducts->generalize(); - tasks.emplace_back(task); - } + tasks.emplace_back(task); } } From 87f39b3826faa29ac86599785016136be66099e9 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 21 Nov 2023 14:42:59 +0100 Subject: [PATCH 2/3] Temporarily log evaluated points --- src/ifcgeom/taxonomy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ifcgeom/taxonomy.cpp b/src/ifcgeom/taxonomy.cpp index 45b0b1ad9d..432d2d2c7c 100644 --- a/src/ifcgeom/taxonomy.cpp +++ b/src/ifcgeom/taxonomy.cpp @@ -1,3 +1,4 @@ +#include "../ifcparse/IfcLogger.h" #include "taxonomy.h" #include "profile_helper.h" @@ -469,6 +470,13 @@ ifcopenshell::geometry::taxonomy::item::ptr ifcopenshell::geometry::taxonomy::pi polygon.push_back(taxonomy::make(m.col(3)(0), m.col(3)(1), m.col(3)(2))); } + // @nb temporary debugging - can be removed later. + std::ostringstream oss; + for (auto it = polygon.begin(); it != polygon.end() && std::distance(polygon.begin(), it) < 5; ++it) { + (**it).print(oss); + } + Logger::Notice("Evaluated points: " + oss.str(), instance); + return polygon_from_points(polygon); } From 4166384ab3169c7982d5e464485dadeafe0c7ae8 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 28 Nov 2023 12:59:32 +0100 Subject: [PATCH 3/3] Enable setting ITERATOR_OUTPUT from python --- src/ifcwrap/IfcGeomWrapper.i | 7 +++++-- src/ifcwrap/utils/typemaps_out.i | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index d25eda18da..4d3808fec8 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -83,6 +83,9 @@ void set_(const std::string& name, int val) { return $self->set(name, val); } + void set_(const std::string& name, ifcopenshell::geometry::settings::IteratorOutputOptions val) { + return $self->set(name, val); + } void set_(const std::string& name, double val) { return $self->set(name, val); } @@ -92,7 +95,7 @@ void set_(const std::string& name, const std::set& val) { return $self->set(name, val); } - boost::variant> get_(const std::string& name) { + ifcopenshell::geometry::Settings::value_variant_t get_(const std::string& name) { return $self->get(name); } std::vector setting_names() { @@ -116,7 +119,7 @@ void set_(const std::string& name, const std::set& val) { return $self->set(name, val); } - boost::variant> get_(const std::string& name) { + ifcopenshell::geometry::SerializerSettings::value_variant_t get_(const std::string& name) { return $self->get(name); } std::vector setting_names() { diff --git a/src/ifcwrap/utils/typemaps_out.i b/src/ifcwrap/utils/typemaps_out.i index bdeea95e55..579a94a237 100644 --- a/src/ifcwrap/utils/typemaps_out.i +++ b/src/ifcwrap/utils/typemaps_out.i @@ -148,7 +148,12 @@ CREATE_VECTOR_TYPEMAP_OUT(IfcParse::entity const *) CREATE_VECTOR_TYPEMAP_OUT(IfcParse::declaration const *) CREATE_VECTOR_TYPEMAP_OUT(IfcGeom::ConversionResultShape *) -%typemap(out) boost::variant> { +%typemap(out) ifcopenshell::geometry::Settings::value_variant_t { + pythonizing_visitor vis; + $result = $1.apply_visitor(vis); +} + +%typemap(out) ifcopenshell::geometry::SerializerSettings::value_variant_t { pythonizing_visitor vis; $result = $1.apply_visitor(vis); }