//--------------------------------------------------------------------------------------------------------------
        // SetLineStyleDiagram  Set line style for a diagram (all visible connectors)
        //--------------------------------------------------------------------------------------------------------------
        // linestyle
        // LH = "Line Style: Lateral Horizontal";
        // LV = "Line Style: Lateral Vertical";
        // TH  = "Line Style: Tree Horizontal";
        // TV = "Line Style: Tree Vertical";
        // OS = "Line Style: Orthogonal Square";
        // OR =              Orthogonal Round
        // A =               Automatic
        // D =               Direct
        // C =               Customer       


        public static void SetLineStyleDiagram(EA.Repository rep, EA.Diagram d, string lineStyle)
        {
            // store current diagram
            rep.SaveDiagram(d.DiagramID);
            // all links
            foreach (EA.DiagramLink link in d.DiagramLinks)
            {
                if (link.IsHidden == false)
                {
                    SetLineStyleForDiagramLink(lineStyle, link);
                }

            }
            rep.ReloadDiagram(d.DiagramID);
        }
        //--------------------------------------------------------------------------------------------------------------
        // SetLineStyleDiagramObjectsAndConnectors  Set line style for diagram objects and connectors
        //--------------------------------------------------------------------------------------------------------------
        // linestyle
        // LH = "Line Style: Lateral Horizontal";
        // LV = "Line Style: Lateral Vertical";
        // TH  = "Line Style: Tree Horizontal";
        // TV = "Line Style: Tree Vertical";
        // OS = "Line Style: Orthogonal Square";
        // OR =              Orthogonal Round
        // A =               Automatic
        // D =               Direct
        // C =               Customer 
        // B =               Bezier
        public static void SetLineStyleDiagramObjectsAndConnectors(EA.Repository rep, EA.Diagram d, string lineStyle)
         {
             EA.Collection selectedObjects = d.SelectedObjects;
             EA.Connector selectedConnector = d.SelectedConnector;
             // store current diagram
             rep.SaveDiagram(d.DiagramID);
             foreach (EA.DiagramLink link in d.DiagramLinks)
             {
                 if (link.IsHidden == false)
                 {

                     // check if connector is connected with diagram object
                     EA.Connector c = rep.GetConnectorByID(link.ConnectorID);
                     foreach (EA.DiagramObject dObject in d.SelectedObjects)
                     {
                         if (c.ClientID == dObject.ElementID | c.SupplierID == dObject.ElementID)
                         {

                             SetLineStyleForDiagramLink(lineStyle, link);
                         }
                     }
                     if (selectedConnector != null)
                     {
                         if (c.ConnectorID == selectedConnector.ConnectorID)
                         {
                             SetLineStyleForDiagramLink(lineStyle, link);
                             continue;
                         }
                     }
                 }
             }
             rep.ReloadDiagram(d.DiagramID);
             if (selectedConnector != null) d.SelectedConnector = selectedConnector;
             foreach (EA.DiagramObject dObject in selectedObjects)
             {
                 //d.SelectedObjects.AddNew(el.ElementID.ToString(), el.Type);
                 d.SelectedObjects.AddNew(dObject.ElementID.ToString(), dObject.ObjectType.ToString());
             }
             //d.Update();
             d.SelectedObjects.Refresh();
         }