Return ename of object snapped to

Return ename of object snapped to

rlheath117
Contributor Contributor
751 Views
5 Replies
Message 1 of 6

Return ename of object snapped to

rlheath117
Contributor
Contributor

Hi All,

I am trying to figure out how to retrieve the ename of the object that was snapped to during a lisp routine. For example, if I have a lisp to draw a pline and the first point of the pline snaps to the end of another line in the drawing can I get the ename of the pre-existing line to check if I want to join to it or not?

 

Thanks in Advance!

 

 

 

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

ВeekeeCZ
Consultant
Consultant

Look at (nentselp) function. 

Get point using (vlax-curve-getendpoint.... ) Or  the 'LASTPOINT sysvar also could help.

 

 

0 Likes
Message 3 of 6

rlheath117
Contributor
Contributor
Accepted solution
Thanks  . 
The only thing this approach is missing is if I snap to a circle center point nentselp doesn't seem to include that in its entity search.  I was hoping to be able to somehow tap into the information used by the osnap routine. Clearly it knows there was a circle center there. I think I can make it work with a manual search for that part. Is there a simpler way that you can see? Thanks Again.
 
 
 

 

0 Likes
Message 4 of 6

ВeekeeCZ
Consultant
Consultant

AFAIK there is no way to get an info of which object you snap to or tell which osnap mode you have actually applied.

Only way is the other way around - you can select an object and get desired point using some specific osmode.

0 Likes
Message 5 of 6

Kent1Cooper
Consultant
Consultant

@rlheath117 wrote:
.... 
The only thing this approach is missing is if I snap to a circle center point nentselp doesn't seem to include that in its entity search.  I was hoping to be able to somehow tap into the information used by the osnap routine. Clearly it knows there was a circle center there. ....

(nentselp) does require that there be some drawn element at that location, which there isn't at the center of a Circle [well, there might be, but not the Circle itself unless you're Zoomed so far out that it's small enough for its perimeter to pass through the pickbox].  I don't know of a way to retrieve that Circle [or other snapped-to object].  But the question raises other questions.  Your original description talked in terms of finding an endpoint of a Line to check whether you want to Join it, but obviously that can't be the issue with a Circle, so other reasons are possible, and obviously other Osnap modes.  From that, I assume an INTersection might also sometimes be what you Osnapped to, in which case there's more than one thing to find there [not necessarily always -- a vertex within a single Polyline is an intersection -- but usually].  Would you care which entity name from among several it reports, or is there some criterion for deciding which to report, or would you want both?

Kent Cooper, AIA
0 Likes
Message 6 of 6

rlheath117
Contributor
Contributor

 

 

0 Likes