2

I am fairly new to Arc Programming and am currently using .net to build my tool.

There is not much back ground information as I am starting from a Blank Map. The goal of my tool is just to create a short cut (Hotkey) feature in order to place perpendicular lines.

I am attempting to use the function, IConstructPoint2.ConstructPerpendicular() but it requires that I use ISegment as an input.

Prior to this, the only EVENT I am using to capture the points that I place on the map are IEditEvents2.OnVertexAdded(IPoint). How can I capture the line segment that is constructed immediately after putting down a second point on the map?

2
  • Did you try casting IEditSketch3.Geometry to an ISegmentCollection and getting the first one? Commented Feb 11, 2019 at 22:12
  • Hey Kirk, This is exactly what I needed. Thank you! Commented Feb 13, 2019 at 16:12

1 Answer 1

1

Try casting the editor to IEditSketch3, then cast IEditSketch3.Geometry to an ISegmentCollection, and get the first segment.

1
  • 1
    I think the OP is after the last segment. From IEditSketch3 casting the Geometry to an IGeometryCollection (just in case of multiple parts), get the part (indexed by IEditSketch.Part), cast that part (IGeometry) to an ISegmentCollection then get the segment indexed by IEditSketch.Segment. Before this though you'll need to check the current part has at least 2 points by casting to IPointCollection and getting the PointCount, if == 1 then bail out. Commented Feb 22, 2019 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.