
! script name: vdraft.d/setplaces
! var_topic: set decimal places default

!A
!A NAME:
!A
!A 	Settings: Decimal Places	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script changes the decimal places output.
!A
!B INSTRUCTIONS:
!B 	
!B 	DECIMAL PLACES: Enter the number of
!B 		decimal places to be used.
!B
!B 	RADIUS DECIMAL PLACES: Enter the number
!B 		of decimal places to be used for radii.
!B
!B 	ANGULAR DECIMAL PLACES: Enter the number
!B 		of decimal places to be used for angular output.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: set decimal places ")

DIM Answer$[256]
DIM Destination$[256]
DIM Xyz_var$[256]
DIM Radius_var$[256]
DIM Angle_var$[256]

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

DeActivateUndo
Xyz_places= GetDefault(WsPlacesAfter)
Radius_places= GetDefault(WsRPlacesAfter)
Angle_places= GetDefault(WsAPlacesAfter)

Places_after:stat= SetInputFormat("n0=","")
stat= SetEqualsValue(Xyz_places)
Xyz_places= GetValue("DECIMAL PLACES ",Answer$)
IF ExitScript(Destination$) THEN Leave
No_xyz_var= LastVariableInput(Xyz_var$)

stat= SetEqualsValue(Radius_places)
Radius_places= GetValue("RADIUS DECIMAL PLACES ",Answer$)
IF ExitScript(Destination$) THEN Leave
No_radius_var= LastVariableInput(Radius_var$)

stat= SetEqualsValue(angle_places)
Angle_places= GetValue("ANGULAR DECIMAL PLACES ",Answer$)
IF ExitScript(Destination$) THEN Leave
No_angle_var= LastVariableInput(Angle_var$)


RecordFunctionOn
Stat= RecordDescr("DIM: Set decimal places")
IF No_xyz_var THEN
	V1= FreeParameter("Xyz places",Xyz_places)
ELSE
	V1= FreeParameter("Xyz places",Xyz_var$)
END IF
IF No_radius_var THEN
	V2= FreeParameter("Radius places",Radius_places)
ELSE
	V2= FreeParameter("Radius places",Radius_var$)
END IF
IF No_angle_var THEN
	V3= FreeParameter("Angle places",Angle_places)
ELSE
	V3= FreeParameter("Angle places",Angle_var$)
END IF
Stat=SetDefaults(WsPlacesAfter,V1)
Stat=SetDefaults(WsRPlacesAfter,V2)
Stat=SetDefaults(WsAPlacesAfter,V3)
RecordFunctionOff
CloseVarRecord

Leave:!
stat= SetInputFormat("n4","")
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
