Welcome to MapForums!

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

## Avoided Area?

This is a discussion on Avoided Area? within the MapPoint Desktop Discussion forums, part of the Map Forums category; I'm currently using the following code:- Set objLoc = objMap.SelectedArea.Location If Not objLoc Is Nothing Then If Type Of objLoc ...

1. Senior Member Black Belt
Join Date
Jul 2002
Posts
5,137

## Avoided Area?

I'm currently using the following code:-

Set objLoc = objMap.SelectedArea.Location
If Not objLoc Is Nothing Then
If Type Of objLoc Is Location Then
Set objShape = objMap.Shapes.AddShape(geoShapeRectangle, objLoc, 5, 5)
objShape.Avoided = True
End If
End If

This has been bugging me... How can I make the area to be avoided be the exact shape I've actually drawn? At the moment, I'm hard coding a distance of 5 x 5 miles. Surely there must be a simple way to use the Selected Areas distance?

Thanks

2. Junior Member Yellow Belt
Join Date
Feb 2003
Posts
28

## make avoided area same as selected area

If you're selecting area on the map and want the avoidance area to be the same size, try storing the selected area height and width before doing anything else. Or am I misreading your question?

Code:
```Dim selWidth as long
Dim selHeight as long

selWidth = objMap.SelectedArea.Width
selHeight = objMap.SelectedArea.Height
..
..

Set objShape = objMap.Shapes.AddShape&#40;geoShapeRectangle, objLoc, selWidth, selHeight&#41;
..
..```
fill in the rest of your code then substitute the height and width for your current values.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•