I have a program that asks a user to select an entity and then returns data on it. Everything works great as long as the UCS is set to world. However, I'm trying to bulid an app that will provide data to my other programs in all real world situations.
I have attached a basic autocad drawing with a 2d polyline which was created in the WCS. The view of the drawing is rotated to some random setting, and the ucs is set to the view. When I select a point on the polyline, it does not always return the segment I selected. For example, if you click left of the label on the far right line, it returns data for the curve adjacent to it.
I'm using the GetClosestPointTo() method and currently telling it to use the current view's diretion. I don't think this is right, as it shouldn't be based on the view, it should be based on the current UCS, however I'm not sure how to proceed to get a vector that will relate the current coordinates (which are in the current ucs) to the polyline, which also appears to be in the current ucs, but the method being called doesn't reliably return the segment picked.
I have attached my code and test drawing, if anyone has time please take a look at it and let me know what I'm missing here.
Line #139 is where the polyline method GetClosestPointTo() is called and where I suspect the issue is.
Thanks for the help.
-Mark P.
Solved! Go to Solution.
Solved by kdub_nz. Go to Solution.
I actually had tried passing both the UCS and WCS point to the method, but when I passed the WCS point to it, I didn't pass the curent view direction. When passing world coordinates and view direction it works perfectly.
Thanks for the help.
-Mark P.