
! script name: vdraftedit.d/decimalplaces
! var_topic: edit decimal places in a dimension

!A
!A NAME:
!A
!A 	Modify: Output: Decimal Places	VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script changes the decimal places in a dimension.
!A
!B INSTRUCTIONS:
!B
!B 	PICK DIMENSION TO BE CHANGED: Pick one of
!B 		the dimension lines.
!B
!B 	DECIMAL PLACES AFTER: Enter the new
!B 		number of decimal places after the decimal point.
!B

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

DIM Answer$[256]
DIM Destination$[256]
DIM Element$[256]

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

ActivateUndo
Nocalc=0
Calculate=1

Places= GetDefault(WsPlacesAfter)

Places:stat= SetInputFormat("n0=","")
stat= SetEqualsValue(Places)
Places= GetValue("DECIMAL PLACES AFTER ")
IF (ExitScript(Destination$)) THEN Leave


Element_loop:!
stat= SetInputFormat("a1",",N,")
E1=PickEntity("PICK DIMENSION TO BE CHANGED, New places ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$="N" THEN Places
IF NOT ValidGeometry(E1) THEN Element_loop
E2= ParentDimEnt(E1)
IF NOT ValidDependency(E2) THEN Element_loop
Stat= EntityNameCheck(E2,Element$)

ActivateUndo
Stat= AdvanceUndoNumber("decimal places")
Stat= AddDimToUndo(WsUBModifyMode,Element$)

RecordFunctionOn
Stat= RecordDescr("DIMENSION: Decimal places")
V1= FreeParameter("Places after",Places)
Stat=EditDraftSetting(Element$,WsPlacesAfter,V1,Calculate)
Stat=EditDraftSetting(Element$,WsAPlacesAfter,V1,Calculate)
Stat=EditDraftSetting(Element$,WsRPlacesAfter,V1,Calculate)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
GOTO Element_loop

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