@marko_ribar wrote:
....
....
(prompt "\nSelect 3 rectangles...")
(setq ss (ssget '((0 . "LWPOLYLINE") (-4 . "<or") (70 . 1) (70 . 129) (-4 . "or>") (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>"))))
(while (or (not ss) (and ss (/= (sslength ss) 3)))
(prompt "\nEmpty sel. set... Please reselect 3 rectangles again...")
(setq ss (ssget '((0 . "LWPOLYLINE") (-4 . "<or") (70 . 1) (70 . 129) (-4 . "or>") (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>"))))
....
Not really relevant to the operational part of the question, but just some suggestions about the selection....
There's a slightly simpler way to filter for closed Polylines whether or not linetype generation is enabled in them, than checking for whether the (assoc 70) value is either 1 or 129 -- the one below checks simply for whether it contains the 1 bit, and whether or not it also contains the 128 bit doesn't matter.
The (42 . 0) filter item would be satisfied with only one no-bulge [line] segment, and so would accept selection of many non-rectangular Polylines. I don't think you can filter for whether all bulge factors are zero, but if it's important [i.e. you can't assume the User is going to select only the right kinds of things], you could check the selected ones for that after selection. You could also check for whether they're actually rectangular [I have code to do that if you're interested], and whether they're aligned in the same direction, with more code, but again, not in the (ssget) filtering.
I would also check for four vertices.
And rather than spell out the entire (setq) line with (ssget) filter twice, I would re-arrange things a little to do it only once.
....
(prompt "\nSelect 3 closed rectangular Polylines: ")
(while
(not
(and
(setq ss (ssget '((0 . "LWPOLYLINE") (90 . 4) (-4 . "&") (70 . 1))))
(= (sslength ss) 3)
); and
); not
(prompt "\nIncorrect - try again...")
); while
....
[By the way, the original's scolding is incorrect in that an empty selection set is not the only reason it would appear.]
Kent Cooper, AIA