Show an error for unsupport curve types #6259

This commit is contained in:
Andrej730
2025-03-04 17:00:31 +05:00
parent d0cb5456b3
commit 3fc312752b
2 changed files with 13 additions and 2 deletions
@@ -234,9 +234,15 @@ class EnableEditingArbitraryProfile(bpy.types.Operator):
props = tool.Profile.get_profile_props()
active_profile = props.profiles[props.active_profile_index]
profile_id = active_profile.ifc_definition_id
props.active_arbitrary_profile_id = profile_id
profile = tool.Ifc.get().by_id(profile_id)
obj = tool.Model.import_profile(profile)
try:
obj = tool.Model.import_profile(profile)
except tool.Model.UnsupportedCurveForConversion as e:
self.report({"ERROR"}, str(e))
return {"CANCELLED"}
props.active_arbitrary_profile_id = profile_id
tool.Ifc.link(profile, obj)
bpy.context.scene.collection.objects.link(obj)
tool.Blender.select_and_activate_single_object(context, obj)
+5
View File
@@ -486,6 +486,9 @@ class Model(bonsai.core.tool.Model):
return obj
class UnsupportedCurveForConversion(Exception):
pass
@classmethod
def convert_curve_to_mesh(
cls,
@@ -550,6 +553,8 @@ class Model(bonsai.core.tool.Model):
)
cls.circles.append([offset, offset + 1])
cls.edges.append((offset, offset + 1))
else:
raise cls.UnsupportedCurveForConversion(f"Profile has unsupported curve type: {curve}.")
@classmethod
def import_rectangle(cls, obj: bpy.types.Object, position: Matrix, profile: ifcopenshell.entity_instance) -> None: