mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
You can now assign parameterized profiles to material profiles. Thanks Jesusbill!
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"material_profile": None, "profile": None}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
if (
|
||||
self.settings["material_profile"].Profile
|
||||
and len(self.file.get_inverse(self.settings["material_profile"].Profile)) == 1
|
||||
):
|
||||
self.file.remove(self.settings["material_profile"].Profile)
|
||||
self.settings["material_profile"].Profile = self.settings["profile"]
|
||||
@@ -4,6 +4,7 @@ class Usecase():
|
||||
self.settings = {
|
||||
"profile": None,
|
||||
"attributes": {},
|
||||
"profile_attributes": {},
|
||||
"material": None
|
||||
}
|
||||
for key, value in settings.items():
|
||||
@@ -13,3 +14,5 @@ class Usecase():
|
||||
for name, value in self.settings["attributes"].items():
|
||||
setattr(self.settings["profile"], name, value)
|
||||
self.settings["profile"].Material = self.settings["material"]
|
||||
for name, value in self.settings["profile_attributes"].items():
|
||||
setattr(self.settings["profile"].Profile, name, value)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"ifc_class": None}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
return self.file.create_entity(self.settings["ifc_class"])
|
||||
@@ -0,0 +1,17 @@
|
||||
class Data:
|
||||
is_loaded = False
|
||||
profiles = {}
|
||||
|
||||
@classmethod
|
||||
def purge(cls):
|
||||
cls.is_loaded = False
|
||||
cls.profiles = {}
|
||||
|
||||
@classmethod
|
||||
def load(cls, file):
|
||||
if not file:
|
||||
return
|
||||
cls.profiles = {}
|
||||
for profile in file.by_type("IfcProfileDef"):
|
||||
cls.profiles[profile.id()] = profile.get_info()
|
||||
cls.is_loaded = True
|
||||
Reference in New Issue
Block a user