- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to make a routine where I select the blocks that I need to auto-populate their attributes with incremental series number at the end. For example: "Motor-1", "Motor-2", "Motor-3"... "Motor-100". The thing is, this series number changes over numerous revisions and the series numbers are assigned based on the engineer's wiring diagram so Lee Mac's auto numbering LISP is not applicable. I would be needing something more simple and flexible where if there are 100 blocks, I can select them 1 by 1 and the LISP will cycle through my selection 1 by 1 and populate the attribute tag that increments in order of my selection. If there are future revision, I can just select the blocks 1 by 1 again but in a different order, where required.
From Lee Mac's LISP codes, I have compiled some syntaxes and derived with these but no matter how much I search and edit, I cannot make it work.
(defun c:autotag (/ ssBlock intIncrement startValue prefixValue objBlock)
(setq ssBlock (ssget "_I"))
(setq intIncrement 0)
(setq startValue (getint "\nSpecify Start Value: ")
prefixValue (strcase (getstring t "\nSpecify prefix: ")))
(repeat (sslength ssBlock)
(setq objBlock (vlax-ename->vla-object (CDR (CAR (entget (ssname ssBlock intIncrement))))))
(setpropertyvalue obj "EQP_TAG" (strcat prefixValue (rtos startValue 2 0)))
(setq startValue (1+ startValue))
(setq intIncrement (1+ intIncrement))
)
)
I know this community would be willing to help. Thank you all!
Solved! Go to Solution.