
! script name: draftedit.d/chdimpoints
! topic: edit dimension points

!A
!A NAME:
!A
!A 	Edit Dimension Points
!A
!A DESCRIPTION:
!A
!A	This script allows dimensions to be edited.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ITEM TO BE CHANGED : Pick one of the dimension lines
!B 		near the point that is to be modified.
!B
!B 	INPUT NEW ABS X,Y: Enter the X,Y coordinates of the new point
!B 		location.  NOTE: See XYZ INPUT OPTIONS.
!B
!# see also - points.d/xyzinput.hlp

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

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

Start:!
No_calc=0
Turn_off=0
Dynamic_position=1

Element_loop:!
ActivateUndo
stat= SetInputFormat("n4","")

E1=PickEntity("PICK ITEM TO BE CHANGED")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(E1) THEN Element_loop
E2= ParentDimEnt(E1)
IF NOT ValidGeometry(E2) THEN Element_loop
T1=LastPickPara
Pick_point= ParameterPt(E1,T1)

which_end= ComDimSelectPt(E2,Pick_point)
Stat=DeleteEntity(Pick_point)


IF Dynamic_position=1 THEN
	ActivateUndo
	Stat= AdvanceUndoNumber("dim points")
	Stat= AddDimToUndo(WsUBModifyMode,E2)

	IF Which_end= 2 THEN
       		 Stat=EditDraftSetting(E2,WsTextCentered,Turn_off,No_calc)
	END IF
	Stat= DynamicDimEdit(Vnum,E2,Which_end,0,WsTrue,WsFalse)
	IF (ExitScript(Destination$)) THEN Leave
ELSE
	Pt=XyzInput("INPUT NEW",WsXyzInput)
	IF (ExitScript(Destination$)) THEN Leave

	ActivateUndo
	Stat= AdvanceUndoNumber("dim points")
	Stat= AddDimToUndo(WsUBModifyMode,E2)

	IF Which_end= 2 THEN
       		 Stat=EditDraftSetting(E2,WsTextCentered,Turn_off,No_calc)
	END IF
	Stat= ChangeComDimPt(E2,Pt,Which_end,0,WsTrue,WsFalse)
	Stat=SetLastPoint(Pt)
	Stat=DeleteEntity(Pt)
END IF

GOTO Element_loop

Leave:!

Stat=DeleteEntity(Pick_point)
Stat=DeleteEntity(Pt)
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 IF Destination$= "SCRIPTSTART" THEN Start
         IF Destination$= "BACKUP" THEN Start
	 LOAD Destination$
END IF
END
