
! script name: draftedit.d/dimtextsize
! topic: edit text size in a dimension

!A
!A NAME:
!A
!A 	EDIT DIMENSION TEXT SIZE
!A
!A DESCRIPTION:
!A
!A 	This script changes the text size in a dimension.
!A
!B INSTRUCTIONS:
!B
!B 	PICK DIMENSION TO BE CHANGED : Pick one of the dimension lines.
!B
!B 	TEXT HEIGHT: Input the new text height.
!B
!B 	TEXT WIDTH: Input the new text width.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: edit text size ")

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

ActivateUndo
Nocalc=0
Calculate=1

Text_height= GetDefault(WsTextHeight)
Text_width= GetDefault(WsTextWidth)

Text_size:stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Text_height)
Text_height= GetValue("INPUT TEXT HEIGHT ",Answer$)
IF (ExitScript(Destination$)) THEN Leave

stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Text_width)
Text_width= GetValue("INPUT TEXT WIDTH ",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Element_loop:!
stat= SetInputFormat("a1",",N,A,")
Element_loop:E1=PickEntity("PICK DIMENSION TO BE CHANGED, New size , All ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "N"
	GOTO Text_size
CASE "A"
	DeActivateUndo
	Stat=EditDraftSetting(0,WsTextHeight,Text_height,Nocalc)
	Stat=EditDraftSetting(0,WsTextWidth,Text_width,Nocalc)
	Stat=EditDraftSetting(0,WsArrowHeight,Text_height,Nocalc)
	Stat=EditDraftSetting(0,WsArrowWidth,Text_width,Calculate)
	GOTO Text_size
END SELECT

IF NOT ValidGeometry(E1) THEN Element_loop
E2= ParentDimEnt(E1)
IF NOT ValidGeometry(E2) THEN
	IF EntityType(E1)<> WsTextEnt THEN Element_loop

	ActivateUndo
	Stat= AdvanceUndoNumber("text size")
	Stat= AddDimToUndo(WsUBModifyMode,E1)

	Stat= ChangeTextSize(E1,Text_width,Text_height)
ELSE
	ActivateUndo
	Stat= AdvanceUndoNumber("text size")
	Stat= AddDimToUndo(WsUBModifyMode,E2)

	Stat=EditDraftSetting(E2,WsTextHeight,Text_height,Nocalc)
	Stat=EditDraftSetting(E2,WsTextWidth,Text_width,Nocalc)
	Stat=EditDraftSetting(E2,WsArrowHeight,Text_height,Nocalc)
	Stat=EditDraftSetting(E2,WsArrowWidth,Text_width,Calculate)
END IF

GOTO Element_loop

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