Handle missing placement location gracefully #5528

This commit is contained in:
Thomas Krijnen
2024-10-03 10:27:45 +02:00
parent 040aec3e52
commit 3b9c1d88c8
3 changed files with 12 additions and 6 deletions
+4 -2
View File
@@ -23,10 +23,12 @@
using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis1Placement* inst) {
Eigen::Vector3d P, axis(0, 0, 1), ref;
{
Eigen::Vector3d P(0, 0, 0), axis(0, 0, 1), ref;
try {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
P = *v->components_;
} catch (const std::runtime_error&) {
Logger::Warning("Placement with invalid Location:", inst);
}
const bool hasAxis = inst->Axis();
if (hasAxis) {
+4 -2
View File
@@ -24,10 +24,12 @@
using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement2D* inst) {
Eigen::Vector3d P, axis(0, 0, 1), V(1, 0, 0);
{
Eigen::Vector3d P(0, 0, 0), axis(0, 0, 1), V(1, 0, 0);
try {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
P = *v->components_;
} catch (const std::runtime_error&) {
Logger::Warning("Placement with invalid Location:", inst);
}
const bool hasRef = !!inst->RefDirection();
if (hasRef) {
+4 -2
View File
@@ -24,10 +24,12 @@
using namespace ifcopenshell::geometry;
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement3D* inst) {
Eigen::Vector3d o, axis(0, 0, 1), refDirection, X(1, 0, 0);
{
Eigen::Vector3d o(0, 0, 0), axis(0, 0, 1), refDirection, X(1, 0, 0);
try {
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
o = *v->components_;
} catch (const std::runtime_error&) {
Logger::Warning("Placement with invalid Location:", inst);
}
const bool hasAxis = !!inst->Axis();
const bool hasRef = !!inst->RefDirection();