View Full Version : Need help making a triangle lisp and have no idea.
lukasz.sosnowski391019
2013-06-16, 07:10 PM
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?
Richard McDonald
2013-06-17, 09:19 AM
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
Wanderer
2013-06-17, 03:35 PM
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.php?1375-Customization-and-Programming
Tharwat
2013-06-17, 05:03 PM
Simple 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)
)
alanjt
2013-06-17, 05:41 PM
Is the POLYGON command not good enough?
Ed Jobe
2013-06-17, 06:12 PM
In addition to the comments from others, I had this old lisp laying around. It does a little more than what you're asking.
BlackBox
2013-06-17, 08:30 PM
I am probably missing something but you could use the [polygon] command and set the number of sides to 3.
Is the POLYGON command not good enough?
This.
Simple 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 ;):
(defun c:FOO ()
(command "._polygon" "3" "edge" pause pause)
(princ)
)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.