SpatialRelation property

Microsoft Visio Developer Reference

SpatialRelation property

       

Returns an integer that represents the spatial relationship of one shape to another shape. Both shapes must be on the same page or in the same master.

Version added

2000

Syntax

relation = object.SpatialRelation(otherShape, tolerance, flags)

relation

Integer. The relationship between two shapes. See Remarks for the values of this argument.

object

Required. An expression that returns a Shape object.

otherShape

Required. The other Shape object involved in the comparison.

tolerance

Required Double. A distance in internal drawing units with respect to the coordinate space defined by the Shape object's parent.

flags

Required Integer. Flags that influence the result. See Remarks for the values of this argument.

Remarks

Click to show or hide information.Values for relation

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

Constant

Value

Description

visSpatialOverlap

&H1

Two shapes can overlap. Shapes overlap if their interior regions have at least one point in common. You will also get this result if you compare a shape to itself or if either shape is a sub-shape of the other.

visSpatialContain

&H2

A shape can contain another shape. Shape A contains Shape B if Shape A encloses every region and path of Shape B.

visSpatialContainedIn

&H4

A shape can be contained within another shape. Shape B is contained within Shape A if Shape A encloses every region and path of Shape B.

visSpatialTouching

&H8

A shape can be touching another shape. Shape A touches Shape B if neither one contains or overlaps the other and they have one or more common points whose distance is within the specified tolerance.

The SpatialRelation property returns zero (0) if the two shapes being compared are not in any of the relationships discussed in the preceding table.

Click to show or hide information.Values for flags

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

visSpatialIncludeGuides

&H2

Consider a guide's Geometry section. By default, guides do not influence the result.

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.

Note The SpatialRelation property does not consider the width of a shape's line, shadows, line ends, control points, or connection points when comparing two shapes.