.NET

Reply
Valued Contributor
tanerpro
Posts: 83
Registered: ‎10-07-2005
Message 1 of 5 (134 Views)

Why intersection point does not lie on the curve

134 Views, 4 Replies
08-04-2013 01:07 PM

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))

 

Windows 7 (x64)
AutoCAD 2012 (x64)
Valued Mentor
gasty1001
Posts: 437
Registered: ‎04-11-2010
Message 2 of 5 (125 Views)

Re: Why intersection point does not lie on the curve

08-04-2013 01:27 PM 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

Valued Contributor
tanerpro
Posts: 83
Registered: ‎10-07-2005
Message 3 of 5 (112 Views)

Re: Why intersection point does not lie on the curve

08-04-2013 03:44 PM in reply to: gasty1001

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,

Windows 7 (x64)
AutoCAD 2012 (x64)
Valued Contributor
tanerpro
Posts: 83
Registered: ‎10-07-2005
Message 4 of 5 (103 Views)

Re: Why intersection point does not lie on the curve

08-04-2013 04:08 PM in reply to: tanerpro

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

Thanks for the idea.

Windows 7 (x64)
AutoCAD 2012 (x64)
Valued Mentor
gasty1001
Posts: 437
Registered: ‎04-11-2010
Message 5 of 5 (96 Views)

Re: Why intersection point does not lie on the curve

08-04-2013 04:59 PM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community