Files
IfcOpenShell/src/ifcgeom/mapping/bind_convert_impl.i
T
Andrej730 68d3539a86 mapping binding - never overwrite already set item->instance
1) this way code should be more straightforward
2) this allows us not to reimplement mapping.get_surface_style logic in IfcGeomWrapper as it will be already handled in map_impl(const IfcSchema::IfcStyledItem* inst) and the resulting item->instance is not overridden by IfcStyledItem.
2024-06-21 14:52:37 +05:00

36 lines
1.2 KiB
OpenEdge ABL

#ifdef BIND
#undef BIND
#endif
#define BIND(T) \
if (!item && inst->as<IfcSchema::T>()) { \
matched = true; \
try { \
item = map_impl(inst->as<IfcSchema::T>()); \
if (item != nullptr) { \
if (item->instance == nullptr) { \
item->instance = inst; \
} \
try { \
if (inst->as<IfcSchema::IfcRepresentationItem>() && !inst->as<IfcSchema::IfcStyledItem>() && \
/* @todo */ \
(item->kind() == taxonomy::SOLID || item->kind() == taxonomy::SHELL || item->kind() == taxonomy::COLLECTION || item->kind() == taxonomy::EXTRUSION) \
) { \
auto style = find_style(inst->as<IfcSchema::IfcRepresentationItem>()); \
if (style) { \
taxonomy::cast<taxonomy::geom_item>(item)->surface_style = taxonomy::cast<taxonomy::style>(map(style)); \
} \
} \
} catch (const std::exception& e) { \
Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst); \
} \
} else {\
Logger::Message(Logger::LOG_ERROR,"Failed to convert:", inst);\
} \
} catch (const std::exception& e) { \
Logger::Message(Logger::LOG_ERROR, std::string(e.what()) + "\nFailed to convert:", inst); \
} \
}
#include "mapping.i"