We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Green Dots in wrong place with created connector

When I create a connector between two shapes using:

					toId, toAnchorIndex, 

And I open the VISIO file and select the connector, The start and end green circles are in the wrong place:

image.png (22.7 KB)

I have added a number of connector points to each shapes.
image.png (22.6 KB)

What do I have to adjust on the Connector Shape to have those anchor points in the right place?

Once I manipulate the chart, the points move to the locations I hoped for.

image.png (15.8 KB)

I want the file to open with the green connector anchors in the correct place.

Here is the vsdx file:
diagram.zip (99.7 KB)


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): DIAGRAMJAVA-51093

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.

Does that mean it is a bug?

Please share the code for adding connector lines, as we are experiencing different results when using the following code to add connector lines and connect shape connection points, as shown in the attachment.
51093output.zip (89.1 KB)

Diagram diagram = new Diagram(“diagram.vsdx”);
Page page = diagram.getPages().get(0);
long id = page.addShape(1, 1, “Dynamic connector”);
page.connectShapesViaConnectorIndex(10, 14, 15, 6, id);
diagram.save( “51093output.vsdx”, SaveFileFormat.VSDX);

I create and connect the arc like I think you do. And I connect it to the shape using Connectors that I created with this routine:

static void addAllControlPoints(String nodeId, Shape textShape, boolean bottomUp, boolean extend, boolean extendDown) throws Exception {
		Connection conn;
		String nodeCenter = "Width*0.5" ; 
		double pixelOffDown = 0 ;
		double pixelOffUp = 0 ;
		if(extend) {
			if(extendDown) {
				pixelOffDown = VisioGenerator.scale * 50;
			} else {
				pixelOffUp = VisioGenerator.scale * 40;

		for(int anchor = 0 ; anchor < MAX_PRIMARY_IN; anchor++) {
			String anchorPosition = nodeCenter + "+" +  anchor * ANCHOR_GAP ;
			String anchorName = anchorName(nodeId,PRIMARY_IN_PREFIX,anchor) ;
			conn = makeAnchorPoint(textShape, anchorName, anchorPosition, "Height" + "+" + pixelOffUp);
		for(int anchor = 0 ; anchor < MAX_PRIMARY_OUT; anchor++) {
			String anchorPosition = nodeCenter + "+" +  anchor * ANCHOR_GAP ;
			String anchorName = anchorName(nodeId,PRIMARY_OUT_PREFIX,anchor) ;
			conn = makeAnchorPoint(textShape, anchorName, anchorPosition, "" + -pixelOffDown);
		for(int anchor = 0 ; anchor < MAX_SECONDARY_IN; anchor++) {
			String anchorPosition = nodeCenter + "-" +  anchor * ANCHOR_GAP ;
			makeAnchorPoint(textShape,anchorName(nodeId,SECONDARY_IN_PREFIX,anchor), anchorPosition, "Height" + "+" + pixelOffUp);			
		for(int anchor = 0 ; anchor < MAX_SECONDARY_OUT; anchor++) {
			String anchorPosition = nodeCenter + "-" +  anchor * ANCHOR_GAP ;
			makeAnchorPoint(textShape,anchorName(nodeId,SECONDARY_OUT_PREFIX,anchor), anchorPosition, "" + -pixelOffDown);			
		DBO(DB_ANCHORS_TRACE, ()->"anchorIndex:" + ModelDebug.dumpMap(anchorIndex));
	private static Connection makeAnchorPoint(Shape shape, String name, String xPositionString, String yPositionString) {
		Connection connection1 = new Connection();
		int ix = shape.getConnections().add(connection1);
		anchorIndex.put(name, ix);
		return connection1;

I create the connector like this, looking up the correct connector for each arc.

                                Shape arcShape = new Shape();
				arcShape.setName(connectionData.getId() + "-" + pageIndex);
				long arcShapeId = visioPage.addShape(arcShape, CONNECTOR.getStencilName());
				Shape fromNodeShape = shapeSource.getShape(idMapping.get(fromNodeId));
				Shape fromNodeTextShape = shapeSource.getShape(idMapping.get(fromNodeId)).getShapes().getShape(fromNodeId + "-TEXT");
				Shape toNodeTextShape = shapeSource.getShape(idMapping.get(toNodeId)).getShapes().getShape(toNodeId + "-TEXT");
				long fromId = fromNodeTextShape.getID() ;
				long toId = toNodeTextShape.getID() ;
				int fromAnchorIndex;
				int toAnchorIndex ;
				//These tow indexes are looked up from a list of Connectors, the I ADDED!
				fromAnchorIndex = getAnchorIndex(fromNodeId, connectionData,CONNECTION_IN) ;
				toAnchorIndex = getAnchorIndex(toNodeId, connectionData,CONNECTION_OUT) ;
						toId, toAnchorIndex, 
				visioPage.glueShapes(fromNodeShape, fromAnchorIndex, toNodeTextShape);

Then I remove the original Geoms:

	public static Point2D markOriginalLineForDeletion(Shape arcShape) {
		Point2D end = null ;
		for(int i = 0; i < arcShape.getGeoms().get(0).getCoordinateCol().getLineToCol().getCount(); i++) {
			LineTo lineToDelete = arcShape.getGeoms().get(0).getCoordinateCol().getLineToCol().get(i);
			end = new Point2D.Double(lineToDelete.getX().getValue(),lineToDelete.getY().getValue());
		return end ;

Then I add the individual line segments where they are suppose to be in the chart created by our tool

	public static void addLineTos(Shape arcShape, List<Point2D> arcPoints, boolean dbArcInteresting) {
			LineTo lineToVertice = new LineTo();

If I call arcShape.refreshNode() at this point, the resulting arc loses my line segments! So I call it before I modify the Geoms.

Here is an elaborate example:
diagram.zip (198.3 KB)

An interesting (and annoying) feature is that when I open one of these produced files in VISIO, and then I close it without changing it, it still asks me if I want to save the document. As well, as I think I said before, if I make a change like the orientation or page size, it does a redraw of the connectors, adding the little jumpers, and reseting the green dots to where I want them.

I hope this is enough information. The payment has just gone through to you for a full support license which I expect very soon. I have a lot more questions :slight_smile:

We will look further into it.