A macro to draw a perpendicular from a plane:

`'Program: pfp.d3m (perpendicular line from plane)`

'The line will be drawn from the first point set

'Reversing the order of the points will reverse the direction of the perpendicular.

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