
! script name: vdraftedit.d/dimscale
! var_topic: scale dimension output

!A
!A NAME:
!A
!A 	Scale dimension output.   VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script scales the dimension output.
!A
!B INSTRUCTIONS:
!B
!B 	PICK DIMENSION TO BE CHANGED: Pick one of the dimension lines.
!B
!B 	DIMENSION SCALE: Enter the new dimension scale.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: dimension scale ")

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

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

ActivateUndo
Nocalc=0
Calculate=1

Dim_scale= GetDefault(WsDimensionScale)

Dim_scale:stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Dim_scale)
Dim_scale= GetValue("DIMENSION SCALE ")
IF (ExitScript(Destination$)) THEN Leave
No_scale_var= LastVariableInput(Scale_var$)

Element_loop:!
stat= SetInputFormat("a1",",N,A,")
Element_loop:E1=PickEntity("PICK DIMENSION TO BE CHANGED, New scale , All ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "N"
        GOTO Dim_scale
CASE "A"
	DeActivateUndo
	RecordFunctionOn
        Stat= RecordDescr("DIMENSION: Scale")
        IF No_scale_var THEN
                 V1= FreeParameter("Scale",Dim_scale)
        ELSE
                 V1= FreeParameter("Scale",Scale_var$)
        END IF
        Stat=EditDraftSetting(0,WsDimensionScale,V1,Calculate)
        RecordFunctionOff
        CloseVarRecord
        GOTO Dim_scale
END SELECT
IF NOT ValidGeometry(E1) THEN Element_loop
E2= ParentDimEnt(E1)
IF NOT ValidDependency(E2) THEN Element_loop
Stat= EntityNameCheck(E2,Element$)

ActivateUndo
Stat= AdvanceUndoNumber("dim scale")
Stat= AddDimToUndo(WsUBModifyMode,Element$)

RecordFunctionOn
Stat= RecordDescr("DIMENSION: Scale")
IF No_scale_var THEN
        V1= FreeParameter("Scale",Dim_scale)
ELSE
        V1= FreeParameter("Scale",Scale_var$)
END IF
Stat=EditDraftSetting(Element$,WsDimensionScale,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
