chelsea1307 Posted June 8, 2009 Posted June 8, 2009 below is my second attempt at lisp, leeMac helped me through the first one completely a few months ago and now i have time again to try. I want the lisp to draw a circle then draw a line from the center of the circle to a selected point. However it doesnt do that, it doesnt do anything, it errors out about too many arguments immediately any help would be great (defun C:practice()(varA varB varC) (setq A(getreal "\n radius of circle: ")) (setq B(getpoint "\n select center of circle: ")) (setq C(getpoint "\n select end of line: ")) (command "_.circle" B A "") (command "_.line" B C "") (princ) ) Quote
Lee Mac Posted June 8, 2009 Posted June 8, 2009 I like that you have taken the time to localise variables, many people miss that, except that you didn't quite localise them properly: (defun C:practice [color=Red][b](/ A B C)[/b][/color] (setq A (getreal "\n radius of circle: ")) (setq B (getpoint "\n select center of circle: ")) (setq C (getpoint "\n select end of line: ")) (command "_.circle" B A "") (command "_.line" B C "") (princ) ) Other than that, good job for a first attempt Quote
chelsea1307 Posted June 8, 2009 Author Posted June 8, 2009 thanks lee knew it had to be something simple, need to fix my notes to take out the extra parenthesis and the var before my variables. Quote
Lee Mac Posted June 8, 2009 Posted June 8, 2009 thanks lee knew it had to be something simple, need to fix my notes to take out the extra parenthesis and the var before my variables. Check out the help file on "defun" in the Visual LISP Editor. Quote
chelsea1307 Posted June 8, 2009 Author Posted June 8, 2009 will do, vlide just crashed and took my whole computer with it, hopefully this time it wont and i can get to the help file Quote
chelsea1307 Posted June 8, 2009 Author Posted June 8, 2009 very cool i didnt know there was its own help section! Quote
Lee Mac Posted June 8, 2009 Posted June 8, 2009 very cool i didnt know there was its own help section! I think that you could learn pretty much all of LISP and most of Visual LISP just from reading that Help File... loads of example code, and tons of information... happy reading Quote
chelsea1307 Posted June 8, 2009 Author Posted June 8, 2009 whats the differnec between visual LISP and LISP? Quote
Lee Mac Posted June 9, 2009 Posted June 9, 2009 Visual LISP was introduced in 1999 in ACAD 2000, and provides more versatility with the programming, it includes all the VL functions, for example: vlax-get-acad-object, vlax-curve-getClosestPointto etc etc Quote
MSasu Posted June 9, 2009 Posted June 9, 2009 @chelsea1307: Your routine doesn’t add the circle since you added an extra at the end of command call – just remove the "" from: (command "_.circle" B A [color=red]""[/color]) Quote
dbroada Posted June 9, 2009 Posted June 9, 2009 Visual LISP was introduced in 1999 in ACAD 2000, and provides more versatility with the programming, it includes all the VL functions, for example: vlax-get-acad-object, vlax-curve-getClosestPointto etc etcpedantic, me? I'm not going to disagree about its introduction to R2000 but I am sure I had it before then, especially as I don't think we used that particular release. VLISP was available as a download or purchase before it became included. Just for interest, I'll see what I have at work tomorrow. Quote
MSasu Posted June 9, 2009 Posted June 9, 2009 @dbroada: You are right. Hope to remember correctly, prior to AutoCAD 2000 there was a stand-alone tool named Vital LISP – eventually it was purchased by Autodesk and incorporated into AutoCAD. Quote
Lee Mac Posted June 9, 2009 Posted June 9, 2009 pedantic, me? I'm not going to disagree about its introduction to R2000 but I am sure I had it before then, especially as I don't think we used that particular release. VLISP was available as a download or purchase before it became included. Just for interest, I'll see what I have at work tomorrow. Correct, it was sold as an add-on to R14 in '97, but first incorporated into ACAD 2000. Good ol' Wiki Quote
Zorg Posted June 9, 2009 Posted June 9, 2009 ha you guys have read the Visual Lisp Bible's histroy section! Helpful post to me aswell, as im still learning LISP Quote
chelsea1307 Posted June 9, 2009 Author Posted June 9, 2009 @chelsea1307:Your routine doesn’t add the circle since you added an extra at the end of command call – just remove the "" from: (command "_.circle" B A [color=red]""[/color]) it worked just fine for me with that in it. Quote
chelsea1307 Posted June 9, 2009 Author Posted June 9, 2009 thanks for all the info and history i see i have a lot of reading to do. Quote
Lee Mac Posted June 9, 2009 Posted June 9, 2009 it worked just fine for me with that in it. It will work, but you may get this message: Command: PRACTICE Unknown command "PRACTICE". Press F1 for help. Good spot msasu, I missed that 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.