You are correct, Sir. I was just looking at it as the OP stated them (blocks) being simple light fixtures and me assuming that they would be on the same layer and such.
My next question would be: How do I make the function work with two blocks that I have already selected?
If you have them in a selection set made with (ssget) or (ssadd) or something [let's call it ss], and there's nothing else in that selection set:
b1 (ssname ss 0))
b2 (ssname ss 1))
and the rest the same.
If you have their entity names separately stored in variables, just remove the lines setting b1 & b2, and replace b1 & b2 in the rest of the code with the variable names you've already got.
I used VL to avoid the issue of annotative blocks in some cad versions.
(defun c:Test (/ ss lst)
(if (setq ss (ssget "_:L" '((0 . "INSERT"))))
(if (eq (sslength ss) 2)
(setq lst (mapcar '(lambda (i) (vlax-ename->vla-object (ssname ss i))) '(0 1)))
(mapcar 'vla-get-insertionpoint (reverse lst))
(princ "Selection amount must be equal to 2!")
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!