
! script name: zplanes.d/lineverttrans
! topic: define workplane normal to line

!A
!A NAME:
!A
!A 	Workplane: Pt: Normal Line
!A
!A DESCRIPTION:
!A
!A 	This script allows a workplane to be made normal to a line.
!A
!B INSTRUCTIONS:
!B
!B 	WORKPLANE ZERO ABS X,Y,Z: Enter the X,Y,Z coordinates of the point to
!B 		be used as the reference point for making the new workplane.
!B 		NOTE: See XYZ INPUT OPTIONS.
!B
!B 	PICK LINE NORMAL TO WORKPLANE: Pick the line that will be perpendicular
!B 		to the new workplane.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: workplane: pt: normal line ")

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

StdWorkplane
stat= SetInputFormat("n4","")

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

L1=PickSpecificEnt("PICK LINE NORMAL TO WORKPLANE",WsPickLines)
IF (ExitScript(Destination$)) THEN Leave

T1=LineToVertTrans(L1,Pt)

Stat=SetWorkplane(T1)
IF IsRulerOn THEN PlotAll

WplaneEnt= FindNamedVar("current work area",123456)
IF ValidGeometry(WplaneEnt) THEN Stat= DeleteEntity(WplaneEnt)

Leave:!

Stat=DeleteEntity(Pt)

IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END

