mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Material profile sets UI cleanup and now lets you choose from a profile in your library instead of creating new profiles on the fly all the time
This commit is contained in:
@@ -20,13 +20,17 @@
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"profile_set": None, "material": None}
|
||||
self.settings = {"profile_set": None, "material": None, "profile": None}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
profiles = list(self.settings["profile_set"].MaterialProfiles or [])
|
||||
profile = self.file.create_entity("IfcMaterialProfile", **{"Material": self.settings["material"]})
|
||||
profile = self.file.create_entity("IfcMaterialProfile")
|
||||
if self.settings["material"]:
|
||||
profile.Material = self.settings["material"]
|
||||
if self.settings["profile"]:
|
||||
profile.Profile = self.settings["profile"]
|
||||
profiles.append(profile)
|
||||
self.settings["profile_set"].MaterialProfiles = profiles
|
||||
return profile
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# IfcOpenShell - IFC toolkit and geometry engine
|
||||
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
|
||||
# Copyright (C) 2021, 2022 Dion Moult <dion@thinkmoult.com>
|
||||
#
|
||||
# This file is part of IfcOpenShell.
|
||||
#
|
||||
@@ -20,14 +20,14 @@
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
self.settings = {"profile": None, "attributes": {}, "profile_attributes": {}, "material": None}
|
||||
self.settings = {"profile": None, "attributes": {}, "profile_def": None, "material": None}
|
||||
for key, value in settings.items():
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
# TODO: don't also edit the profile def in this 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)
|
||||
if self.settings["material"]:
|
||||
self.settings["profile"].Material = self.settings["material"]
|
||||
if self.settings["profile_def"]:
|
||||
self.settings["profile"].Profile = self.settings["profile_def"]
|
||||
|
||||
Reference in New Issue
Block a user