
! script name: draftedit.d/dimgapdist
! topic: edit the gap distance on dimension extension lines

!A
!A NAME:
!A
!A 	Gap Distance
!A
!A DESCRIPTION:
!A
!A 	This script changes the gap distance on a dimension line.
!A
!A~ image location - images/editdimdata.gif
!A
!B INSTRUCTIONS:
!B
!B 	PICK DIMENSION TO BE CHANGED : Pick one of the dimension lines.
!B
!B 	GAP DISTANCE: Input the new gap distance.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: edit dim gap distance ")

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

ActivateUndo
Nocalc=0
Calculate=1

Gap_dist= GetDefault(WsGapDist)

Gap_dist:stat= SetInputFormat("n4=","")
stat= SetEqualsValue(Gap_dist)
Gap_dist= GetValue("DIMENSION GAP DISTANCE ",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Element_loop:!
stat= SetInputFormat("a1",",N,A,")
Element_loop:E1=PickEntity("PICK DIMENSION TO BE CHANGED, New dist , All ",Answer$)
IF (ExitScript(Destination$)) THEN Leave
SELECT Answer$
CASE "N"
	GOTO gap_dist
CASE "A"
	DeActivateUndo
	Stat=EditDraftSetting(0,WsGapDist,Gap_dist,Calculate)
	GOTO Gap_dist
END SELECT

IF NOT ValidGeometry(E1) THEN Element_loop
E2= ParentDimEnt(E1)
IF NOT ValidGeometry(E2) THEN Element_loop


ActivateUndo
Stat= AdvanceUndoNumber("gap dist")
Stat= AddDimToUndo(WsUBModifyMode,E2)

Stat=EditDraftSetting(E2,WsGapDist,Gap_dist,Calculate)

GOTO Element_loop

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