DistanceFromPoint property

Microsoft Visio Developer Reference

DistanceFromPoint property

   Example   

Returns the distance from a shape to a point.

Version added

2000

Syntax

doubleRet = object.DistanceFromPoint(x, y, flags, [pPathIndex], [pCurveIndex], [pt])

doubleRet

Double. A distance in internal drawing units with respect to the coordinate space defined by the point (x,y).

object

Required. An expression that returns a Shape object.

x

Required Double. An x-coordinate.

y

Required Double. A y-coordinate.

flags

Required Integer. Flags that influence the type of entries returned in results.

pPathIndex

Optional Variant. Identifies the point on the shape in conjunction with pCurveIndex and pt.

pCurveIndex

Optional Variant. Identifies the point on the shape in conjunction with pPathIndex and pt.

pt

Optional Variant. Identifies the point on the shape in conjunction with pPathIndex and pCurveIndex.

Remarks

The (x,y) point is expressed in internal drawing units (inches in the drawing) with respect to the coordinate space defined by the sheet immediately containing ThisShape.

The pPathIndex, pCurveIndex, and pt arguments optionally return values that identify the point the returned distance is measured from. Call that point (xOnThis,yOnThis). It lies along the c'th curve of ThisShape's p'th path and can be determined by:

ThisShape.Paths(*pPathIndex).Item(*pCurveIndex).Point(*pt,&xOnThis,&yOnthis)

You can use the PointAndDerivatives method instead of the Point method if you want to find the first and second derivatives at position t along the curve.

If pPathIndex or pCurveIndex is not Null, an Integer (type VT_I4) is returned. If p isn't Null, it returns a Double (type VT_R8).

The DistanceFromPoint property considers guides to have extent and considers a shape's filled areas and paths.

The flags argument can be any combination of the values of the constants defined in the following table. These constants are also defined in VisSpatialRelationFlags in the Visio type library.

Constant

Value

Description

visSpatialIncludeHidden

&H10

Consider hidden Geometry sections. By default, hidden Geometry sections do not influence the result.

visSpatialIgnoreVisible

&H20

Do not consider visible Geometry sections. By default, visible Geometry sections influence the result.

Use the NoShow cell to determine whether a Geometry section is hidden or visible. Hidden Geometry sections have a value of TRUE and visible Geometry sections have a value of FALSE in the NoShow cell.

If object has no geometry, or if flags excludes consideration of all geometry, then the DistanceFromPoint property returns a large number (1E+30) which should be interpreted as infinite.

The DistanceFromPoint property does not consider the width of a shape's line, shadows, line ends, control points, or connection points when computing its result.