Page 1 of 1

Get objects in one point

Posted: Wed Dec 14, 2011 1:55 am
by arrowman
Hello,
I try to choose objects in one point. I use:

Code: Select all

(setq PtsList ( list (setq P1(getpoint "P1")) (setq p2(getpoint P1 "P2")) ))
setq ss (ssget "CP" PtsList))
(prin1 (sslength ss ))
I choose two times the same point. And I have error:
; ----- Error around expression -----
(SSLENGTH SS)
;
; error : bad argument type <NIL> ; expected SELECTIONSET at [SSLENGTH]
Please, help me:-)

Regards,
A.

Re: Get objects in one point

Posted: Wed Dec 14, 2011 9:25 am
by nuntius
From a web search, this appears to be Autolisp.

Here's your code, refactored to be more readable to my eye.

Code: Select all

(setq P1 (getpoint "P1"))
(setq p2 (getpoint P1 "P2"))))
(setq PtsList (list P1 p2))
(setq ss (ssget "CP" PtsList))
(prin1 (sslength ss))
Based on your error message, it appears that the ssget is failing and returning NIL instead of a SELECTIONSET object; but I don't know enough about that function to understand why.