Thanks Lee for the update. Could I ask what is the difference between the way the original code versus the revised one? I did not know if there was a few strings in there that just needed to be "swapped" to become a prefix from the original suffix.
The original code included an
if statement to test whether the layer of the selected object was already suffixed, however, this is unnecessary as such objects can easily be omitted from the initial selection using an appropriate
ssget filter list.
To revise the original code you would essentially need to change
(cons 2 (strcat elay "-New")) to
(cons 2 (strcat "New-" elay)) however, the test expressions for the
if statement would also need to be either removed or amended to test for the existence of this prefix.
Also, for a side note (I guess) with users who are on Civil3D Cogo / parts, the original lisp can take those parts and move them to the correct layer. I tried with the revised and am not getting the same result. Thank you Lee for your help!
I don't use the Vertical applications (such as Civil/Map etc.), but I'm guessing that
entmod may not be sufficient to change the layer for objects native to these applications; the following code will change the ActiveX layer property instead.
(defun c:mf
( / a e i n s
) )
)
)
)
)
)
(EDIT: Changed (assoc 8 (entget e)) to (cdr (assoc 8 (entget e))) to save a few keystrokes later on)