Fix #5971. You can now specify a name and description when adding objects. Clean naming and description is critical!

This commit is contained in:
Dion Moult
2025-01-15 20:57:19 +11:00
parent 53906d824a
commit 7fdfdbf8b4
2 changed files with 8 additions and 0 deletions
@@ -384,6 +384,7 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
mesh = bpy.data.meshes.new("Mesh")
obj = bpy.data.objects.new(props.ifc_class[3:], mesh)
obj.name = props.name or "Unnamed"
obj.location = bpy.context.scene.cursor.location
element = core.assign_class(
tool.Ifc,
@@ -394,6 +395,7 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
predefined_type=predefined_type,
should_add_representation=False,
)
element.Description = props.description or None
if representation_template == "EMTPY" or not ifc_context:
pass
@@ -556,6 +558,10 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator):
props = context.scene.BIMRootProperties
self.layout.use_property_split = True
self.layout.use_property_decorate = False
row = self.layout.row()
row.prop(props, "name")
row = self.layout.row()
row.prop(props, "description")
prop_with_search(self.layout, props, "ifc_product", text="Definition", should_click_ok=True)
prop_with_search(self.layout, props, "ifc_class", should_click_ok=True)
ifc_predefined_types = root_prop.get_ifc_predefined_types(context.scene.BIMRootProperties, context)
@@ -127,6 +127,8 @@ def poll_representation_obj(self, obj):
class BIMRootProperties(PropertyGroup):
contexts: EnumProperty(items=get_contexts, name="Contexts", options=set())
name: StringProperty(name="Name")
description: StringProperty(name="Description")
ifc_product: EnumProperty(items=get_ifc_products, name="Products", update=refresh_classes)
ifc_class: EnumProperty(items=get_ifc_classes, name="Class", update=refresh_predefined_types)
ifc_predefined_type: EnumProperty(items=get_ifc_predefined_types, name="Predefined Type", default=None)