Jump to content

Layer Lisp


jaylo23

Recommended Posts

These seem to work fine for me:

 

(defun c:RemSuff  (/ suff doc name)
 (vl-load-com)

 (setq suff (getstring t "\nSpecify Suff to Remove: "))

 (vla-StartUndoMark (setq doc (vla-get-ActiveDocument
                                (vlax-get-acad-object))))

 (vlax-for lay (vla-get-layers doc)
   (and (wcmatch (strcase (setq name (vla-get-name lay))) (strcase (strcat "*" suff)))
        (not (wcmatch name "*|*"))
        (vl-catch-all-apply 'vla-put-Name
          (list lay (substr name 1 (vl-string-position (ascii suff) name nil T))))))

 (vla-EndUndoMark doc)
 (princ))


(defun c:laysuff (/ suff doc)
 (vl-load-com)

 (setq suff (getstring "\nSpecify Suffix for all layers: "))

 (vla-StartUndoMark (setq doc (vla-get-ActiveDocument
                                (vlax-get-acad-object))))

 (vlax-for lay (vla-get-layers doc)
   (or (wcmatch (strcase (vla-get-name lay)) (strcase (strcat "*|*,*" suff)))
       (vl-catch-all-apply 'vla-put-Name
         (list lay (strcat (vla-get-Name lay) suff)))))

 (vla-EndUndoMark doc)
 (princ))

Link to comment
Share on other sites

  • Replies 105
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    41

  • alanjt

    30

  • JeepMaster

    15

  • kalarpu

    11

OMG, I really don't know what da heck is going on with my computer. The remsuff lisp is all screw up on my machine. I deleted it and made a new one from your latest lisp Lee and it works fine now, even skips the xrefs too. Thanks SO MUCH.

Link to comment
Share on other sites

I feel like I've been beating a dead cow over and over again. :oops: This has finally been solved. Again, thanks to everyone, especially LEE and Alan.:thumbsup:

Link to comment
Share on other sites

I feel like I've been beating a dead cow over and over again. :oops: This has finally been solved. Again, thanks to everyone, especially LEE and Alan.:thumbsup:

 

Always happy to help. I'm just glad we were able to get everything sorted out. I'm especially proud of this little portion. :wink:

(substr name 1 (vl-string-position (ascii suff) name nil T)))))

 

It's funny, you don't know the capabilities of the language until you really have to make it work for you.

Link to comment
Share on other sites

I agree Alan, nice coding on that part - great use of vl-string-position, I even had to look up what argument combination you had used.

 

>> Jeep,

 

No worries mate, always happy to help. Its just a shame that I can't code too much now that I am back at university... I only have limited access to the internet in between studying...

Link to comment
Share on other sites

I agree Alan, nice coding on that part - great use of vl-string-position, I even had to look up what argument combination you had used.

:) I remembered something about being able to start from the right side of the string. It was either that, or something like: (vl-list->string (reverse (vl-string->list...

 

Sad part is, neither one of us will remember this when we actually need it. LoL

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...