Author Topic: Ignore casing for getvar "CLAYER"  (Read 1062 times)

0 Members and 1 Guest are viewing this topic.

w64bit

  • Newt
  • Posts: 78
Ignore casing for getvar "CLAYER"
« on: June 06, 2021, 10:45:11 AM »
Is there any simple way to ignore casing for getvar "CLAYER"?

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Ignore casing for getvar "CLAYER"
« Reply #1 on: June 07, 2021, 02:40:32 AM »
AFAIK getvar is not case-sensitive.

w64bit

  • Newt
  • Posts: 78
Re: Ignore casing for getvar "CLAYER"
« Reply #2 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.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Ignore casing for getvar "CLAYER"
« Reply #3 on: June 07, 2021, 07:08:43 AM »
Code: [Select]
(strcase (getvar 'clayer))

w64bit

  • Newt
  • Posts: 78
Re: Ignore casing for getvar "CLAYER"
« Reply #4 on: June 07, 2021, 11:15:20 AM »
Thank you.

danAllen

  • Newt
  • Posts: 133
Re: Ignore casing for getvar "CLAYER"
« Reply #5 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))
)