Trying to create a routine to do the following:
Get a TEXT object,
If not a text object use the point picked as the first corner
of a selection box to get a selection set of text objects.
problem using entsel is that if nul a point is not returned
This is how I solved the problem but was wondering if someone had a
better or differant solution.
(defun c:test (/ ent pt pt2 idx ss)
(while ; loop until point is picked
(not
(setq
pt (getpoint "\nSelect Text to Increment or select a group of text.")
)
)
(princ "\nPlease try again...")
)
(cond
;;=================================================
((setq ss (ssget pt '((0 . "TEXT,MTEXT"))))
;; user picked a text object
(setq ent (ssname ss 0))
(if (cdr (assoc 3 (entget ent)))
(prompt "\nMTEXT is too large, not supported!")
(prompt "\nGot a single text object.")
) ; endif
) ; end cond 1
;;=================================================
;; No text selected so get a selection set
((and (setq pt2 (getcorner pt)) ; user to pick window corner
(setq ss (ssget "_C" pt pt2 '((0 . "TEXT,MTEXT"))))
)
(setq idx (sslength ss)) ; got some text objects
(while (>= (setq idx (1- idx)) 0)
(setq ent (ssname ss idx))
(if (cdr (assoc 3 (entget ent)))
(prompt "\nMTEXT is too large, not supported!")
(prompt "\nGot a sel set of text objects.")
) ; endif
) ; end while
) ; end cond 2
((prompt "\n*-* Not Text, Try again. *-*")
) ; end cond 3
) ; end cond stmt
(princ)
)
If you use
(cond
((setq ss (ssget ":S" '((0 . "TEXT,MTEXT")))))
((setq ss (ssget '((0 . "TEXT,MTEXT")))))
)
The user has to click twice to start the second ssget
If you use
((setq ss (ssget '((0 . "TEXT,MTEXT")))))
you have to click twice to get a single text object.
Any ideas?