mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
Show an error for unsupport curve types #6259
This commit is contained in:
@@ -234,9 +234,15 @@ class EnableEditingArbitraryProfile(bpy.types.Operator):
|
|||||||
props = tool.Profile.get_profile_props()
|
props = tool.Profile.get_profile_props()
|
||||||
active_profile = props.profiles[props.active_profile_index]
|
active_profile = props.profiles[props.active_profile_index]
|
||||||
profile_id = active_profile.ifc_definition_id
|
profile_id = active_profile.ifc_definition_id
|
||||||
props.active_arbitrary_profile_id = profile_id
|
|
||||||
profile = tool.Ifc.get().by_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)
|
tool.Ifc.link(profile, obj)
|
||||||
bpy.context.scene.collection.objects.link(obj)
|
bpy.context.scene.collection.objects.link(obj)
|
||||||
tool.Blender.select_and_activate_single_object(context, obj)
|
tool.Blender.select_and_activate_single_object(context, obj)
|
||||||
|
|||||||
@@ -486,6 +486,9 @@ class Model(bonsai.core.tool.Model):
|
|||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
class UnsupportedCurveForConversion(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def convert_curve_to_mesh(
|
def convert_curve_to_mesh(
|
||||||
cls,
|
cls,
|
||||||
@@ -550,6 +553,8 @@ class Model(bonsai.core.tool.Model):
|
|||||||
)
|
)
|
||||||
cls.circles.append([offset, offset + 1])
|
cls.circles.append([offset, offset + 1])
|
||||||
cls.edges.append((offset, offset + 1))
|
cls.edges.append((offset, offset + 1))
|
||||||
|
else:
|
||||||
|
raise cls.UnsupportedCurveForConversion(f"Profile has unsupported curve type: {curve}.")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def import_rectangle(cls, obj: bpy.types.Object, position: Matrix, profile: ifcopenshell.entity_instance) -> None:
|
def import_rectangle(cls, obj: bpy.types.Object, position: Matrix, profile: ifcopenshell.entity_instance) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user