layer conversion

layer conversion

Anonymous
Not applicable
854 Views
3 Replies
Message 1 of 4

layer conversion

Anonymous
Not applicable

i  am trying to convert layer numbers to layer name but many layers have a suffix (letter and number)

"1L21" in layername in drawing. my list is generic. i need all layer "1l22" "1H22" "1xl22" to all change to "G-Grid-Bubl"

how can i use a wcmatch to find all the sets and make them all change to one?

 

    (setq lst
       '(   ("1" "G-Grid-Bubl")("2" "G-Grid-Line")("3" "G-Mlin")("4" "G-Schd")("5" "G-Kpln")("6" "G-Line")

(vlax-for lay (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
        (setq nme (vla-get-name lay))
        (setq layername nme);(vla-put-name lay new)
        (vl-some
            (function
                (lambda ( str / new )                                           
                    (if (wcmatch nme (car str))
                       (or (tblsearch "layer" (setq new (strcat (cadr str))))
                            (vla-put-name lay new)
                            (PRINC (strcat "\n" nme " converted"))(princ);(princ ".")
                        );or
                    )
                    (if (wcmatch nme (car str))
                       (or (tblsearch "layer" (setq new (strcat (cadr str))))
                            (vl-cmdf "_.-laymrg" "_n" lay "" "_n" NEW "_y");;(vla-put-name lay new)
                        );or
                    )
                );lamda
            );function
            lst
        )
    )

0 Likes
855 Views
3 Replies
Replies (3)
Message 2 of 4

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

did you wrote this lisp or is it just a sample lisp that does not do the job you're after and you want some one to fix it? did you gave us all your existing layers name you want to change and to what?

 

moshe

 

 

 

 

Message 3 of 4

Sea-Haven
Mentor
Mentor

It may be easier to dump the layers open in excel column A, do the merge part column B, column c new layers, use concatenate make column D do sort copy and paste to a text file and save as a script can be easily redited. 

 

The  problem is what layers may be present and still have to make some sort of list new-old.

0 Likes
Message 4 of 4

pendean
Community Legend
Community Legend
Have you had a chance to just use CHECKSTANDARDS command with one of your stock template files' DWS file to fix outside files?

Much quicker than developing a unique to-from layer list for a LISP to use for each ad every file.



0 Likes