Auto Numbering Cable Numbers That Can Edit Text or Attributes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am currently utilizing a Lisp script that effectively updates cable numbers formatted as text. However, with recent changes in our numbering methodology, where cable numbers are now assigned using attributes, I find the need to enhance the script to accommodate this update.
The existing script appends "OO" to cable numbers less than 10 and a single "O" to numbers less than 100. For the enhanced version, it would be optimal to maintain this functionality but ensure that numbers equal to or greater than 100 are left unmodified without any added zeros.
Looking for an Lisp routine to support both text and attributes while adhering to the numbering modifications specified above?
Thank you
(defun c:avnumber (/ txttmp no# ss obj)
(vl-load-com)
(initget 1)
(setq no# (getint "\nEnter number: ")
); setq
(setvar "errno" 0)
(while
(while
(and
(/= (getvar "errno") 52) (not ss)
); and
(setq ss (ssget "+.:S" '((0 . "*TEXT"))))
); while
(setq obj (vlax-ename->vla-object (ssname ss 0))
no#t (strcat "0" (itoa no#))
); setntion to this request.
(while (< (strlen no#t) 3)
(setq no#t (strcat "0" no#t))
); while
(vlax-put obj 'textstring no#t)
(vlax-release-object obj)
(setq no# (1+ no#)
ss nil
); set
(setvar "errno" 0)
); while
)