
! script name: draftedit.d/dimtextsizeinbox
! 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

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("n4","")
Group=CreateGroup("TEMP")

Stat= PickBox(Group,Vnum,WsPickPen)
IF (ExitScript(Destination$)) THEN Leave

DeActivateUndo

G1=CreateGroup("TEMP2")
FOR I=1 TO GroupCount(Group)
   E1= GroupElement(Group,I)
   IF ValidGeometry(E1) THEN 
      E2= ParentDimEnt(E1)
      IF NOT ValidGeometry(E2) THEN
	IF EntityType(E1)= WsTextEnt THEN
		Stat= AppendToGroup(G1,E2)
	END IF
      ELSE
		Stat= AppendToGroup(G1,E2)
      END IF
   END IF
NEXT I
Stat=DeleteEntity(Group)

FOR I=1 TO GroupCount(G1)
   E1= GroupElement(G1,I)
   IF NOT ValidGeometry(E1) THEN
	IF EntityType(E1)= WsTextEnt THEN
	     Stat= ChangeTextSize(E1,Text_width,Text_height)
	END IF
   ELSE
	Stat=EditDraftSetting(E1.,WsTextHeight,Text_height,Nocalc)
	Stat=EditDraftSetting(E1,WsTextWidth,Text_width,Nocalc)
	Stat=EditDraftSetting(E1,WsArrowHeight,Text_height,Nocalc)
	Stat=EditDraftSetting(E1,WsArrowWidth,Text_width,Calculate)
   END IF
NEXT I
Stat=DeleteEntity(G1)
GOTO Element_loop
PlotAll

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