neekcotrack Posted May 27, 2008 Posted May 27, 2008 I have this lisp I made from a templete someone give why won't it work? (defun c:seal () (initget "Gene Jason Lynn Paul Stuart Todd" (setq UsrName (getkword "\nEnter name [G]ene,[J]ason,[L]ynn,[P]aul,[s]tuart,[T]odd: ") (command "-LA" "" "ON" "" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "THAW" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "" "");;run this for all users first (cond ((= Usrname "Gene") (command "-LA" "" "OFF" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "THAW" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "" "");;GENE'S commands ) ((= Usrname "Jason") (command "-LA" "" "OFF" "" "XTB|PE-GENE" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-TODD" "THAW" "XTB|PE-GENE" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "" "");;JASON'S commands ) ((= Usrname "LYNN") (command "-LA" "" "OFF" "" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "THAW" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "" "");;LYNN'S commands ) ((= Usrname "PAUL") (command "-LA" "" "OFF" "" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "THAW" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-STUART" "" "XTB|PE-TODD" "" "");;PAUL'S commands ) ((= Usrname "STUART") (command "-LA" "" "OFF" "" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-TODD" "THAW" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-TODD" "" "");;STUART'S commands ) ((= Usrname "TODD") (command "-LA" "" "OFF" "" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "THAW" "XTB|PE-GENE" "" "XTB|PE-JASON" "" "XTB|PE-LYNN" "" "XTB|PE-PAUL" "" "XTB|PE-STUART" "" "");;TODD'S commands ) ) ) It won't even run it, it will load it but not when I type seal it errors. Thanks in advance for any help in the future. Quote
LCE Posted May 27, 2008 Posted May 27, 2008 Just a very quick glance, and I may be wrong but am not going to check right now, do you have enough ) and in the right place to close the ( ?? Quote
wizman Posted May 27, 2008 Posted May 27, 2008 from LCE's reply, just add the red parenthesis in your lisp file (initget "Gene Jason Lynn Paul Stuart Todd") (setq UsrName (getkword "\nEnter name [G]ene,[J]ason,[L]ynn,[P]aul,tuart,[T]odd: ")) Quote
neekcotrack Posted May 27, 2008 Author Posted May 27, 2008 ok that works now when I select a name it runs the command for them is saying -La unknown command does anyone know why? Quote
LCE Posted May 27, 2008 Posted May 27, 2008 Sorry, I can not help you with this as I am not a big fan of lisp and won't spend the time looking at it now. However, if you are not particularly fussed about having it in lisp, I can do it in VBA or VB.NET for you. Let me know if you want that, if not, I am sure someone else will be along soon who does like lisp. Cheers EDIT: See, there you go, someone even beat me to it. Quote
neekcotrack Posted May 27, 2008 Author Posted May 27, 2008 now it does not except the on in layers Quote
wizman Posted May 27, 2008 Posted May 27, 2008 try this format: (defun c:seal () (initget "Gene Jason Lynn Paul Stuart Todd") (setq UsrName (getkword "\nEnter name [G]ene,[J]ason,[L]ynn,[P]aul,[s]tuart,[T]odd: ")) (command "_.layer" "" "ON" "" "XTB|PE-GENE,XTB|PE-JASON,XTB|PE-LYNN,XTB|PE-PAUL,XTB|PE-STUART,XTB|PE-TODD" "THAW" "XTB|PE-GENE,XTB|PE-JASON,XTB|PE-LYNN,XTB|PE-PAUL,XTB|PE-STUART,XTB|PE-TODD" "");;run this for all users first (cond ((= Usrname "Gene") (command "_.layer" "OFF" "XTB|PE-JASON,XTB|PE-LYNN,XTB|PE-PAUL,XTB|PE-STUART,XTB|PE-TODD" "THAW" "XTB|PE-JASON,XTB|PE-LYNN,XTB|PE-PAUL,XTB|PE-STUART,XTB|PE-TODD" "");;GENE'S commands ) ........... ) ) Quote
neekcotrack Posted May 27, 2008 Author Posted May 27, 2008 Its works is there any way to make it run faster. Quote
Arch_Eric Posted May 27, 2008 Posted May 27, 2008 The problem looks like it is in your COMMAND line. After doing "-la" you have "" which tells Autocad to hit enter/space, which ends the layer command. You also have one after "ON" and between all your layer names, which are unnecessary. Also, you want to call "-layer". When using autocad commands in LISP, you have to call the complete command name as LISP doesn't recognize aliases set up in your ACAD.PGP file. Quote
Arch_Eric Posted May 27, 2008 Posted May 27, 2008 To make it a little faster, you might want to turn CMDECHO off before running all your COMMANDs. Quote
neekcotrack Posted May 27, 2008 Author Posted May 27, 2008 is there a wa to turn mult layers off like maybe a comma in between them instead of "off" "layer" "off" "another layer"? Quote
bowa Posted October 15, 2008 Posted October 15, 2008 You can turn on, off, freeze, thaw multiple layers at a time by using wildcards like "?" or "*" in your layer names. I'd suggest something like: (command "_layer" "T" "XTB*" "OFF" "XTB*" "ON" "XTB|PE_PAUL" "") for Paul's commands. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.