
! script name: zplanes.d/zxturningplane
! topic: define workplane for zx turning on a horizontal mill.

!A
!A NAME:
!A
!A 	Workplane: ZX Turning Plane
!A
!A DESCRIPTION:
!A
!A 	This script defines a workplane for ZX turning on a horiz mill.
!A
!B INSTRUCTIONS:
!B
!B 	CENTER POINT ABS X,Y,Z: Enter the X,Y,Z
!B 		coordinates for the center point.
!B 		NOTE: See XYZ INPUT OPTIONS.
!B
!B
!C NOTES:
!C
!C	This script is to be used for a horizontal milling machine equiped 
!C	with a special turning head to setup a workplane for turning 
!C	applications. 
!C
!C	The center point will determine the zero point for the turning
!C	cycles.
!C
!C	To use a turning head on a milling machine in turbo post requires
!C	that the turning tool paths be created in a special workplane.
!C	This script provides that workplane.
!C
!C
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: workplane: zx turning ")

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

Start:!
Stat=SetEqualsValue(Angle)
Stat=SetInputFormat("n4=","")

Angle= GetValue("FACE ANGLE  0, 90, 180, 270, ",Answer$)
IF (ExitScript(Destination$)) THEN Leave

StdWorkplane
stat= SetInputFormat("n4","")
P1=XyzInput("CENTER POINT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave


Dx= SIN(Angle)
Dz= COS(Angle)
P2= PtIncrXyz(P1,Dx,0.0,Dz)
P3= PtIncrXyz(P1,Dz,0.0,-Dx)
T1=ThreePtTrans(P1,P2,P3)

Stat=SetWorkplane(T1)
IF IsRulerOn THEN PlotAll

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

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