Sponsored links

【AutoLISP FIRST STEP】Uppercase?Lowercase?

Sponsored links
AutoLISP
Sponsored links

Basically, AutoLISP is NOT case-sensitive.

You can use whichever you want.
However, there are some exceptions.  

Sponsored links

AutoLISP Uppercase / Lowercase

AutoLISP is NOT case-sensitive.
Therefore:

(defun c:hellow () (alert “Hello World”))

(DEFUN C:HELLO () (ALERT “Hello World”))

both have the same result.

Exception

Dialog Box

When an AutoLISP program uses a Dialog Box, it needs another language called Dialog Control Language(DCL).

DCL is case-sensitive.

AutoLISP communicates DCL by value called “Key”.
Because DCL is case-sensitive, the value of the “Key” in the AutoLISP has to match to the value of the Key in the DCL.

To Compare Strings

AutoLISP function = and wcmatch are case-sensitive.

For example, (= “A” “a”) or (wcmatch “A” “a”) return nil because these functions judge “A” and “a” are different strings.

Function strcase make all text to uppercase.
If you want to match without case-sensitivity, function strcase might be useful.

(= “A” (strcase “a”))
(wcmatch “A” (strcase “a”))

JagaimoLISP Own Rule 

Even though AutoLISP is not case-sensitive, having a rule makes it easy to read programs.
Here is my rule:

  • AutoLISP function name: Lowercase
  • AutoCAD command: Uppercase
  • Variable Symbol name: Mix (ex. ObjCol)
  • DCL Key: same as Variable Symbol

To Sum Up

  • Basically, AutoLISP is NOT case-sensitive.
  • Dialog Control Language (DCL) is case-sensitive.
  • AutoLISP and DCL communicates with “Key”.
  • The Value of the Key must match.
  • = and wcmatch are case-sensitive.

Comments