Connectors not importing correctly

After importing vsd file, some connectors have extra entry in geometry section, which results in extra lines at the end of connectors.

vsd file in question and screenshot of an issue:
connector issue.zip (218.5 KB)

The file was converted using this part of code:

File file = new File(PATH_TO_VSD_FILE);
Diagram d = new Diagram(file.getAbsolutePath());
d.save(file.getAbsolutePath() + "x", SaveFileFormat.VSDX);

@Denec

It seems that you are experiencing issues with connectors in your VSD file after converting it to VSDX format. Specifically, some connectors have extra entries in the geometry section, which leads to additional lines appearing at the end of the connectors.

To address this issue, you can modify the geometry of the connectors programmatically using Aspose.Diagram. Here’s a general approach you can take:

  1. Load the VSDX file: After converting your VSD file to VSDX, load the diagram.
  2. Access the connector shape: Identify the specific connector shape you want to modify by its ID.
  3. Edit the geometry: You can remove unnecessary geometry entries and add new ones as needed.

Here’s a code example in C# that demonstrates how to edit the geometry of a connector:

using Aspose.Diagram;
using System;

namespace Aspose.Diagram.Examples
{
    public class EditConnectorGeometry
    {
        public static void Run()
        {
            // Load the VSDX diagram
            Diagram diagram = new Diagram("path_to_your_file.vsdx");
            
            // Set the connector shape ID (replace with your actual connector ID)
            long connectorId = 4; 
            Shape connector = diagram.Pages.GetPage("Page-1").Shapes.GetShape(connectorId);
            
            // Remove the first geometry entry
            connector.Geoms[0].CoordinateCol.LineToCol[0].Del = BOOL.True;

            // Add new geometry entries as needed
            LineTo lineTo = new LineTo();
            lineTo.X.Value = 0; // Set X value
            lineTo.Y.Value = 0; // Set Y value
            connector.Geoms[0].CoordinateCol.Add(lineTo);

            // Save the modified diagram
            diagram.Save("modified_diagram.vsdx", SaveFileFormat.VSDX);
        }
    }
}

In this example, you need to replace "path_to_your_file.vsdx" with the actual path to your VSDX file and adjust the connector ID as necessary. This code removes the first geometry entry and adds a new one, which should help in resolving the issue with extra lines at the end of the connectors.

If you continue to face issues, please ensure that the connector IDs and geometry modifications are correctly set according to your specific diagram structure.

For further reference, you can check the EditConnectorGeometry example provided in the Aspose documentation.

Sources:
[1]: EditConnectorGeometry.cs

@Denec
Thanks for the template vsd file and screenshots.
After an initial testing, I am able to reproduce the issue as you mentioned by using your template file.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): DIAGRAMNET-53685

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as DIAGRAMNET-53685) have been fixed in this update. This message was posted using Bugs notification tool by philip.zhou