
! script name: lines.d/spaceperp
! topic: construct line perpendicular through point in 3D space

!A
!A NAME:
!A
!A 	3D Perpendicular
!A
!A DESCRIPTION:
!A
!A 	This script will construct a line perpendicular to another line
!A 	through a specified point in 3D space.
!A
!B INSTRUCTIONS:
!B
!B 	PICK PERPENDICULAR LINE: Pick the line that will be used to
!B 		construct a line perpendicular to it in 3D space.
!B
!B 	INPUT ABS X,Y,Z: Enter the X,Y,Z coordinates of the point in
!B 		3D space, through which the line will be constructed
!B 		perpendicular to the specified line.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: 3d perpendicular ")

DIM Destination$[256]
DIM Answer$[256]

DEG

ActivateUndo
Line_loop:!
stat= SetInputFormat("n4","")
E1=PickSpecificEnt("PICK PERPENDICULAR LINE",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave

Pt=XyzInput("INPUT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

L1=SpacePerp(E1,Pt,WsTRIMMED)

Stat=DeleteEntity(Pt)
ActivateUndo
Stat= AdvanceUndoNumber("line")
Stat= AddItemToUndo(WsUBCreateMode,L1)
GOTO Line_loop

Leave:!
Stat=DeleteEntity(Pt)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
