@craig-s-sunderland wrote:
Thank you for your offering Bee, much appreciated. I'm just trying to get my head around what is happening there but from what I gather this code that Lee has written looks for existing intersections or potential intersections? Interesting stuff.
Well, look HERE to help first. Very handy method for such case. All what Lee did is just that he put it into a nice suite.
See the last parameter. I used 'acextendnone' since I wanted the real one (and only one). If I use the extend option, it will find 2 intersections and you need to somehow decide which one is the one you wanted to get.
@craig-s-sunderland wrote:
You mentioned that other bits can be cleaned up, however, you may have already caught onto an issue I have just now realised is present.
The code in the lisp seems to be ignoring my (setq variable (entlast)) on the circles... if I run my lisp routine and use the command line 'select' and '!idf', nil is returned as if the variable was never set in entlast. BUT if I just randomly draw a circle on the screen and use the (setq blob (entlast)) and then in command 'Select!' and '!blob' the selection works... is there any reason why doing the same thing in lisp isn't selecting the circle?
(defun c:IBC ( / OD ID p1 ODs IDs ) ; localized variables
(setq
OD (getdist "OD (mm): ")
ID (getdist "ID (mm): ")
p1 '(0 0)
)
(command "_.Circle" "_non" p1 "D" OD)
(setq ODs (entlast))
(command "_.Circle" "_non" p1 "D" ID)
(setq IDs (entlast))
(princ)
)
Your code is perfectly fine. But since you localized these variables, which is actually a good thing, you need to realize that these variables are valid only within this program IBC, nowhere outside. Try to remove them...
Use the VLIDE editor to trace and watch the difference as I did HERE