Share via


Avoided property

Returns or sets whether a route avoids intersections within the specified shape. The AutoShapeType property of the Shape object must be geoShapeRectangle. Read/write Boolean.

Applies to

Objects:  Shape

Syntax

object.Avoided

Parameters

Part Description
object Required. An expression that returns a Shape object.

Example

    Sub RouteAroundAvoidedArea()

  Dim objApp As New MapPoint.Application   Dim objMap As MapPoint.Map   Dim objRoute As MapPoint.Route   Dim objLoc As MapPoint.Location   Dim objShape As MapPoint.Shape
  'Set up the application   Set objMap = objApp.ActiveMap   Set objRoute = objMap.ActiveRoute   objApp.Visible = True   objApp.UserControl = True
  'Create a rectangle to avoid   Set objLoc = objMap.GetLocation(47.64, -122.25675)   Set objShape = objMap.Shapes.AddShape(geoShapeRectangle, objLoc, 5, 2)   objShape.Avoided = True
  'Add two waypoints and calculate. Note that route goes around area.   objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)   objRoute.Waypoints.Add objMap.FindResults("Redmond, WA").Item(1)   objRoute.Calculate
  End Sub

Note  This sample code is specific for use in MapPoint North America; it is for illustration purposes only.