Reu Posted February 8, 2013 Share Posted February 8, 2013 What is wrong with my coding? (defun 1ststring () (if (while (= str nil) (setq ss (ssget ":S" '((0 . "TEXT"))) str (cdr (assoc 1 entget ss)) ) ;_end setq (setq str nil) ) ;_end while ) ;_end if ) ;_end defun Quote Link to comment Share on other sites More sharing options...
Reu Posted February 8, 2013 Author Share Posted February 8, 2013 What is wrong with my coding? (defun 1ststring () (if (while (= str nil) (setq ss (ssget ":S" '((0 . "TEXT"))) str (cdr (assoc 1 entget ss)) ) ;_end setq (setq str nil) ) ;_end while ) ;_end if ) ;_end defun Nevermind (defun 1ststring () (setq ss (ssget ":S" '((0 . "TEXT"))) str (cdr (assoc 1 entget ss)) ) ;_end setq ) ;_end defun Sincerely, Mr. Overcomplicated Quote Link to comment Share on other sites More sharing options...
Reu Posted February 8, 2013 Author Share Posted February 8, 2013 On another note I am interested to learn a little about writing a 'while' expression in an 'if' statement. Quote Link to comment Share on other sites More sharing options...
Reu Posted February 8, 2013 Author Share Posted February 8, 2013 (edited) Nevermind ;;; Function (1ststring) ;;; Description: Get the string from the first text object to be edited. ; (defun 1ststring (/ ss str) (setq ss (ssget "_:S" '((0 . "TEXT"))) ; Select the text to be edited. str (cdr (assoc 1 (entget (ssname ss 0)))) ; Get the text string from the selected text. ) ;_end setq ) ;_end defun Sincerely, Mr. Overcomplicated Edited February 8, 2013 by Reu Quote Link to comment Share on other sites More sharing options...
BIGAL Posted February 8, 2013 Share Posted February 8, 2013 If your only picking 1 text maybe use entsel only disadvantage is it will not check if its text. Basicly code is same (setq ent (car (entsel "\nSelect Text: "))) (setq str (cdr (assoc 1 (entget ent)))) Quote Link to comment Share on other sites More sharing options...
Reu Posted February 11, 2013 Author Share Posted February 11, 2013 Thanks BIGAL, that disadvantage is precisely why I didn't use it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.