Pixel Graphics, Inc. - Litigation & Court Graphics
LITIGATION GRAPHICS - COMPUTER ANIMATION - TECHNICAL ILLUSTRATION - CAD DRAFTING - AUTOLISP PROGRAMMING
3423 Rivers Edge Trail
Houston, Texas 77339
281.359.1187
Copyright 2008 - Pixel Graphics, Inc. All rights reserved.
AutoLisp Program: Intersection of a Line and a Plane
Overview of the Autolisp Program   LinePlaneInt.lsp

This Autolisp program draws a point at the 3D intersection of a line and a plane. The user first picks the
three points on the plane, then picks two points on the line in AutoCAD. The point is plotted whether or not
the line actually passes inside the perimeter of the defining points.

After loading the program into AutoCAD ( Tools -> Load Application...-> then selecting the file, simply type
LinePlaneInt at the AutoCAD command prompt to run the command.

Below is a screen shot showing the results of a test case.
Jeff Winship - Computer Graphics Consultant                                                                                                                                                      May 3, 2008
HOME  |  3D ANIMATION  |  DIGITAL IMAGES  |  AUTOCAD DRAFTING  |  AUTOLISP PROGRAMMING  |  CONTACT & OTHER INFO  |  F.A.Q.
AutoCAD Screen Shot using LinePlaneInt.lsp
Copyright Info & Downloading the Program

If you copy and use the function, please respect my work and the time I've put into it by keeping my
copyright info with the function, and giving me credit where it's appropriate. A link from your site would be
appreciated as well. If you don't have a website, please help promote my site by passing along a link to my
site to other fellow Autolisp programmer(s) via e-mail. Thanks.

If you have any comments or questions regarding Autolisp program, or even find a bug, feel free to e-mail
me at:
Autolisp Programmer - Jeff Winship
Technical Notes

The Autolisp program for LinePlaneInt.lsp is solved using vector calculus and contains the following
Autolisp functions:

Matrix_Det3
    Calculates and returns the determinate of a 3 x 3 matrix
Matrix_Inverse3
    Calculates and returns the matrix inverse of a 3 x 3 matrix
Line_Plane_Int
    Calculates and returns the intersection point of the line and the plane. It also returns a T value if the intersection
    point lies within the boundaries of the plane, nil otherwise.

There is one known bug in this program: it will return a "divide by zero" error if the line and plane are parallel.
Since they don't intersect, this isn't so much of a bug as it is an error handling issue.


*Revised 3-13-2009: Fixed a bug where the "POINT" command would not execute properly in non-English
versions of AutoCAD. Thanks for the fix Lukas.