mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
OcctNoCleanTriangulation CacheShapes PermissiveShapeReuse setting; Cgal conditional copy during triangulation; occt cheaper check for triangulation existance #6712
This commit is contained in:
@@ -22,6 +22,16 @@
|
||||
using namespace ifcopenshell::geometry;
|
||||
|
||||
bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::ptr item, IfcGeom::ConversionResults& results) {
|
||||
if (settings_.get<settings::CacheShapes>().get()) {
|
||||
auto it = cache_.find(item);
|
||||
if (it != cache_.end()) {
|
||||
results = it->second;
|
||||
Logger::Notice("Cache hit #" + std::to_string(item->instance->as<IfcUtil::IfcBaseEntity>()->id()) +
|
||||
" -> #" + std::to_string(it->first->instance->as<IfcUtil::IfcBaseEntity>()->id()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
auto with_exception_handling = [&](auto fn) {
|
||||
try {
|
||||
return fn();
|
||||
@@ -44,11 +54,18 @@ bool ifcopenshell::geometry::kernels::AbstractKernel::convert(const taxonomy::pt
|
||||
}
|
||||
};
|
||||
|
||||
bool res;
|
||||
if (propagate_exceptions) {
|
||||
return without_exception_handling(process_with_upgrade);
|
||||
res = without_exception_handling(process_with_upgrade);
|
||||
} else {
|
||||
return with_exception_handling(process_with_upgrade);
|
||||
res = with_exception_handling(process_with_upgrade);
|
||||
}
|
||||
|
||||
if (settings_.get<settings::CacheShapes>().get() && res) {
|
||||
cache_.insert({ item, results });
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
const Settings& ifcopenshell::geometry::kernels::AbstractKernel::settings() const
|
||||
|
||||
Reference in New Issue
Block a user