Time for some math!
The following program will prompt the user for 3 points and it will draw the intersection line between the plane passing through those points and a horizontal plane. Just draw a perpendicular line from any point contained in the plane to the line returned by the program.
I wrote the program without error trap so please enter 3 different, non collinear points.
As about the second question: try the ALIGN commandCode:;| Intersection between a user defined plane and a horisontal one the 20th of sept 2007 mfuccaro@hotmail.com |; (defun c:intpl( / q1 q2 q3 l z0 a b c d) ;INTersection of PLanes (defun d3(l) (- (+ (* (nth 0 l) (nth 4 l) (nth 8 l)) (* (nth 2 l) (nth 3 l) (nth 7 l)) (* (nth 1 l) (nth 5 l) (nth 6 l))) (+ (* (nth 2 l) (nth 4 l) (nth 6 l)) (* (nth 0 l) (nth 5 l) (nth 7 l)) (* (nth 1 l) (nth 3 l) (nth 8 l)))) ) (setq l (list (setq q1 (getpoint "first point")) (setq q2 (getpoint "2nd")) (setq q3 (getpoint "3rd"))) z0 (apply 'min (mapcar 'caddr l)) a (d3 (append '(1) (cdr q1) '(1) (cdr q2) '(1) (cdr q3))) b (d3 (list (car q1) '1 (last q1) (car q2) '1 (last q2) (car q3) '1 (last q3))) c (d3 (list (car q1) (cadr q1) '1 (car q2) (cadr q2) '1 (car q3) (cadr q3) '1)) d (- (d3 (append q1 q2 q3)))) (if (zerop b) (entmake (list '(0 . "LINE") (list 10 (car q1) (cadr q1) z0) (list 11 (car q2) (cadr q2) z0))) (entmake (list '(0 . "LINE") (list 10 (apply 'min (mapcar 'car l)) (- (/ (+ (* a (apply 'min (mapcar 'car l))) (* c z0) d) b)) z0) (list 11 (apply 'max (mapcar 'car l)) (- (/ (+ (* a (apply 'max (mapcar 'car l))) (* c z0) d) b)) z0))) ) )




Reply With Quote
It's nice to be nice, but sometimes is nicer to be evil!

Bookmarks