Lee Mac Posted October 2, 2009 Share Posted October 2, 2009 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)) Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted October 2, 2009 Share Posted October 2, 2009 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. Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted October 2, 2009 Share Posted October 2, 2009 I feel like I've been beating a dead cow over and over again. This has finally been solved. Again, thanks to everyone, especially LEE and Alan. Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 2, 2009 Share Posted October 2, 2009 I feel like I've been beating a dead cow over and over again. This has finally been solved. Again, thanks to everyone, especially LEE and Alan. 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 6, 2009 Share Posted October 6, 2009 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... Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 6, 2009 Share Posted October 6, 2009 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.