
! script name: points.d/mvendptsbox
! topic: Sample - move element end points in a box

!A
!A NAME:
!A	
!A	Move Element End Points in a Box
!A
!A DESCRIPTION:
!A
!A 	This script will move element end points in a box.
!A
!B INSTRUCTIONS:
!B
!B 	PICK FIRST CORNER OF PICK ZONE: Pick a corner of the box to be used.
!B
!B 	PICK SECOND CORNER OF PICK ZONE: Pick the other corner of the box.
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: move end points in a box ")

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


DeActivateUndo
Stat= SetInputFormat("n4","")
Pick_loop:!
Stat=SetInputFormat("n4","")
Vnum=PickView("SELECT VIEW FOR SELECTION BOX")
IF (ExitScript(Destination$)) THEN Leave

L1=WorkplaneBox(Vnum)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(L1) THEN Pick_loop

Pt1= ParameterPt(L1,0.0)
Pt2= ParameterPt(L1,1.0)

Dist= DistTwoPts(Pt1,Pt2)
IF Dist< 0.0001 THEN Pick_loop

P1= XyzInput("ORIGIN POINT",WsXyOnly)
IF (ExitScript(Destination$)) THEN Leave

P2= XyzInput("DESTINATION POINT",WsXyOnly)
IF (ExitScript(Destination$)) THEN Leave

Move_vector= VectorTwoPts(P1,P2)
Stat= BoxMoveEntities(pt1,pt2,Move_vector,WsXyOnly)

Stat= DeleteEntity(Pt1)
Stat= DeleteEntity(Pt2)
Stat= DeleteEntity(P1)
Stat= DeleteEntity(P2)
Stat= DeleteEntity(L1)
Stat= DeleteEntity(Move_vector)

GOTO Pick_loop

Leave:!
Stat= DeleteEntity(Pt1)
Stat= DeleteEntity(Pt2)
Stat= DeleteEntity(L1)
Stat= DeleteEntity(Move_vector)
Stat= SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
