Update Profiles UI profile editing arbitrary profile #6284

This commit is contained in:
Andrej730
2025-03-07 14:12:22 +05:00
parent d68068a84b
commit 46104f5bf5
2 changed files with 9 additions and 0 deletions
@@ -2260,6 +2260,7 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
profile.ProfileName = old_profile.ProfileName
for inverse in tool.Ifc.get().get_inverse(old_profile):
ifcopenshell.util.element.replace_attribute(inverse, old_profile, profile)
tool.Profile.replace_profile_in_profiles_ui(old_profile.id(), profile.id())
ifcopenshell.util.element.remove_deep2(tool.Ifc.get(), old_profile)
tool.Geometry.reload_representation(props.representation_obj)
+8
View File
@@ -125,6 +125,14 @@ class Profile(bonsai.core.tool.Profile):
props = cls.get_profile_props()
return tool.Blender.get_active_uilist_element(props.profiles, props.active_profile_index)
@classmethod
def replace_profile_in_profiles_ui(cls, old_profile_id: int, new_profile_id: int) -> None:
props = cls.get_profile_props()
for profile in props.profiles:
if profile.ifc_definition_id == old_profile_id:
profile.ifc_definition_id = new_profile_id
return
# Lengths are in meters.
DEFAULT_PROFILE_ATTRS = {
"IfcCircleProfileDef": {