I am working with sheet metal parts and need to find the intersections between bend lines, and cutouts in the flat-pattern model.

Using the IntersectCurve method on a curve requires another curve, and the start and end point of each curve.

I start by finding all the non-outer Loops on each face of the flattened model. For each Loop, I loop through the edges, taking the curve, start and end point from each edge and store it in a list of EdgeCurveInfo.

For the bendlines, I get the Sketch and the Sketch Segments. For each Sketch Segment, I get the curve, and length. Since the Curve is a line, I get the root point and direction. The root point is the start point, and the end point is root point + Length * direction . I store this info for each Sketch Segment in a list of SketchSegmentCurveInfo.

Now I try to find intersections by looping through all the SketchSegmentCurveInfo and checking each one against the list of EdgeCurveInfo:

foreach(SketchSegmentCurveInfo sketchCurve in SketchSegmentCurveInfoList){

foreach(EdgeCurveInfo edgeCurve in EdgeCurveInfoList){

object result = sketchCurve.curve.IntersectCurve(edgeCurve.curve, sketchCurve.Start, sketchCurve.End, edgeCurve.Start, edgeCurve.End)

}

My problem is the result is always A System.DBNull object. I know that there are intersections since some of the bendlines end on the edge of a cutout.

Could anyone give me some advice with this?