PDA

View Full Version : assigning variables inside defun


jeff.richards
2008-11-26, 04:30 PM
All,

I am working on a routine that will manipulate layer information and objects on existing layers. I wrote this test routine using a test dwg with a few layers (Layer1, Layer2, etc.). I began with the IF function and then built out to the COND function. It worked as planned when specifying layer names.

The next step was to wrap the whole thing in a DEFUN function and assign variables to the layer values. Then I executed the new function and included values for the variables. I get an "; error: too many arguments" message. Is this because I am supplying too many functions to the DEFUN function, or because the layer values are not lists?

Thanks,

jeff.richards
2008-11-26, 05:17 PM
Yes, but I was initially just trying to get the appropriate statement to print from inside the DEFUN and then move on to the more complex code.

Thanks,

lpseifert
2008-11-26, 10:07 PM
you're declaring variables local and trying to use outside the defun.
change to this and see if it works

(defun layfnd (lay1 lay2)

jeff.richards
2008-11-26, 10:37 PM
lpseifert,

Yep, that did it. Thanks again and have a good Thanksgiving.