So I'm trying to come up with a way to allow the user to select blocks one at a time, or in large swaths, but I want things to happen to each block right after it's selected. (autofill an attribute, or similar)
Is there some way to get ssget to report each SS that is made, independent of the user pressing enter? Or is there a way to transparently change from entsel mode to ssget mode if the user selects nothing, but use the point that the user selected as the first corner of a window...
Put another way:
Entsel returns the entity name (and some more) immediately when the user selects the entity.
SSGet allows the user to select individual entities, but just keeps adding them to a buffer until the user presses enter. Is there a way to get ssget to terminate everytime a selection is made, regardless of enter.
Here's what I have so far, but the user has to press "M" while selecting to switch to ssget mode...
Currently it just draws a circle at the block insertion point.
Code:
(defun C:SelTest ( / En SS Len Cnt Loop)
(setq Loop T)
(while Loop
(initget "End Multiple")
(setq En (entsel "\nSelect entities or [End/Multiple]: "))
(cond ((= En "End")
(setq Loop nil)
);end or
((= En "Multiple")
(if (setq SS (ssget))
(progn
(setq Len (sslength SS)
Cnt -1
)
(while (< (setq Cnt (1+ Cnt)) Len)
(setq En (ssname SS Cnt))
(DrawCircleAt En)
);end while
);end progn
);end if
)
((null En)
(princ "\nNo object selected!")
)
(T
(DrawCircleAt (car En))
);end T
);end cond
);end while
(princ)
);end defun
(defun DrawCircleAt (En / )
(command "CIRCLE"
(cdr (assoc 10 (entget En)))
0.25
);end command
(princ)
);end defun