Q:

Enterprise Architect: Hide only "top" labels of connectors programmatically

I want to hide the "top" part of all connector labels of a diagram. For this, I tried to set up a script, but it currently hides ALL labels (also the "bottom" labels which I want to preserve):
// Get a reference to the current diagram
var currentDiagram as EA.Diagram;
currentDiagram = Repository.GetCurrentDiagram();

if (currentDiagram != null)
{
    for (var i = 0; i < currentDiagram.DiagramLinks.Count; i++)
    {
        var currentDiagramLink as EA.DiagramLink;
        currentDiagramLink = currentDiagram.DiagramLinks.GetAt(i);

        currentDiagramLink.Geometry = currentDiagramLink.Geometry
            .replace(/HDN=0/g, "HDN=1")
            .replace(/LLT=;/, "LLT=HDN=1;")
            .replace(/LRT=;/, "LRT=HDN=1;");
        if (!currentDiagramLink.Update())
        {
            Session.Output(currentDiagramLink.GetLastError());
        }
    }
}

When I hide only the top labels manually (context menu of a connector/Visibility/Set Label Visibility), the Geometry property of the DiagramLinks remains unchanged, so I guess the detailed label visibility information must be contained somewhere else in the model.
Does anyone know how to change my script?
Thanks in advance!
EDIT:
The dialog for editing the detailed label visibility looks as follows:

My goal is unchecking the "top label" checkboxes programmatically.

A:

In the Geometry attribute you will find a partial string like
LLT=CX=36:CY=13:OX=0:OY=0:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=1:DIR=0:ROT=0;

So in between LLT and the next semi-colon you need to locate the HDN=0 and replace that with HDN=1. A simple global change like above wont work. You need a wild card like in the regex LLT=([^;]+); to work correctly.

