
! script name: zplanes.d/parallelpt
! topic: define workplane parallel to existing workplane through point

!A
!A NAME:
!A
!A 	Parallel Workplane Through a Point
!A
!A DESCRIPTION:
!A
!A 	This script allows a workplane to be made parallel to an existing
!A 	workplane through a defined point.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY FOR EXISTING WORKPLANE: Pick an entity on the existing
!B 		workplane.
!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
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: parallel workplane through a point ")

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

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

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

Stat=SetWorkplane(E1)
Work1= CurrentWorkplane
T1= ParallelPointTrans(Work1,Pt)
Stat=SetWorkplane(T1)

stat= DeleteEntity(Pt)
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
