
! script name: vdraftedit.d/chdimpoints
! var_topic: edit dimension points

!A
!A NAME:
!A
!A 	Points		VARIATIONAL
!A
!A DESCRIPTION:
!A
!A 	This script allows dimension points 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]
DIM Element$[256]
DIM Point$[256]

Var_object= CheckVarObject
IF (ExitScript(Destination$)) THEN Leave
DEG

ActivateUndo
No_calc=0
Turn_off=0

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

Element_loop:E1=PickEntity("PICK ITEM TO BE CHANGED")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(E1) THEN Element_loop
E2= ParentDimEnt(E1)
IF NOT ValidDependency(E2) THEN Element_loop
Stat= EntityNameCheck(E2,Element$)
T1=LastPickPara
Pick_point= ParameterPt(E1,T1)
which_end= ComDimSelectPt(E2,Pick_point)
Stat= DeleteEntity(Pick_point)


Pick_point:Pt=PickEntity("NEW POINT")
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidDependency(Pt) THEN Pick_point
Stat= EntityNameCheck(Pt,Point$)
Pick_para= LastPickPara
Pick_return= CurrPickReturn

ActivateUndo
Stat= AdvanceUndoNumber("ch dim point")
Stat= AddDimToUndo(WsUBModifyMode,Element$)

RecordFunctionOn
Stat= RecordDescr("DIMENSION: Change point")
SELECT Pick_return
CASE WsGeometryEnd
        Pt= ParameterReturnPt(Point$,Pick_para,WsGeometryEnd)
CASE WsGeometryMid
        Pt= ParameterReturnPt(Point$,Pick_para,WsGeometryMid)
CASE WsGeomCenter
        Pt= ParameterReturnPt(Point$,Pick_para,WsGeomCenter)
END SELECT
IF Which_end= 2 THEN
        Stat=EditDraftSetting(Element$,WsTextCentered,Turn_off,No_calc)
END IF
Stat= ChangeComDimPt(Element$,Pt,Which_end)
Stat= DeleteEntity(Pt)
RecordFunctionOff
Curr_record= CurrentVarRecord
CloseVarRecord

Stat= AddItemToUndo(WsUBCreateMode,Curr_record)
GOTO Element_loop

Leave:!
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
