CadToolChest FREE

for AutoCAD    

 

 

<Back





Download:

T%Inters-
Line-
Plane




Requires:

T%Are-
Points-
Collinear


T%Polar3D

T%INTERS-LINE-PLANE.LSP
Version: 2006-10-31
AutoCAD 2002 through 2007




Inters-Line-Plane-1.gif

Description Inters-Line-Plane is an AutoLips program with a command named ILP, by CadToolChest, which functions within AutoCAD 2002, and later (possibly earlier).  It calculates the Intersection Point between a line and a plane (the red dot in the graphic above). 

A sub-function of the ILP command can be called by your AutoLisp programs (syntax shown below). It will return a 3D coordinte (a list of 3 reals) for use by your program (for example, (0.03125 0.15625 -6.01408e-019))

This program requires additional CadToolChest files which must be downloaded separately (see left margin).





Command Prompts:

The following are the prompts issued by the ILP command:


Draw a sphere at the intersection/Quit/No:

Enter color for shortest line/Bylayer/:

Select the line to intersect with a plane/:

Select 1st point defining the plane/:

Select 2nd point defining the plane/:

Select 3rd point defining the plane/:


And the following is an example of the output to the text screen:

The intersection point (!PT-10) is 0.03125000,0.15625000,0.00000000.

The name shown enclosed in parenthesis is a Global AutoLisp Variables which contains the coordinate for your use.  The variable is accessible on the AutoCAD command line or by other AutoLisp prgrams.  When used at th AutoCAD command line, it must be prefixed with an exclamation mark (for example !PT-10).  In this way, it can be passed as an argument to other AutoCAD commands or simply listed on the text screen for reference purposes.



Calling the Inters-Line-Plane-1 Sub-Function from other AutoLisp Programs:

Inters-Line-Plane contains a sub-function that can be called by other AutoLISP programs, bypassing the input prompts and looping behavior of the ILP command.  Instead of passing this function a line entity, two coordinates that define a vector are used.  The sub-function returns the coordinate at the intersection, for example:

      (0.03125000 0.15625000 0.00000000)

If the vector does not intersect the plane, NIL is returned.



Syntax of the callable sub-functon:



(T%Inters-Line-Plane-1 PT1 PT2 PT3 PT4 PT5 EXTEND MESSAGES DRAW LYR1 LYR2 COLOR)

Where:

PT1=One 3D end point of the line.

PT2=The other 3D end point of the line.

PT3=1st 3D point defining the plane.

PT4=2nd 3D point defining the plane.

PT5=3rd 3D point defining the plane.

EXTEND=If True, consider the line infinite in length.  If Nil, the line must contact or penetrate the plane if an intersection is to occur.

MESSAGES=If true, display messages.  Othrwise, do not display them.

DRAW=If true, draw a sphere at the intersection of the line and the plane.  The sphere diameter will be the current text height, or 0.03125 if text height is set to 0.0.

LYR1=The name of the layer to use as the base layer when DRAW1 is true and LYR2 begins with an asterisk (*).  Optionally, supply the entity name of the object from which to obtain the base layer name.  If nil and LYR2 begins with an asterisk, the current layer will be used for the base layer.

      Note: The Draw1 option must be True, or this option is ignored.

LYR2=The layer on which to create the objects.  If a string whose first character is an asterisk (*), place the objects on the layer specified by LYR1, but with a suffix of LYR2 (without the asterisk).  If any other string, place the objects on that layer.  If the layer does not exist, make it. If nil or a null string, place the sphere on the same layer as LYR1.

      Note: The Draw1 option must be True, or this option is ignored.

COLOR=The color to assign to the new object.  It can be BYLAYER, or a color number (in either string or integer format).  If nil, the color will be the current AutoCAD color setting.

      Note: The Draw1 option must be True, or this option is ignored.



Example:

(T%Inters-Line-Plane-1 PT1 PT2 PT3 PT4 PT5 Extend Messages DRAW LYR1 LYR2 COLOR)

(Inters-Line-Plane-1 (getpoint) (getpoint) (getpoint) (getpoint) (getpoint) T NIL T "IP" "*-1" "R")

This returns the coordinate at the intersection of the line, PT1 and PT2, projected on to the plane PT3, PT4, PT5 (for example, (0.03125 0.15625 0.0)).  A sphere is constructed at the intersection on a layer whose name begins with IP and suffixed with "-1".  Its color will be red.  See the illustration below.

Inters-Line-Plane-2.gif






<Back

This program is distributed, by CadToolChest, as Freeware without guarantee or warranty of any type.  You may freely use, modify and/or distribute this program for personal or commercial use, but you may not sell or charge for it or any portion of it.  If bundled with a product that is sold, you must make this program available for free.  As customary, acknowledge the original author's contribution if you build upon or distribute this work.

The author of CadToolChest retains all copyrights other than described above.



  C O N T A C T       C A D T O O L C H E S T  
Feedback Form
 (e-Mail address not required)
ani-email-at.gif

Visitors since 2006/10/06

Free Hit Counter
USA-ani-Flag.gif

   USA

Visitors Web Counter