ITopologicalOperator.Cut() fails at some polylines (randomly?)

Discussion created by Kaspatoo on Aug 23, 2011
Latest reply on Aug 24, 2011 by Kaspatoo

I am going to cut a Line (a route, Polyline) by a set of ContourLines stores in a PolylineFeatureClass.
For every left and right, which the cut method creates, I recursively cut again.
A cut is done for every contourFeature in the featureClass (nexted through a loop) until a cut was successfull. After I got left and right, they are also simplified.

Wit a small set of data, it works fine. But when using a bigger dataset the cut method throws an exception that there's missing an object refrence (think sth. is null). I debugged it and none of my objects are null (left and right are out params). And it fails every at the same position, on contour #148.

When I delete this single contourLine the next fail is on contour #199. Then came #204, #205, #206, #258, #328 (of overall 340)
Then I took just some selections of contourLines.

Here are some which WORKED:
1) #148, #199, #204, #205, #206, #258, #328
2)#123 - #150 (#148 included)
3) any other selection like (2) when start position is higher than #123
3)#1 - #150 (#148 excluded)
4) #1 - #340 (all bad lines excluded)

Here are some which NOT WORKED:
1) #122-#150 (#148 included)
2) like (1) just with lower startposition
3) #1 - #340 (one or many of the bad lines included)

some of the bad lines are closed, some not (isCloses means its a ring, not a path)
some of the bad lines crosses the route, some not (some will cross more than once)

I dont know what to check where to look or what else to found out
- what is the problem
- how can I solve it
- or what alternative do I have?

a little discussion or the solution^^ would be very nice

Thanks for help!