Show error message trying to edit not supported type of profile

E.g. previously if you would tab into editing IfcExtrudedAreaSolid that was using not supported profile type (e.g. IFCCSHAPEPROFILEDEF) it would import it as empty geometry and tabbing out then would save it corrupting the original profile. Now there is an error message that it's not yet supported - https://i.imgur.com/NzksYVP.png
This commit is contained in:
Andrej730
2025-01-21 16:22:42 +05:00
parent ff337bc849
commit 5a766e79bd
2 changed files with 11 additions and 2 deletions
@@ -1984,7 +1984,13 @@ class OverrideModeSetEdit(bpy.types.Operator, tool.Ifc.Operator):
self.enable_edit_mode(context)
elif item.is_a("IfcSweptAreaSolid"):
tool.Geometry.sync_item_positions()
tool.Model.import_profile(item.SweptArea, obj=obj)
res = tool.Model.import_profile((profile := item.SweptArea), obj=obj)
if res is None:
self.report(
{"INFO"},
f"Couldn't import profile, editing it directly is not yet supported. Failing profile: {profile}.",
)
return
obj.data.BIMMeshProperties.ifc_definition_id = item.id()
self.enable_edit_mode(context)
ProfileDecorator.install(context)
+4 -1
View File
@@ -286,7 +286,7 @@ class Model(bonsai.core.tool.Model):
profile: ifcopenshell.entity_instance,
obj: Optional[bpy.types.Object] = None,
position: Optional[Matrix] = None,
) -> bpy.types.Object:
) -> Union[bpy.types.Object, None]:
"""Creates new profile mesh and assigns it to `obj`,
if `obj` is `None` then new "Profile" object will be created.
@@ -316,6 +316,9 @@ class Model(bonsai.core.tool.Model):
for inner_boundary in profile.InnerBoundaries or []:
cls.convert_curve_to_mesh(obj, position, inner_boundary)
if not cls.vertices or not cls.edges:
return None
mesh = bpy.data.meshes.new("Profile")
mesh.from_pydata(cls.vertices, cls.edges, [])
mesh.BIMMeshProperties.subshape_type = "PROFILE"