LISP-routine
LISP-routine
(OP)
Hi,
I'm searching for a lisproutine that can do the following thing.
- It asks a string (for instance "N12.")
- It asks an incremental startnumber (for instance "1")
- It asks to select objects
- It places the string together with the incremental number in an attribute "KRING"
The result must be this:
Attribute1: Attribute2: Attribute3:
N12.1 N12.2 N12.3
The way the objects are selected is also the way the number are incremented and placed.
Can anyone help me for this problem?
regards
HMO
I'm searching for a lisproutine that can do the following thing.
- It asks a string (for instance "N12.")
- It asks an incremental startnumber (for instance "1")
- It asks to select objects
- It places the string together with the incremental number in an attribute "KRING"
The result must be this:
Attribute1: Attribute2: Attribute3:
N12.1 N12.2 N12.3
The way the objects are selected is also the way the number are incremented and placed.
Can anyone help me for this problem?
regards
HMO





RE: LISP-routine
RE: LISP-routine
The following code converts the text and dimension objects as you defined above. The code defines a new command "SNN".
(defun c:snn( / e elist n pstr )
(setq pstr (getstring "\n String: "))
(if (/= pstr "")
(setq pstr (strcat pstr "."))
)
(if (not (numberp *nncounter*))
(progn
(initget 1)
(setq *nncounter* (getint "\n Start from: "))
)
(progn
(princ "\n Start from <")
(princ (rtos *nncounter* 2 0))
(princ ">: ")
(setq n (getint))
(if (numberp n)
(setq *nncounter* n)
)
)
)
(while (setq e (entsel))
(command "._UNDO" "G")
(setq elist (entget (car e)))
(setq elist (subst (cons 1 (strcat pstr
(itoa *nncounter*)))
(assoc 1 elist) elist))
(entmod elist)
(command "._UNDO" "E")
(setq *nncounter* (1+ *nncounter*))
)
(princ)
)
Regards,
Farzad