Integrate manual drawing references into annotation tool

Adds MANUAL_DRAWING_REFERENCE to the annotation type dropdown.
Selecting it shows a dialog to choose elevation or section and
optionally assign a target drawing before placement. Tags are
protected from regeneration via EPset_Annotation.IsManualDrawingReference.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Ryan Schultz
2026-03-15 13:24:56 -05:00
parent ca652f4534
commit 4be91c26c4
2 changed files with 10 additions and 22 deletions
@@ -555,6 +555,16 @@ class BIM_PT_product_assignments(Panel):
assert self.layout assert self.layout
assert (obj := context.active_object) assert (obj := context.active_object)
element = tool.Ifc.get_entity(obj)
if element and tool.Drawing.is_manual_drawing_reference(element):
row = self.layout.row(align=True)
row.label(
text=ProductAssignmentsData.data["relating_product"] or "No Drawing Assigned", icon="IMAGE_DATA"
)
row.operator("bim.assign_manual_drawing_reference", icon="GREASEPENCIL", text="")
return
props = tool.Drawing.get_object_assigned_product_props(obj) props = tool.Drawing.get_object_assigned_product_props(obj)
if props.is_editing_product: if props.is_editing_product:
-22
View File
@@ -562,28 +562,6 @@ def assign_manual_drawing_reference(
ifc.run("drawing.assign_product", relating_product=drawing, related_object=element) ifc.run("drawing.assign_product", relating_product=drawing, related_object=element)
def add_manual_drawing_reference(
ifc: type[tool.Ifc],
collector: type[tool.Collector],
drawing_tool: type[tool.Drawing],
drawing: ifcopenshell.entity_instance,
annotation_type: str,
) -> bpy.types.Object:
if annotation_type == "ELEVATION":
element = drawing_tool.create_manual_elevation_reference(drawing)
else: # SECTION
target_view = drawing_tool.get_drawing_target_view(drawing)
context = drawing_tool.get_annotation_context(target_view)
if not context:
context = drawing_tool.create_annotation_context(target_view, annotation_type)
element = drawing_tool.create_manual_section_reference(drawing, context)
drawing_tool.set_manual_drawing_reference(element)
ifc.run("group.assign_group", group=drawing_tool.get_drawing_group(drawing), products=[element])
obj = ifc.get_object(element)
collector.assign(obj)
return obj
def build_schedule(drawing: type[tool.Drawing], schedule: ifcopenshell.entity_instance) -> None: def build_schedule(drawing: type[tool.Drawing], schedule: ifcopenshell.entity_instance) -> None:
drawing.create_svg_schedule(schedule) drawing.create_svg_schedule(schedule)
drawing.open_svg(drawing.get_path_with_ext(drawing.get_document_uri(schedule), "svg")) drawing.open_svg(drawing.get_path_with_ext(drawing.get_document_uri(schedule), "svg"))