I recently had to revise my understanding of the POINTALONGPATH(…) function in Visio because I was getting a #REF! error in some cases. My particular scenario requires a line with a number of vertices that are initially all in a straight line but can be moved by dragging controls around that each vertex is bound to. My assumption had been that a segment of a path is always between vertices in a geometry section, but this is not the case. So, I thought I would look deeper into the ShapeSheet functions of paths and segments. The following screenshots show a series of ShapeSheet formulas and the result of them on a single line that has 4 vertices that can be moved using a yellow control that they are bound to. Notice how the PATHLENGTH(…) formula fails to understand the segment parameter until the vertices are moved.
In case the screenshots are a little dry, I have recorded a short video to explain further.
My own need was for a boundary shape around some other shapes where I wanted to make the segments disappear if they were outside of the Visio page. The unexpected #REF! values were causing distortions because the co-ordinates were failing to update.
However, I can see that this understanding of line segments and points will be useful in many types of diagrams.
For completeness, I thought I would try the same exercise with a PolyLineTo row rather than multiple LineTo rows.
The PolyLineTo formula does have the advantage of being a single row, but this means that the PATHLENGTH(…) function does not have a segment index to that can be used to calculate with. In fact a PolyLineTo row does have two segments, but the last one is always 0 length!
However, I was able to calculate the lengths of each segment in both cases, by using the co-ordinates of the Controls in the Tip cell for each Controls row with the SQRT(…) and POW(…) functions..
Related articles
Synchronizing Visio Shape Fill Color (or almost any cell) across pages
I was recently asked how the color of one shape can be changed and for other shapes to be automatically updated to the same color … even if they are on different pages! Well, it is possible with Microsoft Visio’s awesome ShapeSheet formulas. In fact, this capability is not limited to the FillForegnd cell ……
Positioning Visio Shape Text Block with a Control Handle
I was recently asked how a control handle can be added to a Visio shape so that it can be used to re-position the text block. Fortunately, it is extremely easy to setup, and requires just two formulas to be updated in the ShapeSheet. This is a great use of the SETATREF(…) function. (more…)
Custom Color Themes in Visio?
I was recently looking into custom color themes for corporate branding in desktop Microsoft Visio and became re-aware how different Visio still is from the rest of the Microsoft Office applications. A Visio page or document does not need to have any theme applied, but the documents of the other Office applications always have a…
When is a Visio Callout not a Callout?
I have been a Visio user/developer since the mid-1990’s and seen the word “callout” used as part of the name of many master shapes in Visio. The images below show five ways that the term “callout” has been applied to the name of Visio master shapes. Generally, each evolution has been an advance on the…
Using Visio Color by Value on Connectors
Data Graphics in Visio Plan 2 and Visio Professional is great, but it only enables us to use them with 2D shapes in Visio, i.e. not on connectors. So, what if you want to change the line colour of the connectors between the 2D shapes because of the data flowing between them? Well, it is…
Using Notepad++ to Edit Visio ShapeSheet formulas
Visio shapes get their smartness from the formulas that are entered into the ShapeSheet, but editing these formulas can be extremely tricky and prone to error because of the lack of a modern programmer’s interface. Formulas can be quite long (up to 64k characters) but even medium size ones like the one in User.GetWorkdays cell…
john m says
Was the team able to explain the behaviour?
David Parker says
I think they have their hands full enhancing Visio for the Web….