IntersectCurve

Hello!

     How does the IntersectCurve works?

     I tried using it on a line and a circle, if you look at the actual sketch(please see the attache file), the line and circle has no intersection.

     But the code below returns true, meaning, the result of IntersectCurve is not null/empty, which is weird because it's supposed to be empty.

     The returned values are the following array of doubles:

     [0]:0.43573590772932624

     [1]:0.3385

     [2]:0.0

     [3]:1.01

     [4]:0.4442640922706601

     [5]:0.3385

     [6]:0.0

     [7]:1.01

private bool CheckForIntersection(ModelDoc2 modelDoc, SketchSegment gaikeiSegment, SketchSegment circle, double thickness)

{

     Curve lineCurve = (Curve)gaikeiSegment.GetCurve();

     Curve circleCurve = (Curve)circle.GetCurve();

     SketchPoint lineStPt = GetLineStartPoint((SketchLine)gaikeiSegment);

     SketchPoint lineEndPt = GetLineEndPoint((SketchLine)gaikeiSegment);

     SketchArc circleArc = (SketchArc)circle; // Convert the circle form SketchSegment to SketchArc to get the centerPoint and endPoint

     try

     {

          double[] intersection = (double[])lineCurve.IntersectCurve(circleCurve, lineStPt, lineEndPt,

                                                  (SketchPoint)circleArc.GetCenterPoint2(),(SketchPoint)circleArc.GetEndPoint2());            

                modelDoc.RebuildEditedSketchEx();

                return true;

     } catch(InvalidCastException e)

     {

                modelDoc.RebuildEditedSketchEx();

                return false;

     }

}

Hoping someone could help.

Regards,

J.Torres

SolidworksApi macros