Macro to Draw a Line Perpendicular to a Plane

  • This macro draws a line of defined length from a plane defined by 3 points.


     written by prl
'Program: plfp.d3m (perpendicular line from plane)

Dim X(3), Y(3), Z(3)

user:
SetPoint "Set 3 points to define the plane: " 3
If Sys(1) < 3 Then goto user

For i = 1 To 3
PointVal X(i) Y(i) Z(i) i
Next i
Sys(1) = 0


precision 15
input "enter magnitude (length) of the line: ", rz$
r=val(rz$)

if r = 0 then
message "error: no line length input provided."
end
end if

sys(80)=0

'draw a line at 0,0,0 of specified length
>line
{
<Pointxyz [0, 0, 0]
<Pointxyz [0, r, 0]
}

'select the line just drawn
getattr sys(9), type, select
putattr sys(9), type, 1

>SetHandle
{
<Pointxyz [0, 0, 0]
<Pointxyz [1, 0, 0]
<Pointxyz [0, 0, 1]
}

>move
{
<Pointxyz [X(1), Y(1), Z(1)]
<Pointxyz [X(2), Y(2), Z(2)]
<Pointxyz [X(3), Y(3), Z(3)]
}

sys(80)=0
sys(1)=0
End

File to Download:

perplinefromplane.zip