mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Feature to Add Crew Resources and SubContract Resources with the ifcopenshell.api and blenderB
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user