Defining connectors after conversion to SVG

Hello, after converting to SVG format I get an SVG element. I am interested in how I can define the start and end point of the connectors?

@sintez
Please try this sample code :

var connector = diagram.getPages().get(0).getConnects().get(0);
System.out.println("From Shape ID : " + connector.getFromSheet());
System.out.println("To Shape ID : " + connector.getToSheet());

Thanks.

Thanks for the reply, @philip.zhou
This works, but how do I determine the specific occurrences of “in” and “out” in the elements that the connector binds?

For context:
I need to convert visio format into something that can be displayed on the web with interactive capability.

@sintez
Please refer to the following code to obtain the connectshapes of each shape.

        var In_connectedShapeIds = shape.connectedShapes(aspose.diagram.ConnectedShapesFlags.CONNECTED_SHAPES_INCOMING_NODES, null);
        var Out_connectedShapeIds = shape.connectedShapes(aspose.diagram.ConnectedShapesFlags.CONNECTED_SHAPES_OUTGOING_NODES, null);

        System.out.println("Shape ID: " + shape.getID() + "\t Name: " + shape.getName() + "\t\t Incoming nodes count: " + In_connectedShapeIds.length + "\t\t Outgoing nodes count: " + Out_connectedShapeIds.length);

Thanks.

1 Like

@philip.zhou
How to map the svg representation to these points? Or is it better to initially generate a shape without svg representation? And then I can build the necessary svg on the basis of this shape myself?

@sintez
You can find the corresponding connector based on the ID of the shape in SVG.
Of course, you can also initially generate a shape without SVG and then build it yourself.

Thanks.

Got it, I’ll give it a try, thanks for the replies

@sintez
Please feel free to contact us in case you have further comments or questions.

1 Like

Good afternoon, after a series of checks. I’ve found the problem:
When querying via connector.getFromSheet() and connector.getToSheet(), there is a problem that connector accesses the id of an element that does not exist.

Attach screenshots for more context.
meta - this is information about all shapes on the sheet.

Снимок экрана 2024-03-29 в 10.31.04.png (136.0 KB)

connectors - these are all the connectors I found in the shapes (by checking the connectorRule property)

Снимок экрана 2024-03-29 в 10.31.38.png (69.9 KB)

connects - the connections themselves in which I do connector.getFromSheet() and connector.getToSheet()

Снимок экрана 2024-03-29 в 10.32.17.png (145.2 KB)

As you can see, the connection id’s are not correct.
Additionally, I can attach the diagram itself (in vsdx format)

@sintez
Thanks for the screenshots.

I’m sorry, but we can’t identify the issue from these screenshots. Please provide the sample file and the current code that you are using. Which API of diagram returned the incorrect ID? Please circle it in red on the screenshot.We will check and assist you accordingly.

Thanks.