Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

LISP-routine 1

Status
Not open for further replies.

Hmo

Electrical
Nov 1, 2003
42
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
 
Replies continue below

Recommended for you

Dear Hmo,

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor