Fix #6131. Fix bug where you could potentially create an invalid composite profile with no profiles.

This commit is contained in:
Dion Moult
2025-02-13 07:35:55 +11:00
parent af03953ef7
commit f6c6cc9a1b
2 changed files with 5 additions and 3 deletions
@@ -288,7 +288,7 @@ class EditArbitraryProfile(bpy.types.Operator, tool.Ifc.Operator):
if not profile:
def msg(self, context):
self.layout.label(text="INVALID PROFILE: " + indices[1])
self.layout.label(text="INVALID PROFILE")
bpy.context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
ProfileDecorator.install(
+4 -2
View File
@@ -1535,7 +1535,7 @@ class Model(bonsai.core.tool.Model):
mesh: bpy.types.Mesh,
position: Matrix | None = None,
x_angle: Optional[float] = None,
) -> Union[tuple, dict]:
) -> tuple | dict | None:
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
if position is None:
@@ -1750,7 +1750,9 @@ class Model(bonsai.core.tool.Model):
else:
profile_defs.append(tmp.createIfcArbitraryClosedProfileDef("AREA", None, curve))
if len(profile_defs) == 1:
if total_profile_defs := len(profile_defs) == 0:
return
elif total_profile_defs == 1:
profile_def = profile_defs[0]
else:
profile_def = tmp.createIfcCompositeProfileDef("AREA", None, profile_defs)