Author Topic: Automatic Numbering of Text  (Read 3965 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Automatic Numbering of Text
« on: February 17, 2004, 04:26:54 PM »
Does anybody have a LISP that lets you enter a starting number like 101 (say for room numbers in a table) then select the text in the table that is for the room numbers and then it will automatically change the text to the next number?  


Craig

  • Guest
Automatic Numbering of Text
« Reply #1 on: February 17, 2004, 04:37:51 PM »
You can always use TCOUNT from the bonus/express tools (Automatic Text Numbering) If not maybe this will work for you.
Code: [Select]
(defun c:tcount (/ cmd t1 t2 t3 index txt1 txt2 txt3 txt4 cs1 cs2)
  (setq cmd (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (prompt "\nSelect numbers in order to change: ")
  (setq t1 (ssget));;gets user input on selection order
  (setq t2 (getint "\nInsert first number: "));;user inserts what the first selectd number needs to be
  (setq t3 (getint "\nNumber increments: "));;this tells the program how many to add to each number
  (setq index 0)
  (repeat (sslength t1);;this repeats however many selections were made
    (setq txt1 (entget (ssname t1 index)));;start check selection
    (setq cs1 (cdr (assoc 1 txt1)))
    (setq cs2 (substr cs1 (strlen cs1) (strlen cs1)));;find out what the last string is
    (if (= cs2 ".");;if there is a period, run this section
      (progn
(setq txt2 (assoc 1 txt1));;extract out the association of 1 from the list
(setq txt3 (cons 1 (strcat (rtos t2 2 0) ".")));;construct a new 1 for the list adding the period at the end
(setq txt4 (subst txt3 txt2 txt1));;substitute the constructed for the associated 1
(entmod txt4);;modify the list
(setq t2 (+ t2 t3));;add increment to number
      );;end progn
    );;end if
    (if (/= cs2 ".");;if there is no period, run this section
      (progn
(setq txt2 (assoc 1 txt1));;extract out the association of 1 from the list
(setq txt3 (cons 1 (rtos t2 2 0)));;construct a new 1 for the list
(setq txt4 (subst txt3 txt2 txt1));;substitute the constructed for the associated 1
(entmod txt4);;modify the list
(setq t2 (+ t2 t3));;add increment to number
      );;end progn
    );;end if
    (setq index (+ index 1));;go to the next seleciton
  );;end repeat
  (setvar "cmdecho" cmd);;reset variable back to original state
  (princ);;clear command line
);;end defun tcount

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Automatic Numbering of Text
« Reply #2 on: February 17, 2004, 04:48:41 PM »
Alright, I don't have that in my express menu, but let's take this in another direction...what about an automatic table/schedule creator?  I know I could upgrade to ADT, but what about in AutoCAD 2000i?

ELOQUINTET

  • Guest
Automatic Numbering of Text
« Reply #3 on: February 17, 2004, 04:48:45 PM »
that's what i was just thinking craig. i also have a copy lisp which behaves similar.

Craig

  • Guest
Automatic Numbering of Text
« Reply #4 on: February 17, 2004, 04:57:09 PM »
Quote from: Dommy2Hotty
Alright, I don't have that in my express menu, but let's take this in another direction...what about an automatic table/schedule creator?  I know I could upgrade to ADT, but what about in AutoCAD 2000i?

With a little work and some time I'm sure that could be written. The problem I see with that is it being a custom application to fit your work environment unless you are creating standard tables/schedules that any other compnay might use. I have several of those type programs written but they would probably do you no good being they were written to work with the way this company does its schedules.  :(

ELOQUINTET

  • Guest
Automatic Numbering of Text
« Reply #5 on: February 17, 2004, 05:08:42 PM »
go to www.cadaddon.com and check out table manager. it's like having xcel for autocad and you can do cool schedules. that's my 2 cents

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Automatic Numbering of Text
« Reply #6 on: February 17, 2004, 06:58:10 PM »
This is a Copy Inc Paste Routine.

TxtInc
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Serge J. Gianolla

  • Guest
Automatic Numbering of Text
« Reply #7 on: February 17, 2004, 10:36:03 PM »
You will no doubt like the insert table feature part of 2005!

Anonymous

  • Guest
Automatic Numbering of Text
« Reply #8 on: June 25, 2004, 10:42:14 AM »
check ListquickFill2004 (LQF2004) at http://www.ikozmos.com