+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Full Member Reu's Avatar
    Discipline
    See details...
    Reu's Discipline Details
    Occupation
    Drafter II: Mapping
    Discipline
    See details below.
    Details
    Pipeline Drafting
    Using
    AutoCAD 2012
    Join Date
    Jan 2013
    Posts
    25

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

    Registered forum members do not see this ad.

    What is wrong with my coding?

    Code:
    (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
    Romans 10:9,10

  2. #2
    Full Member Reu's Avatar
    Discipline
    See details...
    Reu's Discipline Details
    Occupation
    Drafter II: Mapping
    Discipline
    See details below.
    Details
    Pipeline Drafting
    Using
    AutoCAD 2012
    Join Date
    Jan 2013
    Posts
    25

    Default

    Quote Originally Posted by thunderfoot View Post
    What is wrong with my coding?

    Code:
    (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

    Code:
    (defun 1ststring ()
      (setq	ss  (ssget ":S" '((0 . "TEXT")))
    	str (cdr (assoc 1 entget ss))
      ) ;_end setq
    ) ;_end defun
    Sincerely,
    Mr. Overcomplicated
    Romans 10:9,10

  3. #3
    Full Member Reu's Avatar
    Discipline
    See details...
    Reu's Discipline Details
    Occupation
    Drafter II: Mapping
    Discipline
    See details below.
    Details
    Pipeline Drafting
    Using
    AutoCAD 2012
    Join Date
    Jan 2013
    Posts
    25

    Default

    On another note I am interested to learn a little about writing a 'while' expression in an 'if' statement.
    Romans 10:9,10

  4. #4
    Full Member Reu's Avatar
    Discipline
    See details...
    Reu's Discipline Details
    Occupation
    Drafter II: Mapping
    Discipline
    See details below.
    Details
    Pipeline Drafting
    Using
    AutoCAD 2012
    Join Date
    Jan 2013
    Posts
    25

    Default

    Nevermind

    Code:
    ;;; 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
    Last edited by Reu; 8th Feb 2013 at 10:22 pm.
    Romans 10:9,10

  5. #5
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,716

    Default

    If your only picking 1 text maybe use entsel only disadvantage is it will not check if its text. Basicly code is same

    Code:
     (setq ent (car (entsel "\nSelect Text: "))) 
     (setq str (cdr (assoc 1 (entget ent))))
    A man who never made mistakes never made anything

  6. #6
    Full Member Reu's Avatar
    Discipline
    See details...
    Reu's Discipline Details
    Occupation
    Drafter II: Mapping
    Discipline
    See details below.
    Details
    Pipeline Drafting
    Using
    AutoCAD 2012
    Join Date
    Jan 2013
    Posts
    25

    Default

    Registered forum members do not see this ad.

    Thanks BIGAL, that disadvantage is precisely why I didn't use it
    Romans 10:9,10

Similar Threads

  1. Select by ssget windows but it not done. Help
    By Nad SK in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 19th Jul 2013, 10:15 pm
  2. Add ssget to select specific Blocks
    By Michaels in forum AutoLISP, Visual LISP & DCL
    Replies: 18
    Last Post: 2nd Mar 2011, 02:41 pm
  3. trying to select any single object from within the whole
    By stenews in forum AutoCAD General
    Replies: 9
    Last Post: 29th Nov 2010, 12:41 pm
  4. Help needed with piece of code to load linetype
    By MarcoW in forum AutoLISP, Visual LISP & DCL
    Replies: 21
    Last Post: 27th Apr 2010, 06:20 pm
  5. SSGET - select block by coordinates
    By scubastu in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 30th Oct 2009, 11:47 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts