TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: BudRPerry on January 25, 2016, 11:17:40 AM
-
This is just the very first couple of lines for a routine I'm trying to write. If I type the second and third line into autocad at the command prompt they run just fine, but as soon as I try to put them into a routine it returns:
; error: bad argument type: (or stringp symbolp): nil
If I can't even get past this part there's no hope for the rest...
(defun c:AUTOLAYERFT2 ()
(setvar “ctab” “BV”)
(command “_MSpace”)
)
-
Try this
(setvar 'ctab "BV")
don't double quote ctab.
-
Do your editing in the VLIDE or Notepad (or some variant of Notepad). IOW, an ASCII file editor.
Your "QUOTE" marks are not ASCII character 34, they are the "curly" quotes, characters 8220 and 8221
(defun c:AUTOLAYERFT2 ()
(setvar "ctab" "BV")
(command "_MSpace")
)
Here is your code, copy and pasted into the VLIDE
-
I wonder why the forum displays them as more or less standard quotes ?
NotePad ++
HHmmmm
-
Wow, that was it! I had originally typed it all in Word and just copied it to notepad...it kept the original "curly" quotes! As soon as I retyped the quotes in notepad the routine works! I was pulling my hair out!
Thank You Very Much for the Replies!
-
If you are just starting out with AutoLISP, I would strongly suggest writing your code using the Visual LISP IDE (VLIDE) - here are some resources to get you started:
The Visual LISP Editor - Part 1 (http://bit.ly/19BXiVs)
The Visual LISP Editor - Part 2 (http://bit.ly/16nDctv)
An Introduction to the Visual LISP IDE (http://bit.ly/13LA7J9)
Retrieving Information About a Function (http://bit.ly/154UMJh)
A Shortcut to Localising Variables (http://bit.ly/14pdIQh)
Debugging Code with the Visual LISP IDE (http://bit.ly/1ebl2jl)
-
+1
Another good editor is Notepad++ (https://notepad-plus-plus.org/)
-
I see a lot of people push Notepad ++
Does it integrate into AutoCAD like the VLIDE?
If not, then what is the advantage? (for coding autolisp)
Thanks.
-
It does not incorporate well like VLIDE, however to my knowledge nothing else does either. I use Notepad++ as VLIDE just seems way too clunky.
-
Agree...
Notepad++ integrates into your right-click which is handy and it highlights matching parentheses.
-
I got started using VLIDE in 1999 and have never looked back.
For each his own :)
-
One of the reasons I like NotePad++ is its portable version. I can write codes anywhere.