Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Im trying to develop a code that will cout increase a number inside a block/attribute.
I want to start to choose a prefix before my number. Ex. 01.xxx
Then i want to write wich number to start with after my prefix Ex. 01.001
Its important that the number have 3 digits.
After i would like to select my block, next block and so on and increase my number automatic.
Does anyone have an idea to help me. There is som issues with the code that i cant figure out on my own.
(defun C:adress() (princ "\n ADRESS - Count the adress") (setq textb (getstring T "\nText before nr: ")) (setq num (getint "\nStarting number: ")) (while (<= doing 50) (setq txt (strcat textb (itoa num) textb)) (princ txt) (setq blk1 (car (entsel "\nChoose block:"))) (setq ed (entget blk1)) (if (= "ATTRIB" (cdr (assoc 0 ed))) (if (= blk1 (cdr (assoc 330 ed))) (if (= "ADR" (cdr (assoc 2 ed))) (entmod (subst (cons 1 txt)(assoc 1 ed)ed)) ) ) ) ) )
Solved! Go to Solution.