TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: w64bit on June 06, 2021, 10:45:11 AM

Title: Ignore casing for getvar "CLAYER"
Post by: w64bit on June 06, 2021, 10:45:11 AM
Is there any simple way to ignore casing for getvar "CLAYER"?
Title: Re: Ignore casing for getvar "CLAYER"
Post by: roy_043 on June 07, 2021, 02:40:32 AM
AFAIK getvar is not case-sensitive.
Title: Re: Ignore casing for getvar "CLAYER"
Post by: w64bit on June 07, 2021, 03:19:07 AM
I think I explained poorly.
If I use:
Code: [Select]
(getvar "CLAYER") "Abcd")
and the layer name is all in caps (ABCD) I have to make another line
Code: [Select]
(getvar "CLAYER") "ABCD")
in order to get both of them.
But if there is another situation, aBcd, I have to add another line.
That's why I tried to ignore or clean the casing for the result of getvar "CLAYER". Or to find another method.
Title: Re: Ignore casing for getvar "CLAYER"
Post by: roy_043 on June 07, 2021, 07:08:43 AM
Code: [Select]
(strcase (getvar 'clayer))
Title: Re: Ignore casing for getvar "CLAYER"
Post by: w64bit on June 07, 2021, 11:15:20 AM
Thank you.
Title: Re: Ignore casing for getvar "CLAYER"
Post by: danAllen on June 07, 2021, 12:24:34 PM
If you are using wcmatch, I use this helper function to avoid case problems

Code: [Select]
;;;==========================================================
;;; wcmatch with fix on case
;;;==========================================================
(defun wcmatch_NoCase (string pattern)
  (wcmatch (strcase string) (strcase pattern))
)