
! script name: zplanes.d/distparatilt
! topic: workplane parallel to an existing workplane tilted and turned.

!A
!A NAME:
!A
!A 	Parallel Workplane with Tilting and Rotating.
!A
!A DESCRIPTION:
!A
!A 	This script allows a workplane to be made a parallel distance from
!A 	an existing workplane with tilting about all three axis possible.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY FOR EXISTING WORKPLANE: Pick an entity on the existing
!B 		workplane.
!B
!B 	PARALLEL DISTANCE: The perpendicular distance between the existing 
!B 		workplane and the workplane that will be made parallel to it.
!B
!B	X TILT ANGLE: Give the tilt angle about the relative x axis.
!B
!B	Y TILT ANGLE: Give the tilt angle about the relative y axis.
!B
!B	Z ROTATION ANGLE: Give the rotation angle about the relative z axis.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: parallel dist workplane with xyz angles ")

DIM Answer$[256]
DIM Destination$[256]
stat= SetInputFormat("n4","")

Work=PickEntity("PICK ENTITY FOR EXISTING WORKPLANE")
IF (ExitScript(Destination$)) THEN Leave

Distr=NamedVarVal("parallel distance",WsSystemVars,.5)

Stat=SetEqualsValue(Distr)
Stat=SetInputFormat("n4=","")

Dist= GetValue("PARALLEL DISTANCE",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Xangle= InputAngle("X TILT ANGLE")
IF (ExitScript(Destination$)) THEN Leave

Yangle= InputAngle("Y TILT ANGLE")
IF (ExitScript(Destination$)) THEN Leave

Zangle= InputAngle("Z ROTATION ANGLE")
IF (ExitScript(Destination$)) THEN Leave

Stat=SetWorkplane(Work)
Work1= CurrentWorkplane
T1=ParallelTransform(Work1,Dist,Xangle,Yangle,Zangle)
Stat=SetWorkplane(T1)
IF IsRulerOn THEN PlotAll


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

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