Fix bug where Blender name wouldn't match IFC Name when reassigning class. See #1902.

This commit is contained in:
Dion Moult
2021-12-03 11:00:54 +11:00
parent ebe5460a9f
commit 65d599bbd9
2 changed files with 2 additions and 2 deletions
@@ -70,7 +70,7 @@ class Loader:
surface.InnerBoundaries = ()
shape = ifcopenshell.geom.create_shape(self.settings, surface)
mesh = self.ifc_importer.create_mesh(None, shape)
obj = bpy.data.objects.new(f"{boundary.is_a()}/{boundary_id}", mesh)
obj = bpy.data.objects.new(f"{boundary.is_a()}/{boundary.Name}", mesh)
obj.matrix_world = blender_space.matrix_world
boundaries_collection = get_boundaries_collection(blender_space)
boundaries_collection.objects.link(obj)
@@ -106,7 +106,7 @@ class ReassignClass(bpy.types.Operator):
"predefined_type": predefined_type,
},
)
obj.name = "{}/{}".format(product.is_a(), "/".join(obj.name.split("/")[1:]))
obj.name = "{}/{}".format(product.is_a(), getattr(product, "Name", "None"))
IfcStore.link_element(product, obj)
obj.BIMObjectProperties.is_reassigning_class = False
return {"FINISHED"}