Jump to content

Problem with code to select a single piece of text using ssget.


Reu

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by Reu
Link to comment
Share on other sites

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))))

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...