This line is invalid:
(defun c:sgrill(gsize)
because C: command definitions are not supposed to have arguments -- 'gsize is a variable, and should be after a slash and a space. If something is defined with arguments [things in parentheses after the function name but without a slash before them], then that's a function definition rather than a command definition, and it needs to be supplied with a value for the argument when it's used, and called for in parentheses with the function name and the argument(s). You could do:
(defun sgrill (gsize); without the C:
but you would have to use it this way [for a 12" one]:
(sgrill 12)
This line is also invalid:
(while (/= gsize (or 6 8 10 12 14 16))
The (/=) function requires numerical or string inputs, but that (or) function is just going to return T.
But I suspect that's not really what you want to check for, i.e. presumably you don't want a value of, say, 13. I would suggest:
(while (not (member gsize '(6 8 10 12 14 16)))
But here's a suggested different approach. If you use the (initget)/(getkword) combination, it will accept only specified answers, and ask again until it gets an acceptable one. So you don't need the (while) or (alert) parts. And, it will have the answer as a text string, which you can paste into the Block name, without having to spell out an Insertion for each different size. [Also, you don't need the .dwg filetype ending -- that's the only kind of file it will use.] The whole thing could be something like:
(defun c:sgrill (/ gsize)
(initget 1 "6 8 10 12 14 16"); [1 = no Enter allowed]
(setq gsize (getkword "Supply grill size [6/8/10/12/14/16]: "))
(command "_.insert" (strcat "SG" gsize))
(princ)
)
Kent Cooper, AIA