Jump to content

Recommended Posts

Posted

Does anyone know of a lisp routne that would draw a closed rectangle from 3points with differing z values?

 

1. First you would have three 3d points with differing z values.

2. You would click on the points in a clockwise order and then a rectangle would be drawn best fit to the 3 points.

3. The 4th point would be squared and elevated to suit.

 

anyone heard of such a routine?

Posted

Hi,

 

Here's a quicky (no error handling)

 

(defun c:rect3d (/ p1 p2 p3)
 (setq p1 (trans (getpoint "\nFirst point: ") 1 0)
       p2 (trans (getpoint p1 "\nSecond point: ") 1 0)
       p3 (trans (getpoint p1 "\nThird point: ") 1 0)
 )
 (command "_.ucs" "3" "_non" p1 "_non" p2 "_non" p3)
 (setq p1 (trans p1 0 1)
       p2 (trans p2 0 1)
       p3 (trans p3 0 1)
       p3 (list (max (car p2) (car p3)) (max (cadr p2) (cadr p3)))
 )
 (command "_.rectangle" "_non" p1 "_non" p3)
 (command "_.ucs" "_previous")
 (princ)
)

  • Like 1
Posted

I don't think that unless the 3 points form a right angle, that a true rectangle can be made with the points defining the corners. A parrallelagram maybe. And what happens if the points are colinear? Maybe I'm not understanding the request properly. -David

Posted
I don't think that unless the 3 points form a right angle, that a true rectangle can be made with the points defining the corners. A parrallelagram maybe. And what happens if the points are colinear? Maybe I'm not understanding the request properly. -David

 

it would place a best fit rectangle based on the 3 points in 3d

Posted
Hi,

 

Here's a quicky (no error handling)

 

(defun c:rect3d (/ p1 p2 p3 p4 nor elv)
 (setq p1 (trans (getpoint "\nFirst point: ") 1 0)
       p2 (trans (getpoint p1 "\nSecond point: ") 1 0)
       p3 (trans (getpoint p1 "\nThird point: ") 1 0)
 )
 (command "_.ucs" "3" "_non" p1 "_non" p2 "_non" p3)
 (setq p1 (trans p1 0 1)
       p2 (trans p2 0 1)
       p3 (trans p3 0 1)
       p4 (list (max (car p2) (car p3)) (max (cadr p2) (cadr p3)))
 )
 (command "_.rectangle" "_non" p1 "_non" p4)
 (command "_.ucs" "_previous")
 (princ)
)

 

 

Thats perfect! :D

  • Like 1
Posted

Then there would be 2 possible solutions:

 

1) ab is perpendicular to bc

2) bc is perpendicular to ab

 

-David

per.jpg

Posted
Then there would be 2 possible solutions:

 

1) ab is perpendicular to bc

2) bc is perpendicular to ab

 

-David

 

solution 1

  • 3 years later...
Posted

This one is perfect. Because often happens that those 3 points are not in 90deg angl, would be nice if could put corrections in rectangle size. Lets say true size is 1.00x0.50 but lisp draws 0.98x0.51 so my idea is to add request regarding if we agree with proposed size or we want put own dimensions?? I hope this make sens, is is something you can help guys??

Posted

It really comes down to the way you want to set the rules use pt1 & pt2 for orientation but some other rule regarding 3rd pt all methods would just use a UCs plane type answer.

 

Stuff like extend/shorten pt pt2 as not true sq to pt3. So without rules a simple lisp can not be produced.

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