mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-05 23:41:44 +00:00
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:
@@ -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:
|
||||||
|
|||||||
@@ -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"))
|
||||||
|
|||||||
Reference in New Issue
Block a user