lisp for changing layer names

Discussion in 'AutoCAD' started by claudio, Sep 18, 2003.

  1. claudio

    claudio Guest

    is there a lisp program for modifiying parts of layer names, say changing the "FLR" in a layer name to just "F"?
    thanks,
    c
     
    claudio, Sep 18, 2003
    #1
  2. Try this

    Peter Jamtgaard

    (defun C:LAYSUB (/ LAY OBJ STR1 STR2)
    (setq STR1 (getstring "\nEnter string to replace: ")
    STR2 (getstring "\nEnter replacement string: ")
    )
    (vlax-for OBJ
    (vla-get-layers
    (vla-get-activedocument
    (vlax-get-acad-object)
    )
    )
    (setq LAY (vla-get-name OBJ)
    LAY (vl-string-subst STR2 STR1 LAY)
    )
    (if (not (tblsearch "LAYER" LAY))
    (vl-catch-all-apply
    'vla-put-name (list OBJ LAY)
    )
    )
    )
    (prin1)
    )
    is there a lisp program for modifiying parts of layer names, say changing
    the "FLR" in a layer name to just "F"?
    thanks,
    c
     
    Peter Jamtgaard, Sep 18, 2003
    #2
  3. claudio

    R.K. McSwain Guest

    If the FLR is at the beginning or end of the layer name, just use the RENAME command. For example if FLR is prefix, specify *FLR as old name and *F as new name.

    If it's in the middle or at random locations - there are lisps that have been posted in the last few days here, just search this NG
     
    R.K. McSwain, Sep 18, 2003
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.