AnsweredAssumed Answered

Editing polyline vertex location while digitizing

Question asked by streetjp on Apr 24, 2018
Latest reply on Apr 25, 2018 by JNery-esristaff

I am writing some code to implement some poor man's snapping while sketching graphics on the map.  I've got it working quite nicely for snapping points to lines.  I'm now coding the reverse and have been unable to modify the location of a vertex on the fly while I'm digitizing a polyline.

 

I'm attempting to do all this snap stuff in the SketchEditor_GeometryChanged event.  I get the point/vertex that was just drawn and I'm able to run my snap code to get the new point location.  I then use a PolylineBuilder to set that point to the new snapped location.  I then use SketchEditor.ReplaceGeometry to replace the current sketch geometry with the new polyline from the PolylineBuilder.  

 

After my SetPoint call pb.IsSketchValid = false.  The ReplaceGeometry call also returns false.  What am I missing?

 

 

PolylineBuilder pb = new PolylineBuilder(polyline);
pb.Parts[0].SetPoint(0, (MapPoint)snapGeom);

SketchEditor se = (SketchEditor)sender;
bool replace = se.ReplaceGeometry(pb.ToGeometry());

Outcomes