Skip to main content

Get a combined fragment and operands

To get a combined fragment, use the Fragments property of the ISequenceDiagram object. To get an operand, use the Operands property of the IFragmentShape object.

public void GetFragments(ICommandContext c, ICommandParams p) 
{
ISequenceDiagram sequenceDiagram = c.App.Workspace.CurrentEditor as ISequenceDiagram;
if (sequenceDiagram == null) return;

//Get composite fragments
var fragments = sequenceDiagram.Fragments;

var no = 1;
foreach (IFragmentShape fragment in fragments)
{
c.App.Output.WriteLine("sample", $"{no}th composite fragment : {fragment.Text}");
no++;

//Get operands
var operands = fragment.Operands;

foreach (IOperandShape operand in operands)
{
c.App.Output.WriteLine("sample", $" operand : {operand.Guard}");
}
}
}
About models

For models of composite fragments and operands, we do not provide a dedicated type, so you need to operate them with the IModel type.