IntersectWith command problem

IntersectWith command problem

ekoneo
Advocate Advocate
632 Views
5 Replies
Message 1 of 6

IntersectWith command problem

ekoneo
Advocate
Advocate

When I use IntersectWith command I am having problem. 

Code is:

 

Point3dCollection ptColl = new Point3dCollection();
line.IntersectWith(pl2, Intersect.ExtendThis, ptColl, thisGraphicSystemMarker2, otherGraphicSystemMarker2);
ed.WriteMessage("\n" + ptColl.Count);

 

However ptColl.Count gives 2 although there is only one intersection possiblity. What is the reason?

SamplePhoto.png

 

On the intersection point pl2 doesnt have any vertex.

 

Thanks.

 

0 Likes
Accepted solutions (1)
633 Views
5 Replies
Replies (5)
Message 2 of 6

R.Gerritsen4967
Advocate
Advocate
Accepted solution

Maybe this is of some help...

 

To help troubleshooting, it might be helpful to write the coordinates of the points to the commandline. This way you can find out if they are the same.

Message 3 of 6

ekoneo
Advocate
Advocate

@R.Gerritsen4967 Really, exactly the problem is this. Thank you for your reply. I found the reason in the page:

"The code given above, when compiled, computes the intersection points and stores them in intPoints Points3DCollection. It is evident from the given geometry of both polylines that there should be a single point of intersection. On the contrary, the output returns two intersection points as shown below."

from: https://imrananees.blogspot.com/2021/02/analyzing-bug-in-intersectwith-autocad.html

 

Thank you.

0 Likes
Message 4 of 6

essam-salah
Collaborator
Collaborator

hi@ekoneo

so how did you recognize the fake intersection point from the true one ?

0 Likes
Message 5 of 6

ekoneo
Advocate
Advocate

@essam-salah hi.

It is a bit long solution but I get the right point. Only one of them is on the pl2. I prepare small for cycle including try catch end GetDistAtPoint function.  GetDistAtPoint gives an "Autodesk.AutoCAD.Runtime.Exception" error. Via the error existance I can get the true point. When catch side working I deleted the point from the point collection. Sory for my bad English. I wish I could tell what I did.

0 Likes
Message 6 of 6

essam-salah
Collaborator
Collaborator

@ekoneo wrote:

@essam-salah hi.

It is a bit long solution but I get the right point. Only one of them is on the pl2. ..


@ekoneo 

Cool, i hope autodesk solve the problem one day,

thanks for sharing.