
! script name: copy.d/layercopybox
! topic: Layer copy boxed group

!A
!A NAME:
!A
!A 	Layer Copy Box
!A
!A DESCRIPTION:
!A
!A 	This script allows a group of entities or a single entity to be
!A 	copied to a layer.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick the view that elements are to be
!B 		copied in.
!B
!B 	LAYER NUMBER: Enter the value for the layer where the copy is placed.
!B
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: layer copy box ")

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

Start: !
ActivateUndo

stat= SetInputFormat("n4","")

Group=CreateGroup("TEMP")

Vnum= LastPickView
Stat=PickBox(Group,Vnum,WsPickPen)
IF ExitScript(Destination$) THEN Leave

IF NOT ValidGeometry(Group) THEN
        GOTO Start
ELSE
        IF NOT GroupCount(Group) THEN Start
END IF

Layer=InputLayer("LAYER NUMBER ")
IF ExitScript(Destination$) THEN Leave

Move_vector= PointXYZ(0,0,0)
G1= VectorCopyGroup(Group,Move_vector,1)
Stat= SetLayer(G1,Layer)

ActivateUndo
Stat= AdvanceUndoNumber("copy")
Stat= AddGroupToUndo(WsUBCreateMode,G1,2,WsTrue)

Stat= DeleteEntity(G1)
Stat= DeleteEntity(Group)
Stat= DeleteEntity(Move_vector)

PlotAll
GOTO Start

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

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