HOME Avenue Bugs Report HOME
  1. Bug in ArcView's encryption on Chinese and Japanese editions of Windows
  2. Bug in various select and intersect requests
  3. Bug in aPolyline.AsLine request
  4. Bug in QueryPointDistance request

1. In some cases perfectly correct encrypted scripts are causing errors (or even the famous Segmentation Violation) if   ArcView is running on Chinese or Japanese versions of Windows

From ArcView Help:

"Segmentation Violations are caused by attempts in the low-level ArcView code to access a memory address for which it doesn't have permission, such as accessing another process's memory space or trying to write to a read-only section of memory."

According to an ESRI technical doc: (http://support.esri.com/kbase/KbDocument.asp?id=15322 ) the reason for Segmentation Violation when you are loading an extension might be:

A. Conflicts with other extensions
B. Faulty Avenue code

The bug

However in some cases perfectly correct encrypted scripts that run on ArcView (English Windows) with no problems at all, are giving a fatal  Segmentation Violation error when used on a Chinese or Japanese version of Windows. You can also get    "Unrecognized object: XXX at YYY" when everything should run smoothly (and runs smoothly on an English version of Windows).

The cause:

According to my research the error is caused by the incorrect interpretation of the encrypted script by ArcView running on Chinese or Japanese versions of Windows

The ArcView's encryption is a pretty simple one (see Bill Huber's web site for more info ), but it is not easy to identify where the problem is, especially if you don't have Windows versions on all possible languages.

The solution:

I don't have a solution for this problem, but couple of recommendations how to avoid it:

1. Do not use "{" or "}" symbols without space before or after them

    Instead of pntList = {pt1,pt2,pt3} use  pntList = { pt1,pt2,pt3 }

2. After encrypting your scripts check them with a text editor for the following string:

        ASCII pzjsz   or Hexadecimal  70 7A 6A73 18 7A

This string can possibly cause a Segmentation Violation error on Chinese or Japanese versions of Windows

To avoid it you can simply add an empty or remarked  line at the beginning of the script that will cause different encryption.


1. In some cases the Avenue requests involving intersect or select return incorrect results!


Example1: Before Select (Image 1.)

4032001BigEx11.jpg (12591 bytes)

Example1: After select (Image 2.)

4032001BigEx12.jpg (9929 bytes)

Example2: Before select (Image 3.)

4032001BigEx21.jpg (12040 bytes)

Example2: After select (Image 4.)

4032001BigEx22.jpg (10924 bytes)

The Case

We have two themes - a Polyline and a Polygon ( Images 1. &  3. )

If we use theme on theme selection (theme ==>Select By Theme) to select the features from the polyline theme that intersect the features from the polygon theme... we will get the following result ( Images 2. & 4. )

The same result we will get if we try to select the features from the polyline theme that are within distance of 1 meter from the features of the polygon theme

Download the examples data to try it for yourself:

< Example1>   <Example2>

The Affected Requests:

Some of the requests that will give incorrect results.

  • aShape.IsWithin
  • aShape.Intersects
  • aShape.Distance
  • anFTheme.SelectByTheme with Relation Types
  • anFTab.SelectByFTab with Relation Types
  • anFTab.SelectByShapes
  • anFTheme.SelectByShapes
  • anFTab.SelectByPolygon
  • anFTheme.SelectByPolygon
  • anFTab.SelectByPolyline
  • anFTheme.SelectByPolyline
  • anFTab.SelectByLine
  • anFTheme.SelectByLine

The Cause:

If a polygon has duplicate vertices (we get these often after using overlay functions as Clip, return difference etc.) the above mentioned requests might give incorrect results.

ArcView overlay functions have improved from AV3.0 ==>AV3.1 ==>AV3.2
Probability to get duplicate vertices in your polygon theme if overlay functions are used are:

  • ArcView 3.0 (3.0a) - very  high
  • ArcView 3.1 - high
  • ArcView 3.2 - low (but still possible)

The eventual damage:

If you want to select and delete all the records in a theme that intersect the features of a polygon theme, if the polygons have duplicate vertices you might delete features that do not have any intersections with the polygons. Try to clip the polyline theme from Example1 with the polygon theme from the same example. The result will be a polyline theme with 8 NULL polylines. The same result will produce the Clip functions of XTools and EditTools (up to version 3.0)

The solution:

The "Quick Clean" free function of EditTools 3.1 will clean all the duplicate vertices in the features of a Polygon or Polyline themes. It is recommended to use this function (or any other script for removing duplicate vertices) after you have applied some overlay requests on your theme.

