
! script name: vzplanes.d/yzplane
! var_topic: define YZ workplane

!A
!A NAME:
!A
!A 	YZ Plane	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script allows a workplane to be defined for the YZ plane.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ORIGIN POINT: Pick the point that will be used for the
!B 		reference point of the YZ plane being defined.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: yz plane ")

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


Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave


DeActivateUndo
StdWorkplane
Stat=SetInputFormat("n4","")

Center_point: E1=PickEntity("PICK ORIGIN POINT")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidDependency(E1) THEN Center_point
T= LastPickPara
Pick_return= CurrPickReturn
Stat= EntityNameCheck(E1,Center$)

Stat= GenerateVarName(WsTransformEnt,Name$)
RecordFunctionOn
Stat= RecordDescr("WORKPLANE: YZ Workplane")
Stat=SetWorkplane
SELECT Pick_return
CASE WsGeometryEnd
        Pc= ParameterReturnPt(Center$,T,WsGeometryEnd)
CASE WsGeometryMid
        Pc= ParameterReturnPt(Center$,T,WsGeometryMid)
CASE WsGeomCenter
        Pc= ParameterReturnPt(Center$,T,WsGeomCenter)
END SELECT
Trans1=AngleTransform(Pc,90,-90,0)
Stat=SetWorkplane(Trans1)
Stat= NameEntity(Trans1,Name$)
Stat=DeleteEntity(Pc)
RecordFunctionOff
CloseVarRecord

Stat= PlotEntity(Center$)
IF IsRulerOn THEN PlotAll

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

