
! script name: copy.d/2dinccopycont
! topic: 2D copy group by incremental moves

!A
!A NAME:
!A
!A      2D Incremental Copy Group
!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 GROUP TO BE COPIED: Pick an element on the group 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 group ")

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

Start: !
ActivateUndo

stat= SetInputFormat("n4","")

C1=PickGroupEnt("PICK GROUP TO BE COPIED ")
IF ExitScript(Destination$) THEN Leave

IF NOT ValidGeometry(C1) THEN Start
Stat=Highlight(C1,WsPickPen,WsDirArrowOff)

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

ActivateUndo
Stat= AdvanceUndoNumber("copy")
FOR I= 1 TO Number 
Pm=PointXYZ(Xmove*I,Ymove*I,Zmove*I)
T1=AngleTransform(Pm,0,0,0,WsWorkplaneVals)

PlotOff
C2= CopyGroup(C1)
PlotOn
Stat=TransGroupTrans(C2,T1,0,1)
Stat=AutoNumber(C2)
IF ValidGeometry(Pm) THEN Stat= DeleteEntity(Pm)
Stat= AddGroupToUndo(WsUBCreateMode,C2,1,WsTrue)

NEXT I

Stat= DeleteEntity(Pt)
Stat= DeleteEntity(Pe)
Stat= DeleteEntity(Group)
Stat= DeleteEntity(G1)

PlotAll
GOTO Start

Leave: !
ActivateUndo
stat= SetInputFormat("n4","")
Stat= DeleteEntity(Pm)
Stat= DeleteEntity(Pt)
Stat= DeleteEntity(Pe)
Stat= DeleteEntity(Group)
Stat= DeleteEntity(G1)


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