Hi,
I was trying to get the intersection of a circle and and arc.
My code is returning a different intersection, please see the attached file for reference.
Here's my code, the return value is an 'intersect' value is an array of four doubles, which means there is only 1 intersection.
private object GetAllItersections(ModelDoc2 modelDoc, SketchSegment fillet, SketchSegment circle)
{
Curve filletCurve = (Curve)fillet.GetCurve();
Curve circleCurve = (Curve)circle.GetCurve();
SketchPoint filletStPt;
SketchPoint filletEndPt;
SketchArc circleArc = (SketchArc)circle; // Convert the circle form SketchSegment to SketchArc to get the centerPoint and endPoint
SketchPoint arcStPt = GetArcStartPoint(circleArc);
SketchPoint arcEndPt = GetArcEndPoint(circleArc);
try
{
filletStPt = GetLineStartPoint((SketchLine)fillet);
filletEndPt = GetLineEndPoint((SketchLine)fillet);
}
catch
{
filletStPt = GetArcStartPoint((SketchArc)fillet);
filletEndPt = GetArcEndPoint((SketchArc)fillet);
}
object intersect = filletCurve.IntersectCurve(circleCurve,
new double[] { filletStPt.X, filletStPt.Y, filletStPt.Z },
new double[] { filletEndPt.X, filletEndPt.Y, filletEndPt.Z },
new double[] { arcStPt.X, arcStPt.Y, arcStPt.Z },
new double[] { arcEndPt.X, arcEndPt.Y, arcEndPt.Z });
if (!intersect.Equals(DBNull.Value))
{
return intersect;
}
else
{
return null;
}
}
I would really appreciate if someone could pinpoint what's wrong in my code.
Thanks in advance!
Best Regards,
J.Torres
SolidworksApi macros