Shapesheet PATHLENGTH() function units

Started by gwideman, January 04, 2012, 05:34:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gwideman

Hi all,

Does anyone happen to have docs, rumors, or research to give a confident answer on the units in which the PATHLENGTH function returns results, and/or what that depends upon, if anything?

I ask because NEARESTPT returns a result that includes an explicit length unit that seems to follow
Page Setup > Page Properties > Measurement Units  (which appears to correspond to Page cell DrawingScale).

So NEARESTPT () returns, say '1.0 in' if the page has Measurement Units = inches, or '2.54 cm' if Measurement Units = centimeters.

But PATHLENGTH returns a value that lacks an explicit unit, and has the same value with either page setting.

If I knew that PATHLENGTH's answer is always in "universal inches" then I could handle it as such, but I don't want to do that if PATHLENGTH's value is not always in inches.

Thanks!

-- Graham

aledlund


Graham,
my best bet based upon examining an Xml breakdown is that since the segments appear to be individually defined as to units expected, pathlength can change.
 
hope things are going well,
al



Returns the length of the path that is defined in the specified Geometry section.

Version Information
Version Added: Visio 2010

Syntax
PATHLENGTH(section[,segment])




<Geom IX='0'><NoFill>0</NoFill><NoLine>0</NoLine><NoShow>0</NoShow><NoSnap>0</NoSnap>
  <MoveTo IX='1'><X Unit='IN' F='Width*0.80715763245118'>0.6104873401651588</X><Y Unit='IN' F='Height*0.28159368514132'>0.31678668848277</Y></MoveTo>

  <LineTo IX='2'>
<X Unit='IN' F='Width*0.92550705893913'>0.6999999999999994</X><Y Unit='IN' F='Height*0.32568701458612'>0.3663907121383005</Y></LineTo>

  <LineTo IX='3'><X Unit='IN' F='Width*0.92550705893913'>0.6999999999999994</X><Y Unit='IN' F='Height*0.86820246194183'>0.9767086314919105</Y></LineTo>

  <LineTo IX='4'><X Unit='IN' F='Width*0.569542805501'>0.4307692307692296</X><Y Unit='IN' F='Height*1'>1.124977956532618</Y></LineTo>


gwideman

Hi Al!

Hope you're doing well too.

I don't think I'm following your logic here, indeed you almost seem to be explaining why I should be puzzled :-).

I too have noted that various shape dimensions (cells such as Width, PinX etc) are accompanied by unit indications, as are the shapesheet PATH functions that return X and Y within point return values. But not PATHLENGTH.  And yes, the PATHLENGTH return value certainly varies in magnitude if the shape size or geometry is changed, etc.

The value returned by PATHLENGTH seems to be consistently a value that implies it's in inches. However, it's a tricky business trying to eliminate all possibilities that PATHLENGTH might sometimes not be in inches. Hence my question.

-- Graham

aledlund

So as an experiment, I drew a line in metric (using a metric blank). I checked the shapesheet and the cell showed correctly that it was a 30mm line (then used vba to check that the cell length visType was 'mm'). I then ran this from a user cell.

=FORMATEX(PATHLENGTH(Geometry1.Path,1),"00.0u","in","mm")

and the response came back as 30mm..

When I saved/checked the drawing as XML, 'Units' was not one of the elements that was saved with the geometry section of the test shape Based on these two (given very elementary tests) I have to assume that the default is that it comes back in US measurements. What I was trying to say in the first note is that it appears for some shapes that the individual commands in the geometry sections save the visUnits for pinx/piny data, which would allow for the pathlength to read the data as value/type  properties.

hth,
al

gwideman

Thanks for thinking about this Al, though I think I some of those trees have been pre-barked-up by me :-).

When you use this:

=FORMATEX(PATHLENGTH(Geometry1.Path,1),"00.0u","in","mm")

you are explicitly telling FormatEx to treat PATHLENGTH's result as though it's a value in INCH units (and then covert it to mm).  So if/when PATHLENGTH's value is a number that makes sense to be interpreted as inches, then this formula give a desirable answer.

OK, but that's exactly the assumption that I'm seeking to clarify -- is it, in fact, safe to assume that PATHLENGTH returns a number that is properly interpreted as a value in inches?

All (most?) other length cells or function results in Visio come with an explicit unit as part of the value, so there's no ambiguity.  Indeed, if the Width cell contains 1.00 in, it has the same value as if it contained 2.54 cm; these are just format variations.  But these are only the same value if the numeric and unit part of the value are considered as a whole.

PATHLENGTH does not include a unit part, hence the ambiguity as to what it means, unless otherwise resolved by documentation or other official information, or exhaustive experimentation.

Or, in yet other words, is this:

ProperPathLength = PATHLENGTH(...) * 1 in

always the correct interpretation?


-- Graham


aledlund

Graham,
I forwarded the discussion to our friends in Redmond,
al

aledlund

fwded note

PathLength() returns a scalar value in universal inches.  It may be a bug that this value is a scalar and not a unit-ed value, but the value is in inches.

Mark


gwideman

Hi Al -- Awesome -- thanks to you for checking on this, and to Mark (N?) for the official word.
-- Graham