GetEntity and UCS

GetEntity and UCS

Anonymous
Not applicable
1,063 Views
2 Replies
Message 1 of 3

GetEntity and UCS

Anonymous
Not applicable

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.

0 Likes
Accepted solutions (1)
1,064 Views
2 Replies
Replies (2)
Message 2 of 3

kerry_w_brown
Advisor
Advisor
Accepted solution

 

Is the point passed to GetClosestPointTo() in UCS or WCS ??

WCS coordinates are expected.


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 3 of 3

Anonymous
Not applicable

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.

0 Likes