From 414d7bb81058ca5050721f26c126669721fa2dd9 Mon Sep 17 00:00:00 2001 From: Lars Moastuen Date: Fri, 13 May 2016 12:59:00 +0200 Subject: [PATCH] OBJ precision and log messages * Fixes #68: Increase precision in OBJ files (regression in commit 43f5d44) * Add some verbose logging of a few geometry errors --- src/ifcconvert/WavefrontObjSerializer.cpp | 2 ++ src/ifcgeom/IfcGeomIterator.h | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ifcconvert/WavefrontObjSerializer.cpp b/src/ifcconvert/WavefrontObjSerializer.cpp index 3be2357f39..3fb2da8a9d 100644 --- a/src/ifcconvert/WavefrontObjSerializer.cpp +++ b/src/ifcconvert/WavefrontObjSerializer.cpp @@ -79,6 +79,8 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement* ? o->name() : o->unique_id())); obj_stream << "g " << name << "\n"; obj_stream << "s 1" << "\n"; + + obj_stream << std::setprecision(std::numeric_limits::digits10); const IfcGeom::Representation::Triangulation& mesh = o->geometry(); diff --git a/src/ifcgeom/IfcGeomIterator.h b/src/ifcgeom/IfcGeomIterator.h index 803ca21226..d201f7e97b 100644 --- a/src/ifcgeom/IfcGeomIterator.h +++ b/src/ifcgeom/IfcGeomIterator.h @@ -241,7 +241,10 @@ namespace IfcGeom { kernel.setValue(IfcGeom::Kernel::GV_PRECISION, 1.e-5); } - if (representations->size() == 0) return false; + if (representations->size() == 0) { + Logger::Message(Logger::LOG_ERROR, "No geometries found"); + return false; + } representation_iterator = representations->begin(); ifcproducts.reset(); @@ -625,6 +628,7 @@ namespace IfcGeom { try { next_serialization = new SerializedElement

(*next_shape_model); } catch (...) { + Logger::Message(Logger::LOG_ERROR, "Getting a serialized element from model failed."); success = false; } } else if (!settings.get(IteratorSettings::DISABLE_TRIANGULATION)) { @@ -635,10 +639,12 @@ namespace IfcGeom { next_triangulation = new TriangulationElement

(*next_shape_model, current_triangulation->geometry_pointer()); } } catch (...) { + Logger::Message(Logger::LOG_ERROR, "Getting a triangulation element from model failed."); success = false; } } } else { + Logger::Message(Logger::LOG_ERROR, "No shape models found."); success = false; }