mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
You can now import profile definitions from a library
This commit is contained in:
@@ -172,7 +172,7 @@ class RefreshLibrary(bpy.types.Operator):
|
||||
self.props.active_library_element = ""
|
||||
|
||||
types = IfcStore.library_file.wrapped_data.types_with_super()
|
||||
for importable_type in ["IfcTypeProduct", "IfcMaterial", "IfcCostSchedule"]:
|
||||
for importable_type in ["IfcTypeProduct", "IfcMaterial", "IfcCostSchedule", "IfcProfileDef"]:
|
||||
if importable_type in types:
|
||||
new = self.props.library_elements.add()
|
||||
new.name = importable_type
|
||||
@@ -198,7 +198,10 @@ class ChangeLibraryElement(bpy.types.Operator):
|
||||
if len(ifc_classes) == 1 and list(ifc_classes)[0] == self.element_name:
|
||||
for element in elements:
|
||||
new = self.props.library_elements.add()
|
||||
new.name = element.Name or "Unnamed"
|
||||
if element.is_a("IfcProfileDef"):
|
||||
new.name = element.ProfileName or "Unnamed"
|
||||
else:
|
||||
new.name = element.Name or "Unnamed"
|
||||
new.ifc_definition_id = element.id()
|
||||
if IfcStore.library_file.schema == "IFC2X3" or not IfcStore.library_file.by_type("IfcProjectLibrary"):
|
||||
new.is_declared = False
|
||||
|
||||
@@ -11,12 +11,15 @@ class Usecase:
|
||||
|
||||
def execute(self):
|
||||
self.added_elements = set()
|
||||
self.whitelisted_inverse_attributes = {}
|
||||
if self.settings["element"].is_a("IfcTypeProduct"):
|
||||
return self.append_type_product()
|
||||
elif self.settings["element"].is_a("IfcMaterial"):
|
||||
return self.append_material()
|
||||
elif self.settings["element"].is_a("IfcCostSchedule"):
|
||||
return self.append_cost_schedule()
|
||||
elif self.settings["element"].is_a("IfcProfileDef"):
|
||||
return self.append_profile_def()
|
||||
|
||||
def is_already_appended(self):
|
||||
try:
|
||||
@@ -36,6 +39,11 @@ class Usecase:
|
||||
self.whitelisted_inverse_attributes = {"IfcCostSchedule": ["Controls"], "IfcCostItem": ["IsNestedBy"]}
|
||||
return self.add_element(self.settings["element"])
|
||||
|
||||
def append_profile_def(self):
|
||||
if [e for e in self.file.by_type("IfcProfileDef") if e.ProfileName == self.settings["element"].ProfileName]:
|
||||
return
|
||||
return self.add_element(self.settings["element"])
|
||||
|
||||
def append_type_product(self):
|
||||
if self.is_already_appended():
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user