chacamasur wrote:
....
I get the following error --->...STDM-50 loaded; error: bad function: 0
....(if (= (tblsearch "DIMSTYLE" "STDM") nil)
(PRINC "\n...Please Run SETSTD")
(
(setvar "cmdecho" 0)
....
I think you may just need to change that left parenthesis that's on a line by itself to a right parenthesis -- it appears to be the closing parenthesis for the (if) function above it. Since it's a left [opening] parenthesis instead, it's being taken as the beginning of the 'else' arguement for that (if) function, and what tfollows is setting CMDECHO to 0, which returns 0, and that is where I think the "bad function: 0" message is coming from.
Sounds like parentheses problems are a common cause of this error.
This was also my issue just now; I just figured out (after staring at the same code for 2 hours) that my issue was I'd defined a function like so:
(defun boundary_annulus( InnerDiam OuterDiam TempLayerName OutputLayerName )
(setq layername OutputLayerName )
(setq templayername TempLayerName )
......
);defun
And as soon as I added a space after the function name (before the parenthesis for the arguments), the cryptic & useless error message vanished. AutoLisp debugging output and error message readability leaves a lot to be desired...
Good catch.
Symbol names can consist of most any characters (except spaces).
(defun boundary_annulus(
is trying to define a function named "boundary_annulus(" with the parenthesis as the last character, thus screwing up everything that follows.
Though you can't defun a protected symbol, as in (defun defun ( ...))
But you can (setq define defun).
Decades ago we had a competition to write a function to draw a Christmas tree in the the fewest number of characters. I think I won because mine was the best tree but lost because I had too many characters, even after I (setq s setq a append c cons l list r repeat w while) etc.
John F. Uhden
Another thing not allowed in symbol names in AutoLISP is a period.
- This has a rather dangerous behaviour, which I consider a bug:
_$ (setq aa 'b.c)
B
_$ aa
B
_$ (print.qwertyuio 'asdfghjqwertyui.23456789)
ASDFGHJQWERTYUI ASDFGHJQWERTYUI
So, AutoLISP just stops reading at the period, ignoring the rest, with no warning. This will create very nice aliasing bugs in the program.
In other Lisp implementations this is quite acceptable:
Common Lisp:
CLO 4 > (setq aa 'b.c)
B.C
Emacs Lisp:
(setq aa 'b.c)
b\.c
--
Can't find what you're looking for? Ask the community or share your knowledge.