BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Dynamic connectors overlap

Started by lafrank, March 03, 2018, 03:43:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hi All,

this might be an old topic, only I did not find resolution.

When I connect two objects with more than one dynamic connectors, the connectors will overlap as soon as I set the connector type to straight line. However, if I keep the connector type as right-angle, they become separated.

Is there any way to keep the straight line connectors also separated ?

Thank you.


Visio 2019 Pro


Set up additional connection points on the two shapes that you are connecting. As an example, when I am doing some systems engineering diagrams, I take a standard rectangle and add some additional connection points on the sides, this allows me to have multiple parallel lines between two boxes. If I am doing this often, I will create a Master shape with the additional connection points and drop that shape whenever I need it.


@wapperdude: Visio version is 2013 Professional

@AJD: this is a very good idea, thank you. Unfortunately it won't work for me, because I am creating Visio diagrams from an application that performs automated network discovery and the resulting graph can also be exported to Visio. So I need some programmatic approach on this. If I add multiple connection points to the master shape, then also the right-angle connectors begin collapsing and the straight lines ones do still collapse.

I realized that dynamic connectors are routed as separate lines only if I use right-angle or curved styles. It seems that Visio is not able to route straight lines separately.


Quote... I am creating Visio diagrams from an application that performs automated network discovery and the resulting graph can also be exported to Visio ...
Is the application returning a diagram, or a dataset that you are turning into a Visio diagram. In other words, do you have any control over the shapes you select and use?


This can be done with straight connectors or with right angle connectors.  It's the gluing method/technique that is important.

The macro below is an example of gluing right angle connector between two shapes.  It should be noted here, that, a straight connector will literally go between the glue points on each shape.  So, if they're identical, the connectors will overlap.

Fundamentally there are two gluing methods.  1) letting Visio decide where best to put the "apparent" glue point.  This is typically called walking glue.  2) specific glue points are provided.  These points can be determined by either using connection points, or by specific geometry points (with glue to shape enabled). The provided code / example takes the beginning end of the right angle connector and glues it to a point on the left side of shape1.  This is method 2.  It then takes the "ending" end and dragged it over the center of shape2 until the entire shape highlight in red.  This indicates walking glue and is method 1.  The resulting route looks like a straight line.  If this is repeated for a 2nd connector, except with a different start point on shape1, you get a 2nd, straight appearing, non-overlapping  connector.  However, if you then convert the two connectors to straight connectors, the left, beginning ends stay put, the right,endings move, point toward the center of shape2.  The end points move because the literal connection is center of shape2.

In the attached example, the upper pair used the outlined process.  The code pertains to the blue connector.  If you open the shapesheet, you can see the syntax for beginning and ending points is different, indicating the different glue methods.

The lower pair is just a copy of the upper pair, but the connectors were changed to straight.

The code for a single connector, cleaned-up from macro recorder:

Sub Macro2()

    Dim vsoCell1 As Visio.Cell
    Dim vsoCell2 As Visio.Cell
'Glue beginning to specific location on shape, not using connection points 
    Set vsoCell1 = ActiveWindow.Page.Shapes.ItemFromID(3).CellsU("BeginX")
    vsoCell1.GlueToPos ActiveWindow.Page.Shapes.ItemFromID(1), 1#, 0.75
    Dim vsoCell3 As Visio.Cell
    Dim vsoCell4 As Visio.Cell

'Gluing connector end to center of 2nd shape:   
    Set vsoCell3 = ActiveWindow.Page.Shapes.ItemFromID(3).CellsU("EndX")
    Set vsoCell4 = ActiveWindow.Page.Shapes.ItemFromID(2).CellsSRC(1, 1, 0)
    vsoCell3.GlueTo vsoCell4

End Sub

Note, if you drag the upper left shape about, say upwards and downwards, its connection points stay the same.  But, the connections to the right shape will move, i.e., walk around the outer edge of shape2.  Plus, as they walk, the red and blue connectors remain separate, spaced by the separation established on shape1

Visio 2019 Pro

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 227 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1086KB.
Tokens: post-login.
Cache hits: 14: 0.00227s for 26,764 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]