mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Fix #6674. Bug where newly created annotation types didn't have the necessary metadata for item editing.
This commit is contained in:
@@ -106,14 +106,17 @@ class AddAnnotationType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
obj = bpy.data.objects.new(object_type, None)
|
obj = bpy.data.objects.new(object_type, None)
|
||||||
|
|
||||||
obj.name = props.type_name
|
obj.name = props.type_name
|
||||||
|
ifc_context = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Annotation", "MODEL_VIEW")
|
||||||
element = tool.Drawing.run_root_assign_class(
|
element = tool.Drawing.run_root_assign_class(
|
||||||
obj=obj,
|
obj=obj,
|
||||||
ifc_class="IfcTypeProduct",
|
ifc_class="IfcTypeProduct",
|
||||||
predefined_type=object_type,
|
predefined_type=object_type,
|
||||||
should_add_representation=has_representation,
|
should_add_representation=has_representation,
|
||||||
context=ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Annotation", "MODEL_VIEW"),
|
context=ifc_context,
|
||||||
ifc_representation_class=tool.Drawing.get_ifc_representation_class(object_type),
|
ifc_representation_class=tool.Drawing.get_ifc_representation_class(object_type),
|
||||||
)
|
)
|
||||||
|
if representation := tool.Drawing.get_representation(element, ifc_context):
|
||||||
|
tool.Drawing.reload_representation(obj=obj, representation=representation)
|
||||||
element.ApplicableOccurrence = f"IfcAnnotation/{object_type}"
|
element.ApplicableOccurrence = f"IfcAnnotation/{object_type}"
|
||||||
|
|
||||||
if props.create_representation_for_type and object_type == "IMAGE":
|
if props.create_representation_for_type and object_type == "IMAGE":
|
||||||
|
|||||||
@@ -440,8 +440,7 @@ def add_annotation(
|
|||||||
drawing_tool.show_decorations()
|
drawing_tool.show_decorations()
|
||||||
obj = drawing_tool.create_annotation_object(drawing, object_type)
|
obj = drawing_tool.create_annotation_object(drawing, object_type)
|
||||||
element = ifc.get_entity(obj)
|
element = ifc.get_entity(obj)
|
||||||
# TODO: element is never None?
|
if not element: # Brand new annotation
|
||||||
if not element:
|
|
||||||
relating_type_rep = drawing_tool.get_annotation_representation(relating_type) if relating_type else None
|
relating_type_rep = drawing_tool.get_annotation_representation(relating_type) if relating_type else None
|
||||||
element = drawing_tool.run_root_assign_class(
|
element = drawing_tool.run_root_assign_class(
|
||||||
obj=obj,
|
obj=obj,
|
||||||
|
|||||||
Reference in New Issue
Block a user