Results 1 to 7 of 7

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

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2013-06
    Posts
    1
    Login to Give a bone
    0

    Default 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. #2
    All AUGI, all the time Richard McDonald's Avatar
    Join Date
    2002-01
    Location
    At right angles to reality
    Posts
    537
    Login to Give a bone
    0

    Default 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. #3
    Mod / Salary / SM Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    5,342
    Login to Give a bone
    0

    Default 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
    Melanie Stone
    @MistresDorkness

    ARCHIBUS, FMS/FMInteract and AutoCAD Expert (I use Revit and Tririga, too)
    Technical Editor
    not all those who wander are lost

  4. #4
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    922
    Login to Give a bone
    0

    Default 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. #5
    AUGI Addict alanjt's Avatar
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

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

    Is the POLYGON command not good enough?
    Civil 3D 2017 ~ Windohz 7
    Dropbox

  6. #6
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,744
    Login to Give a bone
    0

    Default 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.
    Attached Files Attached Files
    C:> ED WORKING....

  7. #7
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,536
    Login to Give a bone
    0

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

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

    Quote Originally Posted by Tharwat View Post
    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)
    )
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

Similar Threads

  1. Wishlist - Got an idea for a new function for LISP?
    By peter in forum Bridging the Gap: LISP -> .NET -> LISP
    Replies: 6
    Last Post: 2014-01-30, 02:39 PM
  2. file creation lisp idea
    By LSElite in forum AutoLISP
    Replies: 7
    Last Post: 2013-01-17, 11:20 PM
  3. Idea for Lisp Routine
    By robert.1.hall72202 in forum AutoLISP
    Replies: 2
    Last Post: 2005-05-04, 03:00 PM
  4. Good idea for lisp routine
    By robert.1.hall72202 in forum AutoLISP
    Replies: 4
    Last Post: 2005-02-14, 03:20 PM
  5. Making a directory from LISP?
    By tyshofner in forum AutoLISP
    Replies: 2
    Last Post: 2005-02-04, 05:36 AM

Posting Permissions

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