# Thread: Need help making a triangle lisp and have no idea.

1. Login to Give a bone

## Need help making a triangle lisp and have no idea.

I need to write an AutoLISP program which asks user to select a point and then draws an equilateral
triangle by the length 3 from that point. Any ideas?

2. Login to Give a bone

## Re: Need help making a triangle lisp and have no idea.

I am probably missing something but you could use the poly command and set the number of sides to 3.

Probably worth asking a mod to move this to the lisp area for better answers.

Regards

3. Login to Give a bone

## Re: Need help making a triangle lisp and have no idea.

I've moved this post to the lisp forum, thanks.

I'd also suggest checking out some of the available LISP tutorials in the Autodesk University Course archives... http://forums.augi.com/forumdisplay....nd-Programming

4. Login to Give a bone

## Re: Need help making a triangle lisp and have no idea.

Simple code ..

Code:
```(defun c:Test (/ p1 p2 p3)
(if (setq p1 (getpoint "\n Specify the base point :"))
(progn
(setq p2 (polar p1 0. 3.)
p3 (polar p2 (* (/ pi 3.) 2.) 3.)
)
(command "_.pline" "_non" p1 "_non" p2 "_non" p3 "c")
)
)
(princ)
)```

5. Login to Give a bone

## Re: Need help making a triangle lisp and have no idea.

Is the POLYGON command not good enough?

6. Login to Give a bone

## Re: Need help making a triangle lisp and have no idea.

In addition to the comments from others, I had this old lisp laying around. It does a little more than what you're asking.

7. Login to Give a bone

## Re: Need help making a triangle lisp and have no idea.

Originally Posted by Statler
I am probably missing something but you could use the [polygon] command and set the number of sides to 3.
Originally Posted by alanjt
Is the POLYGON command not good enough?
This.

Originally Posted by Tharwat
Simple code ..

Code:
```(defun c:Test (/ p1 p2 p3)
(if (setq p1 (getpoint "\n Specify the base point :"))
(progn
(setq p2 (polar p1 0. 3.)
p3 (polar p2 (* (/ pi 3.) 2.) 3.)
)
(command "_.pline" "_non" p1 "_non" p2 "_non" p3 "c")
)
)
(princ)
)```
... Simpler code :
Code:
```(defun c:FOO ()
(command "._polygon" "3" "edge" pause pause)
(princ)
)```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•