OperationMergeMarks Method

Merges given marks objects.

NOTE!! Merge requires the original mark content to be similar and of same type. Operation does not support associative notes, mark sets or template content.

Namespace:  Tekla.Structures.Drawing.Operations
Assembly:  Tekla.Structures.Drawing (in Tekla.Structures.Drawing.dll) Version: 2024.0.0+a110b435391768740483e3032720a566518c9a63
Syntax
public static bool MergeMarks(
	IList<MarkBase> marks,
	out List<MarkBase> mergedMarks
)

Parameters

marks
Type: System.Collections.GenericIListMarkBase
Contains the of marks to be merged
mergedMarks
Type: System.Collections.GenericListMarkBase
Merged marks

Return Value

Type: Boolean
True in case of success, false otherwise
Examples
The following example enumerates through all parts in all views and inserts marks for all those parts, the marks are placed in the middle of the part.
using System;
using System.Collections.Generic;
using Tekla.Structures.Geometry3d;
using Tekla.Structures.Drawing;
using TSD = Tekla.Structures.Drawing;

class Example
{
    public void MergeMarksTest()
    {
        DrawingHandler drawingHandler = new DrawingHandler();

        var drawing = drawingHandler.GetActiveDrawing();
        if (drawing != null)
        {
            List<MarkBase> markstoBeMerged = new List<MarkBase>();

            // pick marks to be merged
            ViewBase pickedView;
            DrawingObject mark;
            var picker = drawingHandler.GetPicker();
            bool continuePicking = true;
            while (continuePicking)
            {
                try
                {
                    var message = "Pick mark " + (markstoBeMerged.Count + 1).ToString() + " to be merged. Press Esc to finish..";
                    picker.PickObject(message, out mark, out pickedView);
                    if (mark == null || pickedView == null || !(mark is Tekla.Structures.Drawing.MarkBase))
                        continuePicking = false;
                    else
                        markstoBeMerged.Add(mark as MarkBase);
                }
                catch
                {
                    continuePicking = false;
                }
            }

            if (markstoBeMerged.Count > 1)
            {
                List<MarkBase> mergedMarks = new List<MarkBase>();
                TSD.Operations.Operation.MergeMarks(markstoBeMerged, out mergedMarks);
                if (mergedMarks.Count > 0)
                {
                    drawing.CommitChanges();
                    drawingHandler.SaveActiveDrawing();
                    Console.WriteLine("Merge operation successfull with " + mergedMarks.Count.ToString() + " merged marks..");
                }
                else
                {
                    Console.WriteLine("Merge operation failed..");
                }
            }
        }
    }
}
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next