+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Senior Member
    Using
    not specified
    Join Date
    Jan 2006
    Posts
    211

    Default determining plane slopes

    Registered forum members do not see this ad.

    How can I determine the slope of a plane? Then, how can I set the slope of another plane to match the first one?

  2. #2
    Super Moderator fuccaro's Avatar
    Using
    AutoCAD 2006
    Join Date
    Nov 2002
    Location
    Romania, Marosvasarhely
    Posts
    3,540

    Default

    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.
    Code:
    ;| 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)))
        )
      )
    As about the second question: try the ALIGN command
    It's nice to be nice, but sometimes is nicer to be evil!.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.

  3. #3
    Banned Alan Cullen's Avatar
    Using
    Map 3D 2009
    Join Date
    Jun 2006
    Location
    Cairns, Queensland, Australia
    Posts
    4,181

    Default

    Registered forum members do not see this ad.

    It would also help if you specified your autocad version.

Similar Threads

  1. lines into a plane?
    By CADIDAC in forum AutoCAD Drawing Management & Output
    Replies: 9
    Last Post: 16th Apr 2007, 04:35 am
  2. Determining if I have string characters in text a variable
    By muck in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 7th Feb 2007, 09:55 pm
  3. Determining decimal numbers?
    By muck in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 23rd Jan 2007, 11:51 am
  4. Determining localized version of command
    By Autodesk in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 6th Nov 2006, 07:00 pm
  5. Any-plane Arc!
    By fahim108 in forum Tutorials & Tips'n'Tricks
    Replies: 3
    Last Post: 2nd Aug 2006, 07:24 pm

Bookmarks

Posting Permissions

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