
! script name: draftedit.d/centertext
! topic: center text in a dimension

!A
!A NAME:
!A
!A 	Center Text in a dimension.
!A
!A DESCRIPTION:
!A
!A	This script centers text in a dimension.
!A
!B INSTRUCTIONS:
!B
!B 	PICK DIMENSION : Pick the dimension.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: center text ")

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

ActivateUndo
Nocalc=0
Calculate=1
Toggle_sw= 2
Turn_on=1


Element_loop:!
stat= SetInputFormat("n4","")
E1=PickEntity("PICK DIMENSION ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(E1) THEN Element_loop
E2= ParentDimEnt(E1)
IF NOT ValidGeometry(E2) THEN Element_loop

ActivateUndo
Stat= AdvanceUndoNumber("center text")
Stat= AddDimToUndo(WsUBModifyMode,E2)

Stat=EditDraftSetting(E2,WsTextCentered,Turn_on,Calculate)

GOTO Element_loop

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