Jump to content

Auto numbering text strings


teknomatika

Recommended Posts

Hello. I have looked here but not found. Does anyone know a routine that enables the auto numbering text strings by selecting one by one?

Link to comment
Share on other sites

Quickie one ;)

 

(defun c:Test (/ s i e)
 ;;;    Tharwat 04.03.2015    ;;;
 (if (setq i (getint "\n Specify the start number :"))
   (while (and (princ "\n Pick a text :")
               (setq s (ssget "_+.:S:E:L" '((0 . "TEXT,MTEXT"))))
          )
     (entupd
       (cdr
         (assoc
           -1
           (entmod
             (subst
               (cons
                 1
                 (strcat (if (< i 10)
                           (strcat "0" (itoa i))
                           (itoa i)
                         )
                         "-"
                         (cdr (assoc 1 (setq e (entget (ssname s 0)))))
                 )
               )
               (assoc 1 e)
               e
             )
           )
         )
       )
     )
     (setq i (1+ i))
   )
 )
 (princ)
)

Link to comment
Share on other sites

Quickie one ;)

 

(defun c:Test (/ s i e)
 ;;;    Tharwat 04.03.2015    ;;;
 (if (setq i (getint "\n Specify the start number :"))
   (while (and (princ "\n Pick a text :")
               (setq s (ssget "_+.:S:E:L" '((0 . "TEXT,MTEXT"))))
          )
     (entupd
       (cdr
         (assoc
           -1
           (entmod
             (subst
               (cons
                 1
                 (strcat (if (< i 10)
                           (strcat "0" (itoa i))
                           (itoa i)
                         )
                         "-"
                         (cdr (assoc 1 (setq e (entget (ssname s 0)))))
                 )
               )
               (assoc 1 e)
               e
             )
           )
         )
       )
     )
     (setq i (1+ i))
   )
 )
 (princ)
)

 

Tharwat,

Excellent. I appreciate the availability and sharing.

Thanks!

Link to comment
Share on other sites

You're welcome! :)

 

I see still lacks some features: For example:

1.1 1.2 1.3 ..... (1/1 1/2 1/3 can .......)

or

1a.1 1a.2 1a.3 ....... (can 1a / 1a 1/2 ........)

If added, the great!

Link to comment
Share on other sites

You could use the 'Replace' option offered by my Incremental Numbering Suite - simply type 'R' when placing text to enter this mode.

 

Lee, also use this routine (NumInc), which is fantastic. However, in this situation in particular, I wanted to add to the sequence number of the selected text string and not just the substitution.

Anyway, thank you for your attention. :)

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