TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Dommy2Hotty 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?
(http://theswamp.org/lilly.pond/Dommy2Hotty/Room%20Table.jpg)
-
You can always use TCOUNT from the bonus/express tools (Automatic Text Numbering) If not maybe this will work for you.
(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
-
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?
-
that's what i was just thinking craig. i also have a copy lisp which behaves similar.
-
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. :(
-
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
-
This is a Copy Inc Paste Routine.
TxtInc (http://theswamp.org/phpBB2/viewtopic.php?t=518&highlight=text+increment)
-
You will no doubt like the insert table feature part of 2005!
-
check ListquickFill2004 (LQF2004) at http://www.ikozmos.com