Custom Sketch Tool and Snapping

2056
1
12-05-2011 08:58 PM
by Anonymous User
Not applicable
Original User: ginomellino

Hi,

I have a custom tool (still back in the dark ages, 9.3 - VB.Net - see attached .txt) which works well to sketch polygons. I wish to add 2 things to it:

1. Snapping (just to make the tool aware of the current snapping environment in ArcMap, I do not need to create my own snapping agents etc),
2. The little blue circle that follows the edit tool around when snapping is enabled (Editor::InvertAgent).

I have gotten the circle to show up and the point to snap but this has caused my polygon feedback to stop following the mouse cursor when I move it. It also leaves trails of the cursor on the screen (see attached jpg). Also, when I click to add a new point it seems to add the point at the mouse cursor and not at the snap point.

Can anyone please let me know where I am going wrong? I am sure it is something simple.

Thanks in advance
Gino
Reply
0 Kudos
1 Reply
Esri Regular Contributor
Hi Gino,

The mouse trails are caused by not clearing the old snap agent on the screen as you move the mouse. You can clear it by calling InvertAgent at the start of the mousemove routine and in the refresh routine.
As for the point creation, you are using the mouse location as the xy location in mousedown. You should be using the snapped location from the mousemove routine.

Take a look at the following example of another sketch tool for the pattern:
http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/ac90eeb4-9b47-40bb-9e0a-ad852ce205bf.htm
Reply
0 Kudos