
! script name: zplanes.d/parallelangle
! topic: workplane parallel to an existing workplane rotated at an angle.

!A
!A NAME:
!A
!A 	Parallel Workplane Rotated at an Angle
!A
!A DESCRIPTION:
!A
!A 	This script allows a workplane to be made a parallel distance from
!A 	an existing workplane rotated about an angle..
!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	ROTATION ANGLE: Give the rotation angle.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: parallel workplane with angle ")

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

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

Stat=SetWorkplane(Work)
Work1= CurrentWorkplane
T1=ParallelTransform(Work1,Dist,Angle)
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
