• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • Visio Shape Report Converter
    • SS Plus
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Using Visio in Education for GIS
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Visualize Complex Processes with Microsoft Visio
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Shape Design / Connections / Counting glued and connected shapes in Visio

Published on May 26, 2023 by David Parker

Counting glued and connected shapes in Visio

I got a surprise in one of my projects when I counted the shapes glued together using the Shape.GluedShapes(…) method … the sum of the filtered glued shapes just didn’t add up to the unfiltered count. So, I thought I should check the Shape.ConnectedShapes(…) method too … and there is a scenario where that has a similar result.

In the following diagram, I have different coloured squares with connection points of different types at the centre of each edge (as denoted by the connection type numbers), and one under a control point in the bottom left corner. I have glued the ends of coloured connector lines, statically (Red and Black) and dynamically (Green), and glued the Purple Square directly to the Orange Square. The Blue Square shape is glued to a connection point on the green dynamic connector.

7 Shapes glued & connected in a variety of ways

I then ran some code to get the count of glued and connected shapes … and noticed some apparent discrepancies…

  • GluedShapes(…) of Blue square misses Green connector misses the Blue square
  • GluedShapes(…) of Green connector misses the Blue square
  • ConnectedShapes(…) of Blue square misses Orange and Yellow squares

So, let’s look at the Green Dynamic Connector in the report above…

The green dynamic connector reports that it has 3 glued 2D shapes when using the following call:

Shape.GluedShapes(Visio.VisGluedShapesFlags.visGluedShapesAll2D, "") 

However, the following two methods return 1 each:

Shape.GluedShapes(Visio.VisGluedShapesFlags.visGluedShapesIncoming2D, "") 
Shape.GluedShapes(Visio.VisGluedShapesFlags.visGluedShapesOutgoing2D, "")

So, that means that means there is one glued shape that is not either incoming or outgoing on the 1D shape … and that is the Blue Square shape which is glued to the connection point on the Green Dynamic Connector. Infact it is a member of the Shape.FromConnects collection but does not get found by the GluedShapes(…) method when filtered.

The Blue Square is apparently missing a 1D glued shape, which is the Green Dynamic Connector. It does appear in the Shape.Connects collection though.

Another surprise was the double connections between the Blue Square and Orange Square shapes! These two are glued with two InwardOutward (2) connection point types, which allows two 2D shapes to be glued together. The Angle cell references must be required to control the rotation of one shape with respect to the other.

  • Orange Square has two FromConnects to Purple Square
  • Purple Square has two Connects to Orange Square
  • The Page.Connects collection

I was a little confused, at first, about the two ConnectedShapes for the Orange Square too. It finds the Yellow Square and the Blue Square, but I had expected the Yellow Square, maybe twice, since it is at the end of two connectors. However, the Blue Square is reported in addition to the Yellow Square. Infact, when I unglued the Blue Square then ConnectedShapes(…) only reported the Yellow Square once.

So, my lesson from all this is not to trust the Shape.GluedShapes(…) and Shape.ConnectedShapes(…) methods when the structure of the diagram is a more complex than normal.

All of the data for the Shape.Connects and Shape.FromConnects collections comes from the Page.Connects collection. The Shape.GluedShapes(…) and Shape.ConnectedShapes(…) must also get most of its data from there, but also adds in the possibility of filtering by a category name that is in the User.msvShapeCaategories cell.

You can download this sample macro-enabled Visio document from here A review of connections.vsdm, and the VBA calls which simply output into the Immediate Window are:

  • ListGlues()
  • ListConnections()
  • ListDetailedShapeConnects()
  • ListDetailedPageConnects()

Related Posts

Pushing Data Visualizer in Visio beyond its limits

My last post was about some of the lessons learnt when trying to push Data Visualizer to its limits, but this one has some ways of overcoming these limitations. The main lesson learnt is that DV binds the shapes within the DV container shape, CFF Data Visualizer, and controls some of the ShapeSheet cells that…

Pushing Data Visualizer in Visio to the limits!

Regular readers of my blog will know that I like to use the Data Visualizer (DV) in Visio Plan 2, but I recently tried to help a user who really decided to push it to the limits. In this scenario, there were multiple connections, but with different labels, being created between the same flowchart shapes,…

Behavior dialog

What is the difference between a line and a [dynamic] connector in Visio?

Learn what the difference is between a line and a connector shape in Visio

Cyber Monday free Visio Checkers!

As it is Cyber Monday, I thought I would give away a compelling checkers board for Visio! In the UK, we call it Draughts, but the rules are the same… in my last post, I showed how to create a chess/checkers/draughts board, and in this one I add some checkers that can glue to the…

Update to multiSelect & tracing sub-shape connections in Visio

Most of my Visio diagrams have simple connections between shapes, and my previous post about connections used a flowchart as an example (see https://blog.bvisual.net/2016/08/09/understanding-visio-connections/ ). However, it has come to my attention that some Visio developers add connection points to sub-shapes of Visio group shapes, and then connect between the sub-shapes. This means that the…

Understanding Visio Connections

A reader recently asked if I could explain how to programmatically get the shapes connected to a shape in Visio. So, I thought I would have a go, because there are alternatives, depending upon which functions are used, and what parameters are passed to them. The following animated gif is rotating around the different types…

Related

Filed Under: Connections, Connectors, VBA, Visio for Desktop Tagged With: Connections, Connectors, VBA, Visio

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript LayerManager Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Setup and Deployment Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Validation VBA Video Visio Visio 2007 Visio for the Web Visio Online Visio Services Visio Viewer Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • Amazon
  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

Search this website

Recent posts

  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio
  • Grid Snapping Revisited

Copyright © 2025 · Executive Pro on Genesis Framework · WordPress · Log in