Jump to content

Recommended Posts

Posted

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)
)

Posted

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 :)

Posted

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.

Posted
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.

Posted

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

Posted

very cool i didnt know there was its own help section!

Posted
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 :)

Posted

whats the differnec between visual LISP and LISP?

Posted

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

Posted

@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])

Posted
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
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.

Posted

@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.

Posted
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 :)

Posted

ha you guys have read the Visual Lisp Bible's histroy section! :D

 

Helpful post to me aswell, as im still learning LISP :ouch:

Posted
@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.

Posted

thanks for all the info and history i see i have a lot of reading to do.

Posted
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 :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...