Jump to content

wcmatch case sensitivity


waders

Recommended Posts

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"))
)
     )
   )
 )

Link to comment
Share on other sites

You place strcase like this.

(wcmatch (setq OldName (strcase (vla-get-Name blk))) "*LS")

 

What is the purpose of the OldName variable?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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...