
! script name: copy.d/2dinccopyent
! topic: 2D copy entity by incremental moves

!A
!A NAME:
!A
!A      2D Incremental Copy Entity
!A
!A DESCRIPTION:
!A
!A 	This script allows a group of entities or a single entity to be
!A 	copied and the option of the original being deleted.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ELEMENT TO BE COPIED: Pick the element to be copied.
!B
!B	X,Y INCREMENT: Enter the value in X,Y to shift entities.
!B
!B 	NUMBER OF TIMES: Enter the number of times the copy process
!B 		should be repeated.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: 2d incremental copy entity ")
DIM Answer$[256]
DIM Destination$[256]
DEG

Start: !
ActivateUndo

stat= SetInputFormat("n4","")
	
E1= PickEntity("PICK ELEMENT TO BE COPIED")
IF ExitScript(Destination$) THEN Leave
Stat=SetInputFormat("n4"," ")

Xmove=GetValue("X INCREMENT ")
IF ExitScript(Destination$) THEN Leave

Ymove=GetValue("Y INCREMENT ")
IF ExitScript(Destination$) THEN Leave

Zmove= 0

Stat=SetInputFormat("n0=","")
Stat=SetEqualsValue(1)
Number=GetValue("NUMBER OF TIMES",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Number=0 THEN Start


Move_vector= PointXYZ(Xmove,Ymove,0.0)
E2= VectorCopyEntity(E1,Move_vector,Number)
ActivateUndo
Stat= AdvanceUndoNumber("copy")
IF Number> 1 THEN
	Stat= AddGroupToUndo(WsUBCreateMode,E2,2,WsTrue)
	Stat= DeleteEntity(E2)
ELSE
	Stat= AddItemToUndo(WsUBCreateMode,E2)
END IF
Stat= DeleteEntity(Move_vector)


PlotAll
GOTO Start

Leave: !
ActivateUndo
stat= SetInputFormat("n4","")
Stat= DeleteEntity(Move_vector)

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