2. In some cases the request aPolyline.AsLine returns a Line with incorrect direction.

From ArcView Help


Returns a line that approximates the shape of aPolyLine.



The Bug

The request is supposed to return a Line that connects the Start and End points of the Polyline. It does so, however in some cases the direction of the newly created line is not correct, therefore the requests ReturnStart and ReturnEnd on the resulting Line will give incorrect results.



Single segment polylines with start point in the center of a circle


Lines – result from the request


The red lines indicate lines with incorrect direction

The red area gives the angle range where the results will be incorrect.


If the angle of the line between Start and End point of a polyline is in the range 135 .. 315 degrees the resulting line will be with incorrect direction


0.0 is North, 90.0 East, 180.0 South, etc

A solution:

Instead of:

aLine = aPolyline.AsLine

one can use:

aLine = Line.Make(aPolyline.Along(0),aPolyline.Along(100))

which will create exactly the same Line, but with correct direction

Sample script illustrating the problem:

v = av.GetActiveDoc

gl = v.GetGraphics


for each g in gl

  if (g.GetName = "tempEr") then





th = v.GetActiveThemes.Get(0)

ft = th.GetFtab

shf = ft.FindField("shape")

if (ft.getShapeClass.GetClassName <> "Polyline") then

  msgbox.Info("The active theme must be Polyline theme","")

  return nil


sym1 = th.GetLegend.GetSymbols.Get(0)

selr = v.ReturnUserRect

th.SelectByRect (selr, #VTAB_SELTYPE_NEW)

for each rec in ft.GetSelection

  pl = ft.ReturnValue(shf,rec)

  l1 = pl.AsLine

  l2 = Line.Make(pl.Along(0),pl.Along(100))

  l1e = l1.ReturnEnd

  l2e = l2.ReturnEnd


    ylg = graphicShape.Make(l1)






    nlg = graphicShape.Make(l1)









This is a sample scipt that will show the problem on your data.

How to use it:

  1. Attach the script to the apply event of a tool.
  2. Make a polyline theme active
  3. Use a directional line style to visualize the polyline’s directions
  4. Select with the new tool some of your polylines
  5. The result will be graphic lines (aPolyline.AsLine request used)
  6. The lines with incorrect direction will be displayed in red

3. QueryPointDistance
request reports sometimes incorrect side of the polyline
request reports sometimes incorrect side of the polyline:

From ArcView HELP
"QueryPointDistance:Queries the distance between aPolyLine and aPoint into aDistance. It is a quick way to determine which side of aPolyLine aPoint is on: if aDistance is reported as positive, aPoint is on the left side of aPolyLine; if negative, aPoint is on the right; if zero, aPoint is on aPolyLine."

The BUG. In a polyline with angle between two segments smaller than 90 degrees QueryPointDistance reports incorrect side of the polyline for points in certain areas.

2103BUG1.jpg (17043 bytes)

2103BUG2.jpg (16687 bytes)

If we make query for a point (thePoint) in the red areas shown on the first image

theDistance = 0
thePolyLine.QueryPointDistance (thePoint,theDistance)

theDistance will be incorrectly reported with a POSITIVE value

The different areas here are defined by the extensions of both segments and the lines perpendicular to each segment.

Most probably the cause for the incorrect results is that QueryPointDistance actually returns the side of the extension of the closest segment to thePoint.

The LEFT side of the polyline is always reported correctly

If we flip the polyline and evaluate again the results will be different.

Sample script  that reports  the results from QueryPointDistance for a user defined point.

v = av.GetActiveDoc
th = v.GetActivethemes.Get(0)
ft = th.GetFtab
shf = ft.FindField("shape")
if(ft.GetSelection.Count <> 1) then
msgbox.Error("One and Only one"+nl+"polyline should be selected","")
return nil
pl = ft.ReturnValue(shf,ft.GetSelection.GetNextSet(-1))
p = v.GetDisplay.ReturnUserPoint
dist = 0
pl.QueryPointDistance (p, dist)
if (dist < 0) then
side = "RIGHT"
elseif (dist > 0) then
side = "LEFT"
msgbox.info("The point is on the line","")
return nil
How to use it:
  1. Attach the script to the apply event of a tool.
  2. Make a polyline theme active
  3. Use a directional line style to visualize the polyline’s directions
  4. Select a single polyline from the active theme
  5. Use the new tool to identify a point in the lines proximity

For any comments and enquiries contact: webmaster@ian-ko.com
Esri and all Esri products mentioned are trademarks of Environmental Systems Research Institute, Inc.
Copyright: Ianko Tchoukanski