Isolate DTEXT.......one Small Problem Now

sashk

Usenet Archive
Joined
Jul 14, 2003
Messages
69
Reaction score
0
Okay, I figured out the whole thing, but I have one problem. If the user selects the option to pick his/her own text, they can do it. Then, it will alert them the amount of enities that have been changed to the 00DTEXT layer. But the problem is that is nothing is selected, or all of the text is filtered out because it is mtext, it will error out instead of saying "0 text enities changed" Why is this??

Here is the routine

(defun c:isodtext
  (command "._undo" "begin")
  (if (not (tblsearch "layer" "00DTEXT"))
    (command "_.layer" "make" "00DTEXT" "c" "yellow" "" "")     )   (initget "Whole Select");cannot write "No Point"....space will throw the code off!   (setq wholeselect (getkword " \nDo You Want to elect Your Own Area To Analyze for DTEXT\nor Have it Select the [W]hole Drawing for You? "))

(if (= wholeselect "Whole")
      (progn
(setq DTEXT (sslength (ssget "x" '((0 . "TEXT")))))
        (COMMAND "_.CHANGE" "P" "" "P" "LA" "00DTEXT" "") (COMMAND "_.CHANGE" "P" "" "P" "C" "BYLAYER" "")         (alert (strcat (itoa DTEXT) " Dtext Enities Have Been Placed on the 00DTEXT Layer.\nPlease Change to Mtext Enities ")) );end progn     );end if

(if (= wholeselect "Select")
      (progn
(setq DTEXT (sslength (ssget '((0 . "text")))));ask user to select area for analysis         (COMMAND "_.CHANGE" "P" "" "P" "LA" "00DTEXT" "") (COMMAND "_.CHANGE" "P" "" "P" "C" "BYLAYER" "")         (alert (strcat (itoa DTEXT) " Dtext Enities Have Been Placed on the 00DTEXT Layer.\nPlease Change to Mtext Enities ")) );end progn     );end if   (command "._undo" "end")   (princ)
  )
 
The function (sslength) returns an error if the argument is nil, which it could be if the call to (ssget) finds no matching objects.

(setq DTEXT (sslength (ssget "x" '((0 . "TEXT"))))) ; this is buggy

--
R. Robert Bell, MCSE
www.AcadX.com

| Okay, I figured out the whole thing, but I have one problem. | If the user selects the option to pick his/her own text, they can do it. Then, it will alert them the amount of enities that have been changed to the 00DTEXT layer. But the problem is that is nothing is selected, or all of the text is filtered out because it is mtext, it will error out instead of saying "0 text enities changed" Why is this?? | Here is the routine | | (defun c:isodtext | (command "._undo" "begin") | (if (not (tblsearch "layer" "00DTEXT")) | (command "_.layer" "make" "00DTEXT" "c" "yellow" "" "") | ) | (initget "Whole Select");cannot write "No Point"....space will throw the code off! | (setq wholeselect (getkword " \nDo You Want to elect Your Own Area To Analyze for DTEXT\nor Have it Select the [W]hole Drawing for You? ")) | | (if (= wholeselect "Whole") | (progn | (setq DTEXT (sslength (ssget "x" '((0 . "TEXT"))))) | (COMMAND "_.CHANGE" "P" "" "P" "LA" "00DTEXT" "") | (COMMAND "_.CHANGE" "P" "" "P" "C" "BYLAYER" "") | (alert (strcat (itoa DTEXT) " Dtext Enities Have Been Placed on the 00DTEXT Layer.\nPlease Change to Mtext Enities ")) | );end progn | );end if | | (if (= wholeselect "Select") | (progn | (setq DTEXT (sslength (ssget '((0 . "text")))));ask user to select area for analysis | (COMMAND "_.CHANGE" "P" "" "P" "LA" "00DTEXT" "") | (COMMAND "_.CHANGE" "P" "" "P" "C" "BYLAYER" "") | (alert (strcat (itoa DTEXT) " Dtext Enities Have Been Placed on the 00DTEXT Layer.\nPlease Change to Mtext Enities ")) | );end progn | );end if | (command "._undo" "end") | (princ) | )
|
 
(if
(and
(= wholeselect "Whole")
(setq ssText (ssget "x" '((0 . "TEXT"))))
)
(progn
(setq DTEXT (sslength ssText))
(COMMAND "_.CHANGE" ssText "" "P" "LA" "00DTEXT" "C" "BYLAYER" "") (alert (strcat (itoa DTEXT) " Dtext Enities Have Been Placed on the 00DTEXT Layer.\nPlease Change to Mtext Enities ")) ) ;_ end progn ) ;_ end if
 

Member Recommended

Back
Top