-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path1.1_query_entities.py
53 lines (39 loc) · 1.28 KB
/
1.1_query_entities.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from compas_ifc.model import Model
model = Model("data/wall-with-opening-and-window.ifc")
print("\n" + "*" * 53)
print("Query Examples")
print("*" * 53 + "\n")
print("\nEntities by type")
print("=" * 53 + "\n")
print("Total number of entities: ", len(list(model.entities)))
for i, entity in enumerate(model.entities):
print(entity)
if i > 5:
print("...\n")
break
spatial_elements = model.get_entities_by_type("IfcSpatialElement")
print("Total number of spatial elements: ", len(spatial_elements))
for entity in spatial_elements:
print(entity)
print()
building_elements = model.get_entities_by_type("IfcBuildingElement")
print("Total number of building elements: ", len(building_elements))
for entity in building_elements:
print(entity)
print()
print("\nEntities by name")
print("=" * 53 + "\n")
name = "Window for Test Example"
entities = model.get_entities_by_name(name)
print("Found entities with the name: {}".format(name))
print(entities)
print("\nEntities by id")
print("=" * 53 + "\n")
global_id = "3ZYW59sxj8lei475l7EhLU"
entity = model.get_entity_by_global_id(global_id)
print("Found entity with the global id: {}".format(global_id))
print(entity, "\n")
id = 1
entity = model.get_entity_by_id(id)
print("Found entity with the id: {}".format(id))
print(entity)