Feature to Add Crew Resources and SubContract Resources with the ifcopenshell.api and blenderB

This commit is contained in:
bosonprojets
2021-04-23 06:38:11 +00:00
parent 18d7193efc
commit c7aa42bfd5
10 changed files with 400 additions and 1 deletions
@@ -0,0 +1,23 @@
import ifcopenshell.api
class Data:
is_loaded = False
resources = {}
@classmethod
def purge(cls):
cls.resources = {}
@classmethod
def load(cls, file):
cls.resources = {}
for resource in file.by_type("IfcResource"):
data = resource.get_info()
del data["OwnerHistory"]
data["RelatedObjects"] = []
for rel in resource.IsNestedBy:
[data["RelatedObjects"].append(o.id()) for o in rel.RelatedObjects if o.is_a("IfcCrewResource") or o.is_a("IfcsubcontractResource")]
cls.resources[resource.id()] = data
cls.is_loaded=True