
! script name: copy.d/layercopyent
! topic: layer copy entity

!A
!A NAME:
!A
!A 	Layer Copy Entity
!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 	PICK ELEMENT TO BE COPIED: Pick the element to be copied.
!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 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"," ")

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

Move_vector= PointXYZ(0,0,0)
E2= VectorCopyEntity(E1,Move_vector,1)
Stat= SetLayer(E2,Layer)
Stat= DeleteEntity(Move_vector)

ActivateUndo
Stat= AdvanceUndoNumber("copy")
Stat= AddItemToUndo(WsUBCreateMode,E2)

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
