This commit is contained in:
Thomas Krijnen
2017-10-23 13:32:57 +02:00
parent b347a488af
commit 07954122fb
+7 -6
View File
@@ -1726,12 +1726,13 @@ void IfcFile::removeEntity(IfcUtil::IfcBaseClass* entity) {
for (IfcEntityList::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) { for (IfcEntityList::it it = entity_attributes->begin(); it != entity_attributes->end(); ++it) {
IfcUtil::IfcBaseClass* entity_attribute = *it; IfcUtil::IfcBaseClass* entity_attribute = *it;
if (entity_attribute == entity) continue; if (entity_attribute == entity) continue;
if (entity_attribute->entity->id() != 0) { const unsigned int name = entity_attribute->entity->id();
// Do not update inverses for simple types. // Do not update inverses for simple types (which have id()==0 in IfcOpenShell).
const IfcEntityList::ptr attribute_inverses = entitiesByReference(entity_attribute->entity->id()); if (name != 0) {
entities_by_ref_t::iterator it = byref.find(name);
if (attribute_inverses) { if (it != byref.end()) {
attribute_inverses->remove(entity); std::vector<unsigned>& ids = it->second;
std::remove(ids.begin(), ids.end(), name);
} }
} }
} }