Author Topic: Cable Length PATHLENGTH Changing Unexpectedly  (Read 1004 times)

0 Members and 1 Guest are viewing this topic.

vorax

  • Newbie
  • *
  • Posts: 3
Cable Length PATHLENGTH Changing Unexpectedly
« on: August 22, 2019, 09:40:34 AM »
Hello everyone!

First of all, thanks a lot to Visio Guy! I learnt a lot from your website!

So, I'm an IT technician in a small business where we manage infrastructure moves from our clients to Datacenters. I recently discovered the use of Visio to create layouts in order to estimate the length of the future cables that will be installed in the Datacenters.

I found the very helpful post Simple Cabling Shape with Length Reporting and was able to create dynamic cables which show their length as well as their source and destination devices and then I create reports from visio to process that data with Excel.

Here is my issue:
The formula that I use to show the length for the cable going to the same face of the rack is :
Code
FORMAT(0 m+PATHLENGTH(Geometry1.Path),"0.00u")

and for the cables going from to the other side of the rack :
Code
FORMAT(1 m+PATHLENGTH(Geometry1.Path),"0.00u")


This formula is added in the .Format and .Value of a "Length" section in the Shape Data in each of my cables (It's actually directly in each master's shape data, because I've got one master per cable type).

So, it works very well BUT everytime I close the file and reopen it, all the lengths (or sometimes just a part of it) are wrong. For instance, instead of a 1.40m cable, it changed to 0.03m. From what I can see, each cable's length become randomly less than 0.10m, but never above that.

Does anyone have an idea? I searched on the forum, but didn't find anything similar..

Thanks !
« Last Edit: August 22, 2019, 11:07:08 AM by Visio Guy »

Croc

  • Full Member
  • ***
  • Posts: 244
    • Visioport
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #1 on: August 22, 2019, 10:07:27 AM »
Can you post an example of such a document? Let it be at least a small fragment with the behavior described above.
« Last Edit: August 22, 2019, 11:07:15 AM by Visio Guy »

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1712
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #2 on: August 22, 2019, 11:06:27 AM »
Hi Guys,

I've made a very simple test case in Visio 2019/Office 365. I can't reproduce the bug.

Which version of Visio are we talking about, and does the attached file have the problem?

Note: before saving, I write in a text block the last value that was displayed on the cable shape, so it is easy to tell if something goes wrong.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

vorax

  • Newbie
  • *
  • Posts: 3
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #3 on: August 23, 2019, 03:23:47 PM »
Hey guys, thanks for the answers!

My version is Visio 2016 (16.0.4266.1001) 64 bits

So, I tried with your file and I can't reproduce the bug either..

But, I spent some time doing other tests on my file and it seems like it only occurs when :
- 1 : A cable crosses the path of an other one. Then, the one which does the little bridge over the other gets the bug.
AND
- 2 : Too many items are placed in the drawing (?) Couldn't verify that because it really seems random.. I don't understand the logic behind it, it's a real puzzle

I don't know if I'm clear, so you can see for yourself with my file. I tried to reduce its size to less than 500ko, but I couldn't, so here is a link to it : 
https://www.dropbox.com/s/xhtm1fsea9d3b62/Example_Pathlength_Bug.vsdx?dl=0

Also, the thing with the cable's lengths becoming randomly less than 0.10m and not higher, seems to be wrong. It can be higher than 0.10m, but it still looks random.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • Ideas Visio-lized into solutions
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #4 on: August 23, 2019, 04:04:37 PM »
Downloaded your file.  Seems to work fine.  No "bug".  Using V2019 64B on Win10 64B.
Visio 2019 Pro

vorax

  • Newbie
  • *
  • Posts: 3
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #5 on: August 26, 2019, 08:56:47 AM »
Well, I tried with the 2019 version and the bug isn't there indeed...

So weird. Thank you all for your answers anyway ;)

Croc

  • Full Member
  • ***
  • Posts: 244
    • Visioport
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #6 on: August 27, 2019, 04:24:43 AM »
The source of the error is the FORMAT () function.
There is a suspicion that the error is related to the choice of the locale and the way the units are converted from IU to "m".
Locale 5129 is different from 1033.
I would recommend trying to change the settings as follows:
set for Prop.Lng locale 1033
formula in the field Value = Prop.Lng.Format
the formula in the field Format = FORMAT ("0 m" + PATHLENGTH (Geometry1.Path), "0.00u") with quotation marks!
This must be checked on the computer where the error occurs. I can’t check, because on my computer in Visio 2013 an error only appears when I open the file for the first time. After a simple rewrite of the formula, the error disappears and no longer appears.
-----
(These are recommendations for the RJ45 Front-Front.225 master.)
« Last Edit: August 27, 2019, 04:33:06 AM by Croc »

Croc

  • Full Member
  • ***
  • Posts: 244
    • Visioport
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #7 on: August 28, 2019, 01:29:27 AM »
It is possible that the above recommendations are also unreliable, since the greatest influence is exerted by the inheritance of formulas from the master and it is necessary to fight against this reason.
In this case, a good way to fix the file is to run a macro that translates the formulas into local ones:
Code
Sub ttt()
    For Each shp In ActivePage.Shapes
        If Left(shp.Name, 16) = "RJ45 Front-Front" Then
            shp.Cells("Prop.Lng.Format").FormulaU = shp.Cells("Prop.Lng.Format").FormulaU
            shp.Cells("Prop.Lng").FormulaU = shp.Cells("Prop.Lng").FormulaU
        End If
    Next
End Sub

Croc

  • Full Member
  • ***
  • Posts: 244
    • Visioport
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #8 on: August 28, 2019, 02:45:44 AM »
The minimum material for those wishing to study the problem is posted in
https://www.dropbox.com/sh/7kyl4zzqbpsmw50/AABr6_OCTrkAnUtj0foylLxia?dl=0
The li.gif file demonstrates the process of getting the error
The NewPrototipe.vsdx file is a minimal prototype.
The li.gif file was obtained using Visio 2013.
Attempting to reproduce the error in Visio 2019 was unsuccessful. But if we create a file in Visio 2019, save it and open it in Visio 2013, we will see an error.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3794
  • Ideas Visio-lized into solutions
Re: Cable Length PATHLENGTH Changing Unexpectedly
« Reply #9 on: August 28, 2019, 08:58:25 AM »
That sounds like a bug which finally was corrected. 
Visio 2019 Pro