mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 14:07:43 +00:00
Fix #261
This commit is contained in:
@@ -614,7 +614,7 @@ namespace IfcGeom {
|
|||||||
if (hasParent) parents.insert(parents.begin(), parent_object);
|
if (hasParent) parents.insert(parents.begin(), parent_object);
|
||||||
|
|
||||||
// We need to find all the parents
|
// We need to find all the parents
|
||||||
while (parent_object != NULL && hasParent)
|
while (parent_object != NULL && hasParent && parent_object->parent_id() != -1)
|
||||||
{
|
{
|
||||||
// Find the next parent
|
// Find the next parent
|
||||||
try {
|
try {
|
||||||
@@ -650,14 +650,19 @@ namespace IfcGeom {
|
|||||||
int parent_id = -1;
|
int parent_id = -1;
|
||||||
std::string instance_type, product_name, product_guid;
|
std::string instance_type, product_name, product_guid;
|
||||||
IfcSchema::IfcProduct* ifc_product = 0;
|
IfcSchema::IfcProduct* ifc_product = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const IfcUtil::IfcBaseClass* ifc_entity = ifc_file->entityById(id);
|
IfcUtil::IfcBaseClass* ifc_entity = ifc_file->entityById(id);
|
||||||
instance_type = IfcSchema::Type::ToString(ifc_entity->type());
|
instance_type = IfcSchema::Type::ToString(ifc_entity->type());
|
||||||
if ( ifc_entity->is(IfcSchema::Type::IfcProduct) ) {
|
|
||||||
ifc_product = (IfcSchema::IfcProduct*)ifc_entity;
|
if (ifc_entity->is(IfcSchema::Type::IfcRoot)) {
|
||||||
product_guid = ifc_product->GlobalId();
|
IfcSchema::IfcRoot* ifc_root = ifc_entity->as<IfcSchema::IfcRoot>();
|
||||||
product_name = ifc_product->hasName() ? ifc_product->Name() : "";
|
product_guid = ifc_root->GlobalId();
|
||||||
|
product_name = ifc_root->hasName() ? ifc_root->Name() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ifc_entity->is(IfcSchema::Type::IfcProduct)) {
|
||||||
|
ifc_product = ifc_entity->as<IfcSchema::IfcProduct>();
|
||||||
parent_id = -1;
|
parent_id = -1;
|
||||||
try {
|
try {
|
||||||
IfcSchema::IfcObjectDefinition* parent_object = kernel.get_decomposing_entity(ifc_product);
|
IfcSchema::IfcObjectDefinition* parent_object = kernel.get_decomposing_entity(ifc_product);
|
||||||
|
|||||||
Reference in New Issue
Block a user