Remove usage of .wrapped_item and some other fixes

This commit is contained in:
Thomas Krijnen
2026-01-10 11:01:18 +01:00
parent 5c9213426f
commit b66b04b001
55 changed files with 129 additions and 118 deletions
+12 -12
View File
@@ -42,9 +42,9 @@ def create_pure_node_from_ifc_entity(ifc_entity, ifc_file, hierarchy=True):
node.add_label(ifc_entity.is_a())
attributes_type = ["ENTITY INSTANCE", "AGGREGATE OF ENTITY INSTANCE", "DERIVED"]
for i in range(ifc_entity.__len__()):
if not ifc_entity.wrapped_data.get_argument_type(i) in attributes_type:
name = ifc_entity.wrapped_data.get_argument_name(i)
name_value = ifc_entity.wrapped_data.get_argument(i)
if not ifc_entity.get_argument_type(i) in attributes_type:
name = ifc_entity.get_argument_name(i)
name_value = ifc_entity.get_argument(i)
node[name] = name_value
node.__primarylabel__ = "Root"
node.__primarykey__ = "id"
@@ -57,21 +57,21 @@ def create_graph_from_ifc_entity_all(graph, ifc_entity, ifc_file):
graph.merge(node)
for i in range(ifc_entity.__len__()):
if ifc_entity[i]:
if ifc_entity.wrapped_data.get_argument_type(i) == "ENTITY INSTANCE":
if ifc_entity.get_argument_type(i) == "ENTITY INSTANCE":
if ifc_entity[i].is_a() in ["IfcOwnerHistory"] and ifc_entity.is_a() != "IfcProject":
continue
else:
sub_node = create_pure_node_from_ifc_entity(ifc_entity[i], ifc_file)
REL = Relationship(node, ifc_entity.wrapped_data.get_argument_name(i), sub_node)
REL = Relationship(node, ifc_entity.get_argument_name(i), sub_node)
graph.merge(REL)
elif ifc_entity.wrapped_data.get_argument_type(i) == "AGGREGATE OF ENTITY INSTANCE":
elif ifc_entity.get_argument_type(i) == "AGGREGATE OF ENTITY INSTANCE":
for sub_entity in ifc_entity[i]:
sub_node = create_pure_node_from_ifc_entity(sub_entity, ifc_file)
REL = Relationship(node, ifc_entity.wrapped_data.get_argument_name(i), sub_node)
REL = Relationship(node, ifc_entity.get_argument_name(i), sub_node)
graph.merge(REL)
for rel_name in ifc_entity.wrapped_data.get_inverse_attribute_names():
if ifc_entity.wrapped_data.get_inverse(rel_name):
inverse_relations = ifc_entity.wrapped_data.get_inverse(rel_name)
for rel_name in ifc_entity.get_inverse_attribute_names():
if ifc_entity.get_inverse(rel_name):
inverse_relations = ifc_entity.get_inverse(rel_name)
for wrapped_rel_entity in inverse_relations:
rel_entity = ifc_file.by_id(wrapped_rel_entity.id())
sub_node = create_pure_node_from_ifc_entity(rel_entity, ifc_file)
@@ -82,8 +82,8 @@ def create_graph_from_ifc_entity_all(graph, ifc_entity, ifc_file):
def create_full_graph(graph, ifc_file):
idx = 1
length = len(ifc_file.wrapped_data.entity_names())
for entity_id in ifc_file.wrapped_data.entity_names():
length = len(ifc_file.entity_names())
for entity_id in ifc_file.entity_names():
entity = ifc_file.by_id(entity_id)
print(idx, "/", length, entity)
create_graph_from_ifc_entity_all(graph, entity, ifc_file)