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

Free Support Forum - aspose.com

Connecting multiple shapes to one shape without connecting to each other first

Hello, I have three shapes that connect to one shape.

Here is the code I use to make that happen.

foreach (var s in connections)
foreach (var c in s.childernSteps)
Shape connector = new Shape();
long connecterId = diagram.AddShape(connector, “Connector”, 0);
diagram.Pages[0].ConnectShapesViaConnector(c.visioId, ConnectionPointPlace.Right,s.parentStep.visioId, ConnectionPointPlace.Left, connecterId);

This code does indeed connect the proper shapes. But I would like each shape on the left to connect to the one shape individually. I have attached two images. Incorrect.png shows how the code is currently working. Correct.png is an image of how I would like to connect it does not have to be exactly the way the Correct.png image shows, but you can get the idea of how I would like them connected separately. Any insight on this would be wonderful thanks.

Hi Blake,

Thank you for contacting support. Please provide us your complete running code, stencil file and source Visio diagram. So that we could reproduce the scenario on our side too. Please also let us know which Aspose.Diagram API version are you using? We’ll investigate and reply you appropriately.

Great. Here is a link to a zip file with the visual studio solution (Aspose.Diagram.Examples.CShard.sln), stencil and an xml file.


The application is a console app, When you debug the application the console screen will tell you press any key to load an xml. Press any key and load the xml file I have provided in the zip file. Then you get a pop up asking where you would like to save the Visio Diagram too. Also in order for the application to work properly you will need to put the MasterAdd.vss file in the root folder of your C drive or change line 45 to point to wherever you have put the MasterAdd.vss. Thank you for your help. Please let me know if you have any questions or problems.

Hi Blake,

Thank you for posting the require resources. We’re working over your query and will get back to you soon.

Hi Blake,

Thank you for being patient. Please note, the each connection element of the “Or” shape is an individual sub shape. So you need to connect “add” shapes with these sub shapes. Please use this sample code:

[.NET, C#]
// initilize a new diagram
Diagram diagram = new Diagram();

// add masters
Diagram master = new Diagram(@“C:\AD\test546\MasterAdd.vss”);
foreach (Master mast in master.Masters)
diagram.AddMaster(master, mast.Name);

LayoutOptions flowChartOptions = new LayoutOptions();
flowChartOptions.LayoutStyle = LayoutStyle.FlowChart;
flowChartOptions.SpaceShapes = 1f;
flowChartOptions.EnlargePage = true;
flowChartOptions.Direction = LayoutDirection.LeftToRight;

int pageNumber = 0;

// place add shapes
long ShapeId1 = diagram.AddShape(2.25, 7.5, “add”, pageNumber);
long ShapeId2 = diagram.AddShape(2.25, 6.5, “add”, pageNumber);
long ShapeId3 = diagram.AddShape(2.25, 5.5, “add”, pageNumber);

// place Or shape
long OrId = diagram.AddShape(5.25, 6.5, “or”, pageNumber);

// get sub shapes of the Or connection
Aspose.Diagram.Shape TopMostOrConn = diagram.Pages[0].Shapes.GetShape(31).Shapes.GetShape(32).Shapes.GetShape(34);

Aspose.Diagram.Shape connector1 = new Aspose.Diagram.Shape();
long connecter1Id = diagram.AddShape(connector1, “connector”, pageNumber);
diagram.Pages[0].ConnectShapesViaConnector(ShapeId1, ConnectionPointPlace.Right, TopMostOrConn.ID, ConnectionPointPlace.Right, connecter1Id);

// save diagram in the VDX format
diagram.Save(@“C:\AD\test546\AsposeOut.vdx”, SaveFileFormat.VDX);

Please let us know in case of any confusion or questions.

This solution worked for me. Thank you very much!!!

Hi Blake,

Thank you for the confirmation. It is nice to hear from you that the problem has been resolved. Please let us know if you require any further assistance of Aspose APIs, we will be happy to help you.