
! script name: vzplanes.d/faceworkplane
! var_topic: define workplane for a face on a mill turn part.

!A
!A NAME:
!A
!A 	Workplane: Face Workplane   VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script defines a workplane for a face on a mill turn part.
!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
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: workplane: face ")

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

Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave
DeActivateUndo
StdWorkplane
stat= SetInputFormat("n4","")

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

Center_point: E1=PickEntity("PICK CENTER POINT")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidDependency(E1) THEN First_point
T1= LastPickPara
Pick_return1= CurrPickReturn
Stat= EntityNameCheck(E1,Point1$)


Stat= GenerateVarName(WsTransformEnt,Name$)
RecordFunctionOn
Stat= RecordDescr("WORKPLANE: Face")
Stat=SetWorkplane
SELECT Pick_return1
CASE WsGeometryEnd
        Pc= ParameterReturnPt(Point1$,T1,WsGeometryEnd)
CASE WsGeometryMid
        Pc= ParameterReturnPt(Point1$,T1,WsGeometryMid)
CASE WsGeomCenter
        Pc= ParameterReturnPt(Point1$,T1,WsGeomCenter)
END SELECT
Trans1=FaceWorkTransform(Pc)
Stat=SetWorkplane(Trans1)
Stat= NameEntity(Trans1,Name$)
Stat= DeleteEntity(Pc)
RecordFunctionOff
CloseVarRecord

IF IsRulerOn THEN PlotAll

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