Jump to content

Help draw rectangle from 3 points


tuantrinhdp

Recommended Posts

I've ended up drawing a rhomboid, not sure if thats desired but sharing the code anyways - 

; Draws rhomboid by specifying 3 points
(defun C:test ( / p1 p2 p3 p4 )
  (and 
    (setq p1 (getpoint "\nSpecify first point: "))
    (setq p2 (getpoint "\nSpecify second point: " p1))
    (progn (grdraw p1 p2 1) t)
    (setq p3 (getpoint "\nSpecify third point: " p2))
    (progn (grdraw p2 p3 1) t)
    (setq p4 
      (inters 
        p1 (mapcar '+ p1 (mapcar '- p2 p3))
        p3 (mapcar '+ p3 (mapcar '- p2 p1))
        nil
      )
    ); setq p4
    (entmakex 
      (append
        '((0 . "LWPOLYLINE")(100 . "AcDbEntity")(100 . "AcDbPolyline")(90 . 4)(70 . 1))
        (mapcar (function (lambda (p) (cons 10 p))) (list p1 p2 p3 p4))
      )
    )
  )
  (redraw) (princ)
); defun 

 

  • Like 1
Link to comment
Share on other sites

11 hours ago, eldon said:

I see there are at least two solutions to your example. Which one do you want?

 

It might be more simple to draw the rectangle yourself.

 

 

two solutions.PNG

Any solution is fine ^^ 
I've found lisp Lee-Mac. Thank you ^^

 

Edited by tuantrinhdp
Link to comment
Share on other sites

12 hours ago, eldon said:

Perhaps you can help yourself by searching.

 

Hint - look at Lee Mac's web site.

Wow, thank for your help. I will use lisp Lee-Mac. 

Link to comment
Share on other sites

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