waders Posted October 3, 2014 Posted October 3, 2014 Hey, Have a routine that I'm having issues modifying. I need it to not be case sensitive went renaming the xref from xx01ls.dwg to LS. The reason is once in a while someone might name the xref XX01LS.dwg and the code is looking for XX01ls.dwg. See code below. Thanks (defun c:refls (/ ref refnamepath Oldname) (COMMAND "CLAYER" "XREF-LS") (setq ref (CAR (vl-directory-files dir "*ls.dwg"))) (if (/= ref nil) (progn (setq refnamepath (strcat dir "\\" ref)) (COMMAND "-XREF" "Overlay" refnamepath "0,0" "1" "1" "0") (vl-load-com) (vlax-for blk (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-Acad-Object))) (if (and (equal (vla-get-IsXref blk) :vlax-true) (wcmatch (setq OldName (vla-get-Name blk)) "*LS") ) (vla-put-Name blk "LS")) ) ) ) ) Quote
BlackBox Posted October 3, 2014 Posted October 3, 2014 Consider the STRCASE function, when getting the Name Property of blk variable. Quote
waders Posted October 3, 2014 Author Posted October 3, 2014 Okay but where do I place that? I know where to put using setq but I never have used it w/ wcmatch before. Quote
7o7 Posted October 4, 2014 Posted October 4, 2014 You place strcase like this. (wcmatch (setq OldName (strcase (vla-get-Name blk))) "*LS") Quote
BlackBox Posted October 4, 2014 Posted October 4, 2014 You place strcase like this. (wcmatch (setq OldName (strcase (vla-get-Name blk))) "*LS") What is the purpose of the OldName variable? Quote
7o7 Posted October 5, 2014 Posted October 5, 2014 What is the purpose of the OldName variable? I don't know, maybe author want to save the Oldname for the next function, just like "dir" variable came from no where, maybe from the previous function. I just show where to put the strcase func. Quote
waders Posted October 6, 2014 Author Posted October 6, 2014 Thanks 7o7 that seems to do it. I not sure the 100% reason why I need the OldName variable because I didn't write that part of the code back in 07 but I needed to update it. Anyway the reason I think is it has some thing to do w/ renaming the xref. In are projects we use that to help manage the layers. Yes the "dir" variable is in the front end of the code. I could post the whole code if you what. But besides this update. I am in the process of adding more to this. Again thanks for looking at this and helping. Quote
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.