I find intersection of two curves with interop
Dim Zinters As Object = DuvarObj.IntersectWith(MainObj, AcExtendOption.acExtendNone)
then pass the intersection points pt1 and pt2 to managed code to get length of the curve between two intersection points , but I realized that sometimes decimal numbers maybe 10th after comma is different than the curve's start or end points. And so the code below throws error, since point pt1 or pt2 is not exactly on the curve, but they are the intersection points excatly.
What can I do?
Dim dist1 As Double = ent.GetDistanceAtParameter(ent.GetParameterAtPoint
(pt1)) Dim dist2 As Double = ent.GetDistanceAtParameter(ent.GetParameterAtPoint (pt2))
1.- Why to use interop given that .NET API has all the methods you need to try with this kind of problems?
2.- I'm not sure about the exact sintax, but GetClosestPointTo may help
3.- The API has a Tolerance structure you can modify to deal with rounding erros, see the docs.
Thanks for yoru prompt reply. I have just started to transfer my code to .net and .net api is far away from me. But I tried to write that part of code in .net api and succeded to intersectwith method. But nothing changed because sometimes the intersect with method returns points that is beyond the line object, although Intersect.OnBothOperands is selected. Why this is happening sometimes, do you have any idea, most of the times the methos works correct.
But make sure using GetClosestPointTo method works excellent to correct that mistake of intersetwith.
Thanks for the idea.
Glad to help. I can't say what the problem is, please post a dwg with the problem and i'll try to test some code tomorrow.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.