mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 05:10:53 +00:00
Handle missing placement location gracefully #5528
This commit is contained in:
@@ -23,10 +23,12 @@
|
|||||||
using namespace ifcopenshell::geometry;
|
using namespace ifcopenshell::geometry;
|
||||||
|
|
||||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis1Placement* inst) {
|
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()));
|
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
|
||||||
P = *v->components_;
|
P = *v->components_;
|
||||||
|
} catch (const std::runtime_error&) {
|
||||||
|
Logger::Warning("Placement with invalid Location:", inst);
|
||||||
}
|
}
|
||||||
const bool hasAxis = inst->Axis();
|
const bool hasAxis = inst->Axis();
|
||||||
if (hasAxis) {
|
if (hasAxis) {
|
||||||
|
|||||||
@@ -24,10 +24,12 @@
|
|||||||
using namespace ifcopenshell::geometry;
|
using namespace ifcopenshell::geometry;
|
||||||
|
|
||||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement2D* inst) {
|
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()));
|
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
|
||||||
P = *v->components_;
|
P = *v->components_;
|
||||||
|
} catch (const std::runtime_error&) {
|
||||||
|
Logger::Warning("Placement with invalid Location:", inst);
|
||||||
}
|
}
|
||||||
const bool hasRef = !!inst->RefDirection();
|
const bool hasRef = !!inst->RefDirection();
|
||||||
if (hasRef) {
|
if (hasRef) {
|
||||||
|
|||||||
@@ -24,10 +24,12 @@
|
|||||||
using namespace ifcopenshell::geometry;
|
using namespace ifcopenshell::geometry;
|
||||||
|
|
||||||
taxonomy::ptr mapping::map_impl(const IfcSchema::IfcAxis2Placement3D* inst) {
|
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()));
|
taxonomy::point3::ptr v = taxonomy::cast<taxonomy::point3>(map(inst->Location()));
|
||||||
o = *v->components_;
|
o = *v->components_;
|
||||||
|
} catch (const std::runtime_error&) {
|
||||||
|
Logger::Warning("Placement with invalid Location:", inst);
|
||||||
}
|
}
|
||||||
const bool hasAxis = !!inst->Axis();
|
const bool hasAxis = !!inst->Axis();
|
||||||
const bool hasRef = !!inst->RefDirection();
|
const bool hasRef = !!inst->RefDirection();
|
||||||
|
|||||||
Reference in New Issue
Block a user