.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why intersection point does not lie on the curve

4 REPLIES 4
Reply
Message 1 of 5
tanerpro
596 Views, 4 Replies

Why intersection point does not lie on the curve

Hello,

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?

Thanks

 

Dim dist1 As Double = ent.GetDistanceAtParameter(ent.GetParameterAtPoint(pt1))
Dim dist2 As Double = ent.GetDistanceAtParameter(ent.GetParameterAtPoint(pt2))

 

4 REPLIES 4
Message 2 of 5
hgasty1001
in reply to: tanerpro

Hi,

 

some ideas:

 

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.

 

Gaston Nunez

Message 3 of 5
tanerpro
in reply to: hgasty1001

Hello,

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.

Thanks,

Message 4 of 5
tanerpro
in reply to: tanerpro

But make sure using GetClosestPointTo method works excellent to correct that mistake of intersetwith.

Thanks for the idea.

Message 5 of 5
hgasty1001
in reply to: tanerpro

Hi,

 

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.

 

Gaston Nunez

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost